Permalink
Browse files

Wire up pref toggle to pref menu

  • Loading branch information...
marcobeltempo committed Jan 6, 2018
1 parent 8899b2a commit b4b595c43b0f6e3f7d02c41360cf21ac02ace846
Showing with 33 additions and 0 deletions.
  1. +2 −0 locales/en-US/server.properties
  2. +24 −0 public/editor/scripts/ui/menus.js
  3. +7 −0 views/editor/nav-options.html
@@ -80,6 +80,7 @@ navTextSize=Text size
navColorTheme=Color theme
navWrapText=Wrap long lines
navAllowJS=Allow JavaScript
navAllowHints=Show hints
navAllowWS=Show White Space
navAutoComplete=Autocomplete code
navAutoEncloseTags=Auto close tags
@@ -398,6 +399,7 @@ navDarkThemeIconTitle=Switch to the dark theme
navLightThemeIconTitle=Switch to the light theme
navWrapTextTitle=Toggle wrapping long lines of code
navAllowJSTitle=Toggle running JavaScript code in the preview
navAllowHintsTitle=Toggle hints
navAllowWSTitle=Toggle running WhiteSpace Indicator
navAutoCompleteTitle=Toggle Autocomplete
navAutoEncloseTagsTitle=Toggle automatically closing HTML tags
@@ -228,6 +228,30 @@ function setupOptionsMenu(bramble) {
return false;
});
//set initial UI value to show hints
if (bramble.getAllowHints()) {
$("#allow-hints-toggle").addClass("switch-enabled");
} else {
$("#allow-hints-toggle").removeClass("switch-enabled");
}
// Enable/Disable Hints Indicator
$("#editor-option-allowhints").click(function() {
// Toggle current value
var $allowHintsToggle = $("#allow-hints-toggle");
var toggle = !$allowHintsToggle.hasClass("switch-enabled");
if (toggle) {
$allowHintsToggle.addClass("switch-enabled");
bramble.enableHints();
} else {
$allowHintsToggle.removeClass("switch-enabled");
bramble.disableHints();
}
return false;
});
//set initial UI value to allow whitespace indicator
if (bramble.getAllowWhiteSpace()) {
$("#allow-whitespace-toggle").addClass("switch-enabled");
@@ -148,6 +148,13 @@ <h2 class="snippets-menu-title">{{ gettext("snippetMenuTitle") }}</h2>
<div class="toggle-button"></div>
</div>
</li>
<li title="{{ gettext("navAllowHintsTitle") }}" id="editor-option-allowhints">
<span>{{ gettext("navAllowHints") }}</span>
<div class="switch-toggle switch-enabled" id="allow-hints-toggle">
<div class="toggle-backing"></div>
<div class="toggle-button"></div>
</div>
</li>
<li title="{{ gettext("navAllowWSTitle") }}" id="editor-option-allowws">
<span>{{ gettext("navAllowWS") }}</span>
<div class="switch-toggle switch-enabled" id="allow-whitespace-toggle">

0 comments on commit b4b595c

Please sign in to comment.