Add option to automatically download documentation
Unified · Split
| @@ -140,7 +140,10 @@ · 139 unmodified lines | |||
| 140 | @docs.sort() | 140 | @docs.sort() |
| 141 | @initDoc(doc) | 141 | @initDoc(doc) |
| 142 | @saveDocs() | 142 | @saveDocs() |
| 143 | _onSuccess() | 143 | if app.settings.get('autoInstall') |
| 144 | doc.install(_onSuccess, onError) | ||
| 145 | else | ||
| 146 | _onSuccess() | ||
| 144 | return | 147 | return |
| 145 | 148 | ||
| 146 | doc.load onSuccess, onError, writeCache: true | 149 | doc.load onSuccess, onError, writeCache: true |
| @@ -11,6 +11,7 @@ class app.Settings · 10 unmodified lines | |||
| 11 | 'layout' | 11 | 'layout' |
| 12 | 'size' | 12 | 'size' |
| 13 | 'tips' | 13 | 'tips' |
| 14 | 'autoInstall' | ||
| 14 | ] | 15 | ] |
| 15 | 16 | ||
| 16 | INTERNAL_KEYS = [ | 17 | INTERNAL_KEYS = [ |
| @@ -142,4 +142,6 @@ class app.models.Doc extends app.Model · 141 unmodified lines | |||
| 142 | return | 142 | return |
| 143 | 143 | ||
| 144 | isOutdated: (status) -> | 144 | isOutdated: (status) -> |
| 145 | status and status.installed and @mtime isnt status.mtime | 145 | return false if not status |
| 146 | isInstalled = status.installed or app.settings.get('autoInstall') | ||
| 147 | isInstalled and @mtime isnt status.mtime | ||
| @@ -15,6 +15,10 @@ app.templates.settingsPage = (settings) -> """ · 14 unmodified lines | |||
| 15 | <input type="checkbox" form="settings" name="layout" value="_sidebar-hidden"#{if settings['_sidebar-hidden'] then ' checked' else ''}>Automatically hide and show the sidebar | 15 | <input type="checkbox" form="settings" name="layout" value="_sidebar-hidden"#{if settings['_sidebar-hidden'] then ' checked' else ''}>Automatically hide and show the sidebar |
| 16 | <small>Tip: drag the edge of the sidebar to resize it.</small> | 16 | <small>Tip: drag the edge of the sidebar to resize it.</small> |
| 17 | </label> | 17 | </label> |
| 18 | <label class="_settings-label"> | ||
| 19 | <input type="checkbox" form="settings" name="autoInstall" value="_auto-install"#{if settings.autoInstall then ' checked' else ''}>Automatically download documentation for offline use | ||
| 20 | <small>Only enable this when bandwidth isn't a concern to you.</small> | ||
| 21 | </label> | ||
| 18 | <label class="_settings-label"> | 22 | <label class="_settings-label"> |
| 19 | <input type="checkbox" form="settings" name="analyticsConsent"#{if settings.analyticsConsent then ' checked' else ''}>Enable tracking cookies | 23 | <input type="checkbox" form="settings" name="analyticsConsent"#{if settings.analyticsConsent then ' checked' else ''}>Enable tracking cookies |
| 20 | <small>With this checked, we enable Google Analytics and Gauges to collect anonymous traffic information.</small> | 24 | <small>With this checked, we enable Google Analytics and Gauges to collect anonymous traffic information.</small> |
| @@ -14,6 +14,7 @@ class app.views.SettingsPage extends app.View · 13 unmodified lines | |||
| 14 | settings.dark = app.settings.get('dark') | 14 | settings.dark = app.settings.get('dark') |
| 15 | settings.smoothScroll = !app.settings.get('fastScroll') | 15 | settings.smoothScroll = !app.settings.get('fastScroll') |
| 16 | settings.arrowScroll = app.settings.get('arrowScroll') | 16 | settings.arrowScroll = app.settings.get('arrowScroll') |
| 17 | settings.autoInstall = app.settings.get('autoInstall') | ||
| 17 | settings.analyticsConsent = app.settings.get('analyticsConsent') | 18 | settings.analyticsConsent = app.settings.get('analyticsConsent') |
| 18 | settings[layout] = app.settings.hasLayout(layout) for layout in app.settings.LAYOUTS | 19 | settings[layout] = app.settings.hasLayout(layout) for layout in app.settings.LAYOUTS |
| 19 | settings | 20 | settings |