Add option to automatically download documentation (#886)

Add option to automatically download documentation
pull/1028/head
Jasper van Merle 6 years ago committed by GitHub
commit 0f9ff40cb8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -140,7 +140,10 @@
@docs.sort() @docs.sort()
@initDoc(doc) @initDoc(doc)
@saveDocs() @saveDocs()
_onSuccess() if app.settings.get('autoInstall')
doc.install(_onSuccess, onError)
else
_onSuccess()
return return
doc.load onSuccess, onError, writeCache: true doc.load onSuccess, onError, writeCache: true

@ -11,6 +11,7 @@ class app.Settings
'layout' 'layout'
'size' 'size'
'tips' 'tips'
'autoInstall'
] ]
INTERNAL_KEYS = [ INTERNAL_KEYS = [

@ -142,4 +142,6 @@ class app.models.Doc extends app.Model
return return
isOutdated: (status) -> isOutdated: (status) ->
status and status.installed and @mtime isnt status.mtime return false if not status
isInstalled = status.installed or app.settings.get('autoInstall')
isInstalled and @mtime isnt status.mtime

@ -15,6 +15,10 @@ app.templates.settingsPage = (settings) -> """
<input type="checkbox" form="settings" name="layout" value="_sidebar-hidden"#{if settings['_sidebar-hidden'] then ' checked' else ''}>Automatically hide and show the sidebar <input type="checkbox" form="settings" name="layout" value="_sidebar-hidden"#{if settings['_sidebar-hidden'] then ' checked' else ''}>Automatically hide and show the sidebar
<small>Tip: drag the edge of the sidebar to resize it.</small> <small>Tip: drag the edge of the sidebar to resize it.</small>
</label> </label>
<label class="_settings-label">
<input type="checkbox" form="settings" name="autoInstall" value="_auto-install"#{if settings.autoInstall then ' checked' else ''}>Automatically download documentation for offline use
<small>Only enable this when bandwidth isn't a concern to you.</small>
</label>
<label class="_settings-label"> <label class="_settings-label">
<input type="checkbox" form="settings" name="analyticsConsent"#{if settings.analyticsConsent then ' checked' else ''}>Enable tracking cookies <input type="checkbox" form="settings" name="analyticsConsent"#{if settings.analyticsConsent then ' checked' else ''}>Enable tracking cookies
<small>With this checked, we enable Google Analytics and Gauges to collect anonymous traffic information.</small> <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
settings.dark = app.settings.get('dark') settings.dark = app.settings.get('dark')
settings.smoothScroll = !app.settings.get('fastScroll') settings.smoothScroll = !app.settings.get('fastScroll')
settings.arrowScroll = app.settings.get('arrowScroll') settings.arrowScroll = app.settings.get('arrowScroll')
settings.autoInstall = app.settings.get('autoInstall')
settings.analyticsConsent = app.settings.get('analyticsConsent') settings.analyticsConsent = app.settings.get('analyticsConsent')
settings[layout] = app.settings.hasLayout(layout) for layout in app.settings.LAYOUTS settings[layout] = app.settings.hasLayout(layout) for layout in app.settings.LAYOUTS
settings settings

Loading…
Cancel
Save