Add option to automatically download documentation

pull/886/head
Jasper van Merle 7 years ago
parent bec78bf6ed
commit 85f57fe5d0

@ -138,7 +138,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

@ -10,6 +10,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>
</div> </div>
</div> </div>

@ -17,6 +17,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[layout] = app.settings.hasLayout(layout) for layout in LAYOUTS settings[layout] = app.settings.hasLayout(layout) for layout in LAYOUTS
settings settings

Loading…
Cancel
Save