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,6 +140,9 @@
@docs.sort()
@initDoc(doc)
@saveDocs()
if app.settings.get('autoInstall')
doc.install(_onSuccess, onError)
else
_onSuccess()
return

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

@ -142,4 +142,6 @@ class app.models.Doc extends app.Model
return
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
<small>Tip: drag the edge of the sidebar to resize it.</small>
</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">
<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>

@ -14,6 +14,7 @@ class app.views.SettingsPage extends app.View
settings.dark = app.settings.get('dark')
settings.smoothScroll = !app.settings.get('fastScroll')
settings.arrowScroll = app.settings.get('arrowScroll')
settings.autoInstall = app.settings.get('autoInstall')
settings.analyticsConsent = app.settings.get('analyticsConsent')
settings[layout] = app.settings.hasLayout(layout) for layout in app.settings.LAYOUTS
settings

Loading…
Cancel
Save