settings_tmpl.coffee 3.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. themeOption = ({ label, value }, settings) -> """
  2. <label class="_settings-label _theme-label">
  3. <input type="radio" name="theme" value="#{value}"#{if settings.theme == value then ' checked' else ''}>
  4. #{label}
  5. </label>
  6. """
  7. app.templates.settingsPage = (settings) -> """
  8. <h1 class="_lined-heading">Preferences</h1>
  9. <div class="_settings-fieldset">
  10. <h2 class="_settings-legend">Theme:</h2>
  11. <div class="_settings-inputs">
  12. #{if settings.autoSupported
  13. themeOption label: "Automatic <small>Matches system setting</small>", value: "auto", settings
  14. else
  15. ""}
  16. #{themeOption label: "Light", value: "default", settings}
  17. #{themeOption label: "Dark", value: "dark", settings}
  18. </div>
  19. </div>
  20. <div class="_settings-fieldset">
  21. <h2 class="_settings-legend">General:</h2>
  22. <div class="_settings-inputs">
  23. <label class="_settings-label _setting-max-width">
  24. <input type="checkbox" form="settings" name="layout" value="_max-width"#{if settings['_max-width'] then ' checked' else ''}>Enable fixed-width layout
  25. </label>
  26. <label class="_settings-label _hide-on-mobile">
  27. <input type="checkbox" form="settings" name="layout" value="_sidebar-hidden"#{if settings['_sidebar-hidden'] then ' checked' else ''}>Automatically hide and show the sidebar
  28. <small>Tip: drag the edge of the sidebar to resize it.</small>
  29. </label>
  30. <label class="_settings-label">
  31. <input type="checkbox" form="settings" name="autoInstall" value="_auto-install"#{if settings.autoInstall then ' checked' else ''}>Automatically download documentation for offline use
  32. <small>Only enable this when bandwidth isn't a concern to you.</small>
  33. </label>
  34. <label class="_settings-label _hide-in-development">
  35. <input type="checkbox" form="settings" name="analyticsConsent"#{if settings.analyticsConsent then ' checked' else ''}>Enable tracking cookies
  36. <small>With this checked, we enable Google Analytics and Gauges to collect anonymous traffic information.</small>
  37. </label>
  38. </div>
  39. </div>
  40. <div class="_settings-fieldset _hide-on-mobile">
  41. <h2 class="_settings-legend">Scrolling:</h2>
  42. <div class="_settings-inputs">
  43. <label class="_settings-label">
  44. <input type="checkbox" form="settings" name="smoothScroll" value="1"#{if settings.smoothScroll then ' checked' else ''}>Use smooth scrolling
  45. </label>
  46. <label class="_settings-label _setting-native-scrollbar">
  47. <input type="checkbox" form="settings" name="layout" value="_native-scrollbars"#{if settings['_native-scrollbars'] then ' checked' else ''}>Use native scrollbars
  48. </label>
  49. <label class="_settings-label">
  50. <input type="checkbox" form="settings" name="arrowScroll" value="1"#{if settings.arrowScroll then ' checked' else ''}>Use arrow keys to scroll the main content area
  51. <small>With this checked, use <code class="_label">shift</code> + <code class="_label">&uarr;</code><code class="_label">&darr;</code><code class="_label">&larr;</code><code class="_label">&rarr;</code> to navigate the sidebar.</small>
  52. </label>
  53. </div>
  54. </div>
  55. <p class="_hide-on-mobile">
  56. <button type="button" class="_btn" data-action="export">Export</button>
  57. <label class="_btn _file-btn"><input type="file" form="settings" name="import" accept=".json">Import</label>
  58. <p>
  59. <button type="button" class="_btn-link _reset-btn" data-behavior="reset">Reset all preferences and data</button>
  60. """