Toolbar changes

This commit is contained in:
Daniel 2017-02-02 00:37:03 +00:00
parent 335845d025
commit f29b76fd5e
4 changed files with 23 additions and 18 deletions

View file

@ -1,5 +1,7 @@
Version 0.0.8 (2017-02-nn) Version 0.0.8 (2017-02-nn)
- Got rid of chroot workaround - Got rid of chroot workaround
- Added confirmation dialog before saving files
- Changes to toolbar with extended editor settings
Version 0.0.7 (2017-02-01) Version 0.0.7 (2017-02-01)
- Inserted elements are selected as visual feedback - Inserted elements are selected as visual feedback

View file

@ -81,12 +81,12 @@ INDEX = Template("""<!DOCTYPE html>
#toolbar { #toolbar {
position: relative; position: relative;
height: 20px; height: 22px;
} }
#editor { #editor {
position: absolute; position: absolute;
top: 20px; top: 22px;
right: 0; right: 0;
bottom: 0; bottom: 0;
left: 20%; left: 20%;
@ -154,13 +154,8 @@ INDEX = Template("""<!DOCTYPE html>
<select id="services" onchange="insert(this.value)"></select> <select id="services" onchange="insert(this.value)"></select>
</div> </div>
<div id="toolbar"> <div id="toolbar">
<button id="savebutton" type="button" onclick="save()">Save</button> <button id="savebutton" type="button" onclick="save_dialog()">Save</button><button id="acesettings" type="button" onclick="editor.execCommand('showSettingsMenu')">Editor settings</button><button id="aceshortcuts" type="button" onclick="window.open('https://github.com/ajaxorg/ace/wiki/Default-Keyboard-Shortcuts','_blank');">Editor keyboard shortcuts</button>
<button id="whitespace" type="button" onclick="toggle_whitespace()">Whitespace</button> <button id="restart" type="button" onclick="restart_dialog()">HASS Restart</button><button id="help" type="button" onclick="window.open('https://home-assistant.io/getting-started/','_blank');">HASS Help</button><button id="components" type="button" onclick="window.open('https://home-assistant.io/components/','_blank');">HASS Components</button>
<button id="fold" type="button" onclick="toggle_fold()">Fold</button>
<button id="highlight" type="button" onclick="toggle_highlightSelectedWord()">Highlight selected words</button>
<button id="restart" type="button" onclick="restart_dialog()">Restart HASS</button>
<button id="help" type="button" onclick="window.open('https://home-assistant.io/getting-started/','_blank');">Help</button>
<button id="components" type="button" onclick="window.open('https://home-assistant.io/components/','_blank');">Components</button>
<a id="release" class="$versionclass" href="https://github.com/danielperna84/hass-poc-configurator/releases/latest" target="_blank">$current</a> <a id="release" class="$versionclass" href="https://github.com/danielperna84/hass-poc-configurator/releases/latest" target="_blank">$current</a>
</div> </div>
<div id="editor"></div> <div id="editor"></div>
@ -290,6 +285,10 @@ INDEX = Template("""<!DOCTYPE html>
}); });
} }
function save_dialog() {
$.modal("<div><h3>Do you really want to save the changes?</h3><p><button type='button' class='simplemodal-close' onclick='save()'>Yes</button>&nbsp;<button type='button' class='simplemodal-close'>No</button></p></div>", modaloptions);
}
function save() { function save() {
var n = $("#tree").jstree("get_selected"); var n = $("#tree").jstree("get_selected");
if (n) { if (n) {
@ -314,6 +313,7 @@ INDEX = Template("""<!DOCTYPE html>
editor.setOption("displayIndentGuides", true); editor.setOption("displayIndentGuides", true);
editor.setOption("highlightSelectedWord", highlightwords); editor.setOption("highlightSelectedWord", highlightwords);
editor.$blockScrolling = Infinity; editor.$blockScrolling = Infinity;
//document.getElementById("acesettings").addEventListener('click', function(){editor.showSettingsMenu;}, false);
function insert(text) { function insert(text) {
var pos = editor.selection.getCursor(); var pos = editor.selection.getCursor();
var end = editor.session.insert(pos, text); var end = editor.session.insert(pos, text);

View file

@ -34,7 +34,7 @@
#toolbar { #toolbar {
position: relative; position: relative;
height: 20px; height: 22px;
} }
#editor { #editor {
@ -107,13 +107,12 @@
<select id="services" onchange="insert(this.value)"></select> <select id="services" onchange="insert(this.value)"></select>
</div> </div>
<div id="toolbar"> <div id="toolbar">
<button id="savebutton" type="button" onclick="save()">Save</button> <button id="savebutton" type="button" onclick="save_dialog()">Save</button>
<button id="whitespace" type="button" onclick="toggle_whitespace()">Whitespace</button> <button id="acesettings" type="button" onclick="editor.execCommand('showSettingsMenu')">Editor settings</button>
<button id="fold" type="button" onclick="toggle_fold()">Fold</button> <button id="aceshortcuts" type="button" onclick="window.open('https://github.com/ajaxorg/ace/wiki/Default-Keyboard-Shortcuts','_blank');">Editor keyboard shortcuts</button>
<button id="highlight" type="button" onclick="toggle_highlightSelectedWord()">Highlight selected words</button> <button id="restart" type="button" onclick="restart_dialog()">HASS Restart</button>
<button id="restart" type="button" onclick="restart_dialog()">Restart HASS</button> <button id="help" type="button" onclick="window.open('https://home-assistant.io/getting-started/','_blank');">HASS Help</button>
<button id="help" type="button" onclick="window.open('https://home-assistant.io/getting-started/','_blank');">Help</button> <button id="components" type="button" onclick="window.open('https://home-assistant.io/components/','_blank');">HASS Components</button>
<button id="components" type="button" onclick="window.open('https://home-assistant.io/components/','_blank');">Components</button>
<a id="release" class="$versionclass" href="https://github.com/danielperna84/hass-poc-configurator/releases/latest" target="_blank">$current</a> <a id="release" class="$versionclass" href="https://github.com/danielperna84/hass-poc-configurator/releases/latest" target="_blank">$current</a>
</div> </div>
<div id="editor"></div> <div id="editor"></div>
@ -243,6 +242,10 @@
}); });
} }
function save_dialog() {
$.modal("<div><h3>Do you really want to save the changes?</h3><p><button type='button' class='simplemodal-close' onclick='save()'>Yes</button>&nbsp;<button type='button' class='simplemodal-close'>No</button></p></div>", modaloptions);
}
function save() { function save() {
var n = $("#tree").jstree("get_selected"); var n = $("#tree").jstree("get_selected");
if (n) { if (n) {
@ -267,6 +270,7 @@
editor.setOption("displayIndentGuides", true); editor.setOption("displayIndentGuides", true);
editor.setOption("highlightSelectedWord", highlightwords); editor.setOption("highlightSelectedWord", highlightwords);
editor.$blockScrolling = Infinity; editor.$blockScrolling = Infinity;
//document.getElementById("acesettings").addEventListener('click', function(){editor.showSettingsMenu;}, false);
function insert(text) { function insert(text) {
var pos = editor.selection.getCursor(); var pos = editor.selection.getCursor();
var end = editor.session.insert(pos, text); var end = editor.session.insert(pos, text);

View file

@ -2,7 +2,6 @@ List of changes that have to be done
List of ideas that could be implemented List of ideas that could be implemented
- Confirmation dialog before saving files
- post-save scripts (to workaround current limitations) - post-save scripts (to workaround current limitations)
- Configuration validation - Configuration validation
- Git functionality (with local repository) - Git functionality (with local repository)