Unified · Split
| @@ -96,6 +96,11 @@ · 95 unmodified lines | ||
| 96 | 96 | new app.views.Notif 'Share', autoHide: null if visitCount is 5 |
| 97 | 97 | new app.views.Notif 'Thanks', autoHide: null if visitCount is 10 |
| 98 | 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 | 105 | reload: -> |
| 101 | 106 | @docs.clearCache() |
| @@ -42,7 +42,9 @@ class app.collections.Docs extends app.Collection · 41 unmodified lines | ||
| 42 | 42 | @models[i++].uninstall(next, next) |
| 43 | 43 | else |
| 44 | 44 | callback() |
| 45 | + return | |
| 45 | 46 | next() |
| 47 | + return | |
| 46 | 48 | |
| 47 | 49 | getInstallStatuses: (callback) -> |
| 48 | 50 | app.db.versions @models, (statuses) -> |
| @@ -50,3 +52,14 @@ class app.collections.Docs extends app.Collection · 1 unmodified line | ||
| 50 | 52 | for key, value of statuses |
| 51 | 53 | statuses[key] = installed: !!value, mtime: value |
| 52 | 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 | 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 | 37 | </ul> |
| 38 | 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 | 4 | <div class="_docs-tools"> |
| 5 | 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 | 7 | </div> |
| 8 | 8 | </div> |
| 9 | 9 | |
| @@ -59,7 +59,7 @@ app.templates.offlineDoc = (doc, status) -> · 49 unmodified lines | ||
| 59 | 59 | """ |
| 60 | 60 | else if outdated |
| 61 | 61 | """ |
| 62 | − <td>Outdated</td> | |
| 62 | + <td><strong>Outdated</strong></td> | |
| 63 | 63 | <td><a data-action="update">Update</a> - <a data-action="uninstall">Uninstall</a></td> |
| 64 | 64 | """ |
| 65 | 65 | else |
| @@ -45,16 +45,16 @@ class app.views.OfflinePage extends app.View · 44 unmodified lines | ||
| 45 | 45 | return |
| 46 | 46 | |
| 47 | 47 | onClick: (event) => |
| 48 | − target = event.target | |
| 49 | − if action = target.getAttribute('data-action') | |
| 48 | + return unless link = $.closestLink(event.target) | |
| 49 | + if action = link.getAttribute('data-action') | |
| 50 | 50 | $.stopEvent(event) |
| 51 | − doc = @docByEl(target) | |
| 51 | + doc = @docByEl(link) | |
| 52 | 52 | action = 'install' if action is 'update' |
| 53 | 53 | doc[action](@onInstallSuccess.bind(@, doc), @onInstallError.bind(@, doc)) |
| 54 | − target.parentNode.innerHTML = "#{target.textContent.replace(/e$/, '')}ing…" | |
| 55 | − else if action = target.getAttribute('data-action-all') | |
| 54 | + link.parentNode.innerHTML = "#{link.textContent.replace(/e$/, '')}ing…" | |
| 55 | + else if action = link.getAttribute('data-action-all') | |
| 56 | 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 | 58 | return |
| 59 | 59 | |
| 60 | 60 | onInstallSuccess: (doc) -> |