Allow enable all documentations

pull/1591/head
Enoc 4 years ago
parent 54a0e8efca
commit 811aa91cb3

@ -92,6 +92,13 @@ class app.Router
settings: (context) ->
return "/#/#{context.path}" if app.isSingleDoc()
@triggerRoute 'settings'
# Allows check all the checkboxes in /settings.
# This event needs to be added runtime since the button is
# added to the sidebar when the page is loaded, not like
# other elements that are hidden and are shown when the page
# loads
app.document.settings.setCheckboxesEvent()
return
offline: (context)->

@ -60,7 +60,10 @@ templates.sidebarDisabledList = (html) ->
templates.sidebarDisabledVersionedDoc = (doc, versions) ->
"""<a class="_list-item _list-dir _icon-#{doc.icon} _list-disabled" data-slug="#{doc.slug_without_version}" tabindex="-1">#{arrow}#{doc.name}</a><div class="_list _list-sub">#{versions}</div>"""
templates.docPickerHeader = """<div class="_list-picker-head"><span>Documentation</span> <span>Enable</span></div>"""
templates.docPickerHeader = """
<div class="_list-picker-head"><span>Documentation</span> <span>Enable</span></div>
<div class="_list-picker-head _centered-list-picker-head" id="enable-all"><div>Enable all</div></div>
"""
templates.docPickerNote = """
<div class="_list-note">Tip: for faster and better search results, select only the docs you need.</div>

@ -81,3 +81,19 @@ class app.views.Settings extends app.View
$.stopEvent(event)
app.router.show '/'
return
setCheckboxesEvent: =>
button = document.getElementById('enable-all')
button.addEventListener 'click', @checkAllCheckboxes
return
checkAllCheckboxes: =>
checkboxes = document.getElementsByClassName('_list-checkbox')
i = 0
while (i < checkboxes.length)
checkboxes[i].checked = true
i++
@addClass('_dirty')
return

@ -367,3 +367,20 @@
&:after { visibility: hidden; }
&:hover:after { visibility: visible; }
}
._centered-list-picker-head {
cursor: pointer;
text-aling: center;
color: var(--textColor);
@extend %border-box;
& div{
margin-left: auto;
margin-right: auto;
}
&:active {
box-shadow: inset 0 1px 1px rgba(black, .05), inset 0 1px 4px var(--boxBorder);
}
}

Loading…
Cancel
Save