Unified · Split
| @@ -96,6 +96,11 @@ · 95 unmodified lines | |||
| 96 | new app.views.Notif 'Share', autoHide: null if visitCount is 5 | 96 | new app.views.Notif 'Share', autoHide: null if visitCount is 5 |
| 97 | new app.views.Notif 'Thanks', autoHide: null if visitCount is 10 | 97 | new app.views.Notif 'Thanks', autoHide: null if visitCount is 10 |
| 98 | new app.views.News() | 98 | new app.views.News() |
| 99 | @checkForDocUpdates() | ||
| 100 | |||
| 101 | checkForDocUpdates: -> | ||
| 102 | @docs.checkForUpdates (i) -> | ||
| 103 | new app.views.Notif 'UpdateDocs', autoHide: null if i > 0 | ||
| 99 | 104 | ||
| 100 | reload: -> | 105 | reload: -> |
| 101 | @docs.clearCache() | 106 | @docs.clearCache() |
| @@ -42,7 +42,9 @@ class app.collections.Docs extends app.Collection · 41 unmodified lines | |||
| 42 | @models[i++].uninstall(next, next) | 42 | @models[i++].uninstall(next, next) |
| 43 | else | 43 | else |
| 44 | callback() | 44 | callback() |
| 45 | return | ||
| 45 | next() | 46 | next() |
| 47 | return | ||
| 46 | 48 | ||
| 47 | getInstallStatuses: (callback) -> | 49 | getInstallStatuses: (callback) -> |
| 48 | app.db.versions @models, (statuses) -> | 50 | app.db.versions @models, (statuses) -> |
| @@ -50,3 +52,14 @@ class app.collections.Docs extends app.Collection · 1 unmodified line | |||
| 50 | for key, value of statuses | 52 | for key, value of statuses |
| 51 | statuses[key] = installed: !!value, mtime: value | 53 | statuses[key] = installed: !!value, mtime: value |
| 52 | callback(statuses) | 54 | callback(statuses) |
| 55 | return | ||
| 56 | return | ||
| 57 | |||
| 58 | checkForUpdates: (callback) -> | ||
| 59 | @getInstallStatuses (statuses) => | ||
| 60 | i = 0 | ||
| 61 | if statuses | ||
| 62 | i += 1 for slug, status of statuses when status.installed and @findBy('slug', slug).mtime isnt status.mtime | ||
| 63 | callback(i) | ||
| 64 | return | ||
| 65 | return | ||
| @@ -36,3 +36,7 @@ app.templates.notifThanks = -> · 35 unmodified lines | |||
| 36 | <li><a href="http://devdocs.io/s/shopify" target="_blank">Shopify</a> is where I spend my weekdays. Interested in working on one of the biggest commerce platforms in the world, in a delightful work environment? We're hiring! | 36 | <li><a href="http://devdocs.io/s/shopify" target="_blank">Shopify</a> is where I spend my weekdays. Interested in working on one of the biggest commerce platforms in the world, in a delightful work environment? We're hiring! |
| 37 | </ul> | 37 | </ul> |
| 38 | <p class="_notif-text">Have a great day :) """ | 38 | <p class="_notif-text">Have a great day :) """ |
| 39 | |||
| 40 | app.templates.notifUpdateDocs = -> | ||
| 41 | textNotif """ Documentation updates available. """, | ||
| 42 | """ <a href="/offline">Install them</a> as soon as possible to avoid broken pages. """ | ||
| @@ -3,7 +3,7 @@ app.templates.offlinePage = (docs) -> """ · 2 unmodified lines | |||
| 3 | 3 | ||
| 4 | <div class="_docs-tools"> | 4 | <div class="_docs-tools"> |
| 5 | <div class="_docs-links"> | 5 | <div class="_docs-links"> |
| 6 | <a class="_docs-link" data-action-all="install">Install all</a><a class="_docs-link" data-action-all="update">Update all</a><a class="_docs-link" data-action-all="uninstall">Uninstall all</a> | 6 | <a class="_docs-link" data-action-all="install">Install all</a><a class="_docs-link" data-action-all="update"><strong>Update all</strong></a><a class="_docs-link" data-action-all="uninstall">Uninstall all</a> |
| 7 | </div> | 7 | </div> |
| 8 | </div> | 8 | </div> |
| 9 | 9 | ||
| @@ -59,7 +59,7 @@ app.templates.offlineDoc = (doc, status) -> · 49 unmodified lines | |||
| 59 | """ | 59 | """ |
| 60 | else if outdated | 60 | else if outdated |
| 61 | """ | 61 | """ |
| 62 | <td>Outdated</td> | 62 | <td><strong>Outdated</strong></td> |
| 63 | <td><a data-action="update">Update</a> - <a data-action="uninstall">Uninstall</a></td> | 63 | <td><a data-action="update">Update</a> - <a data-action="uninstall">Uninstall</a></td> |
| 64 | """ | 64 | """ |
| 65 | else | 65 | else |
| @@ -45,16 +45,16 @@ class app.views.OfflinePage extends app.View · 44 unmodified lines | |||
| 45 | return | 45 | return |
| 46 | 46 | ||
| 47 | onClick: (event) => | 47 | onClick: (event) => |
| 48 | target = event.target | 48 | return unless link = $.closestLink(event.target) |
| 49 | if action = target.getAttribute('data-action') | 49 | if action = link.getAttribute('data-action') |
| 50 | $.stopEvent(event) | 50 | $.stopEvent(event) |
| 51 | doc = @docByEl(target) | 51 | doc = @docByEl(link) |
| 52 | action = 'install' if action is 'update' | 52 | action = 'install' if action is 'update' |
| 53 | doc[action](@onInstallSuccess.bind(@, doc), @onInstallError.bind(@, doc)) | 53 | doc[action](@onInstallSuccess.bind(@, doc), @onInstallError.bind(@, doc)) |
| 54 | target.parentNode.innerHTML = "#{target.textContent.replace(/e$/, '')}ing…" | 54 | link.parentNode.innerHTML = "#{link.textContent.replace(/e$/, '')}ing…" |
| 55 | else if action = target.getAttribute('data-action-all') | 55 | else if action = link.getAttribute('data-action-all') |
| 56 | $.stopEvent(event) | 56 | $.stopEvent(event) |
| 57 | link.click() for link in @findAll("a[data-action='#{action}']") | 57 | el.click() for el in @findAll("a[data-action='#{action}']") |
| 58 | return | 58 | return |
| 59 | 59 | ||
| 60 | onInstallSuccess: (doc) -> | 60 | onInstallSuccess: (doc) -> |