Unified · Split
| @@ -35,6 +35,15 @@ class app.collections.Docs extends app.Collection · 34 unmodified lines | |||
| 35 | doc.clearCache() for doc in @models | 35 | doc.clearCache() for doc in @models |
| 36 | return | 36 | return |
| 37 | 37 | ||
| 38 | undownload: (callback) -> | ||
| 39 | i = 0 | ||
| 40 | next = => | ||
| 41 | if i < @models.length | ||
| 42 | @models[i++].undownload(next, next) | ||
| 43 | else | ||
| 44 | callback() | ||
| 45 | next() | ||
| 46 | |||
| 38 | getDownloadStatuses: (callback) -> | 47 | getDownloadStatuses: (callback) -> |
| 39 | app.db.versions @models, (statuses) -> | 48 | app.db.versions @models, (statuses) -> |
| 40 | if statuses | 49 | if statuses |
| @@ -46,9 +46,11 @@ class app.views.DocPicker extends app.View · 45 unmodified lines | |||
| 46 | save: -> | 46 | save: -> |
| 47 | unless @saving | 47 | unless @saving |
| 48 | @saving = true | 48 | @saving = true |
| 49 | app.settings.setDocs @getSelectedDocs() | 49 | docs = @getSelectedDocs() |
| 50 | app.settings.setDocs(docs) | ||
| 50 | @saveLink.textContent = if app.appCache then 'Downloading\u2026' else 'Saving\u2026' | 51 | @saveLink.textContent = if app.appCache then 'Downloading\u2026' else 'Saving\u2026' |
| 51 | app.reload() | 52 | disabledDocs = new app.collections.Docs(doc for doc in app.docs.all() when docs.indexOf(doc.slug) is -1) |
| 53 | disabledDocs.undownload -> app.reload() | ||
| 52 | return | 54 | return |
| 53 | 55 | ||
| 54 | getSelectedDocs: -> | 56 | getSelectedDocs: -> |