diff --git a/assets/javascripts/collections/docs.coffee b/assets/javascripts/collections/docs.coffee index feded625..55d3c8d5 100644 --- a/assets/javascripts/collections/docs.coffee +++ b/assets/javascripts/collections/docs.coffee @@ -35,18 +35,18 @@ class app.collections.Docs extends app.Collection doc.clearCache() for doc in @models return - undownload: (callback) -> + uninstall: (callback) -> i = 0 next = => if i < @models.length - @models[i++].undownload(next, next) + @models[i++].uninstall(next, next) else callback() next() - getDownloadStatuses: (callback) -> + getInstallStatuses: (callback) -> app.db.versions @models, (statuses) -> if statuses for key, value of statuses - statuses[key] = downloaded: !!value, mtime: value + statuses[key] = installed: !!value, mtime: value callback(statuses) diff --git a/assets/javascripts/models/doc.coffee b/assets/javascripts/models/doc.coffee index 3144fcb9..44ce1ff2 100644 --- a/assets/javascripts/models/doc.coffee +++ b/assets/javascripts/models/doc.coffee @@ -89,17 +89,17 @@ class app.models.Doc extends app.Model app.store.set @slug, [@mtime, data] return - download: (onSuccess, onError) -> - return if @downloading - @downloading = true + install: (onSuccess, onError) -> + return if @installing + @installing = true error = => - @downloading = null + @installing = null onError() return success = (data) => - @downloading = null + @installing = null app.db.store @, data, onSuccess, error return @@ -109,24 +109,24 @@ class app.models.Doc extends app.Model error: error return - undownload: (onSuccess, onError) -> - return if @downloading - @downloading = true + uninstall: (onSuccess, onError) -> + return if @installing + @installing = true success = => - @downloading = null + @installing = null onSuccess() return error = => - @downloading = null + @installing = null onError() return app.db.unstore @, success, error return - getDownloadStatus: (callback) -> + getInstallStatus: (callback) -> app.db.version @, (value) -> - callback downloaded: !!value, mtime: value + callback installed: !!value, mtime: value return diff --git a/assets/javascripts/templates/pages/offline_tmpl.coffee b/assets/javascripts/templates/pages/offline_tmpl.coffee index 2d3a5720..be481e96 100644 --- a/assets/javascripts/templates/pages/offline_tmpl.coffee +++ b/assets/javascripts/templates/pages/offline_tmpl.coffee @@ -30,14 +30,14 @@ app.templates.offlinePage = (docs) -> """ canICloseTheTab = -> if app.AppCache.isEnabled() - """ Yes! Even offline, you can open a new tab, go to devdocs.io, and everything will work as if you were online (provided you downloaded all the documentations you want to use beforehand).
+ """ Yes! Even offline, you can open a new tab, go to devdocs.io, and everything will work as if you were online (provided you installed all the documentations you want to use beforehand).
Note that loading any page other than devdocs.io directly won't work (due to limitations in AppCache). """ else """ No. Because AppCache is unavailable in your browser (or has been disabled), loading devdocs.io offline won't work.
- The current tab will continue to work, though (provided you downloaded all the documentations you want to use beforehand). """ + The current tab will continue to work, though (provided you installed all the documentations you want to use beforehand). """ app.templates.offlineDoc = (doc, status) -> - outdated = status.downloaded and status.mtime isnt doc.mtime + outdated = status.installed and status.mtime isnt doc.mtime html = """ @@ -45,20 +45,20 @@ app.templates.offlineDoc = (doc, status) -> #{Math.ceil(doc.db_size / 100000) / 10} MB """ - html += if !status.downloaded + html += if !status.installed """ - - Download + Install """ else if outdated """ Outdated - Update - Delete + Update - Uninstall """ else """ Up-to-date - Delete + Uninstall """ html + '' diff --git a/assets/javascripts/views/content/offline_page.coffee b/assets/javascripts/views/content/offline_page.coffee index 124215d7..a8d0d6a2 100644 --- a/assets/javascripts/views/content/offline_page.coffee +++ b/assets/javascripts/views/content/offline_page.coffee @@ -10,7 +10,7 @@ class app.views.OfflinePage extends app.View return render: -> - app.docs.getDownloadStatuses (statuses) => + app.docs.getInstallStatuses (statuses) => return unless @activated if statuses is false @html @tmpl('offlineError') @@ -42,24 +42,24 @@ class app.views.OfflinePage extends app.View link = event.target if link.hasAttribute('data-dl') - action = 'download' + action = 'install' else if link.hasAttribute('data-del') - action = 'undownload' + action = 'uninstall' if action $.stopEvent(event) doc = @docByEl(link) - doc[action](@onDownloadSuccess.bind(@, doc), @onDownloadError.bind(@, doc)) + doc[action](@onInstallSuccess.bind(@, doc), @onInstallError.bind(@, doc)) link.parentNode.innerHTML = "#{link.textContent.replace(/e$/, '')}ing…" return - onDownloadSuccess: (doc) -> - doc.getDownloadStatus (status) => + onInstallSuccess: (doc) -> + doc.getInstallStatus (status) => @docEl(doc).outerHTML = @renderDoc(doc, status) $.highlight @docEl(doc), className: '_highlight' return - onDownloadError: (doc) -> + onInstallError: (doc) -> el = @docEl(doc) el.lastElementChild.textContent = 'Error' return diff --git a/assets/javascripts/views/sidebar/doc_picker.coffee b/assets/javascripts/views/sidebar/doc_picker.coffee index 8eec8d6c..bd126aa3 100644 --- a/assets/javascripts/views/sidebar/doc_picker.coffee +++ b/assets/javascripts/views/sidebar/doc_picker.coffee @@ -50,7 +50,7 @@ class app.views.DocPicker extends app.View app.settings.setDocs(docs) @saveLink.textContent = if app.appCache then 'Downloading\u2026' else 'Saving\u2026' disabledDocs = new app.collections.Docs(doc for doc in app.docs.all() when docs.indexOf(doc.slug) is -1) - disabledDocs.undownload -> app.reload() + disabledDocs.uninstall -> app.reload() return getSelectedDocs: ->