updated to reflect PR on OctoPrint

This commit is contained in:
electr0sheep 2018-02-22 01:09:59 -07:00
parent 09ff8e9953
commit 7a6877e709
No known key found for this signature in database
GPG Key ID: 981E1D96282F7140
3 changed files with 9 additions and 10 deletions

View File

@ -231,7 +231,7 @@
} }
control.name = ko.observable(control.name || ""); control.name = ko.observable(control.name || "");
control.style = ko.observable(control.style || ""); control.customClass = ko.observable(control.customClass || "");
control.width = ko.observable(control.hasOwnProperty("width") ? control.width : "2"); control.width = ko.observable(control.hasOwnProperty("width") ? control.width : "2");
control.offset = ko.observable(control.hasOwnProperty("offset") ? control.offset : ""); control.offset = ko.observable(control.hasOwnProperty("offset") ? control.offset : "");
@ -321,7 +321,7 @@
return; return;
} }
element.style("btn " + style); element.customClass("btn " + style);
} }
self.deleteElement = function (invokedOn, contextParent, selectedMenu) { self.deleteElement = function (invokedOn, contextParent, selectedMenu) {
var element = self.searchElement(self.controlsFromServer, contextParent.attr('id')); var element = self.searchElement(self.controlsFromServer, contextParent.attr('id'));

View File

@ -59,7 +59,7 @@
self.reset = function (data) { self.reset = function (data) {
var element = { var element = {
name: undefined, name: undefined,
style: "", cusotmClass: "",
collapsed: false, collapsed: false,
commands: "", commands: "",
confirm: "", confirm: "",
@ -106,7 +106,7 @@
} }
case "command": { case "command": {
el.name = obj.name; el.name = obj.name;
el.style = "btn"; el.customClass = "btn";
if (obj.commands.indexOf('\n') == -1) if (obj.commands.indexOf('\n') == -1)
el.command = obj.commands; el.command = obj.commands;
else else
@ -167,7 +167,7 @@
case "script": case "script":
{ {
el.name = obj.name; el.name = obj.name;
el.style = "btn"; el.customClass = "btn";
el.script = obj.script; el.script = obj.script;
if (self.useConfirm()) { if (self.useConfirm()) {

View File

@ -86,10 +86,9 @@
</script> </script>
<script type="text/html" id="settingsCustomControls_controlTemplate"> <script type="text/html" id="settingsCustomControls_controlTemplate">
<form class="form-inline custom_control" style="min-height:15px; border:1px dotted #000000" data-bind="contextMenu: { menuSelector: '#commandContextMenu', menuSelected: $root.controlContextMenu }, css: { 'sortable': $parent.layout() != 'horizontal_grid' }, attr: { 'id': id }"> <form class="form-inline custom_control" style="min-height:15px; border:1px dotted #000000" data-bind="contextMenu: { menuSelector: '#commandContextMenu', menuSelected: $root.controlContextMenu }, css: { 'sortable': $parent.layout() != 'horizontal_grid' }, attr: { 'id': id }">
<div data-bind="text: console.log($data)"></div>
<!-- ko template: { name: 'settingsCustomControls_controlTemplate_input', data: $data, if: $data.hasOwnProperty('input') } --><!-- /ko --> <!-- ko template: { name: 'settingsCustomControls_controlTemplate_input', data: $data, if: $data.hasOwnProperty('input') } --><!-- /ko -->
<!-- ko template: { name: 'settingsCustomControls_controlTemplate_command', data: $data, if: !$data.hasOwnProperty('style') && ($data.hasOwnProperty('command') || $data.hasOwnProperty('commands') || $data.hasOwnProperty('script') || $data.hasOwnProperty('javascript')) } --><!-- /ko --> <!-- ko template: { name: 'settingsCustomControls_controlTemplate_command', data: $data, if: !$data.hasOwnProperty('customClass') && ($data.hasOwnProperty('command') || $data.hasOwnProperty('commands') || $data.hasOwnProperty('script') || $data.hasOwnProperty('javascript')) } --><!-- /ko -->
<!-- ko template: { name: 'settingsCustomControls_controlTemplate_command_styled', data: $data, if: $data.hasOwnProperty('style') && ($data.hasOwnProperty('command') || $data.hasOwnProperty('commands') || $data.hasOwnProperty('script') || $data.hasOwnProperty('javascript')) } --><!-- /ko --> <!-- ko template: { name: 'settingsCustomControls_controlTemplate_command_customClass', data: $data, if: $data.hasOwnProperty('customClass') && ($data.hasOwnProperty('command') || $data.hasOwnProperty('commands') || $data.hasOwnProperty('script') || $data.hasOwnProperty('javascript')) } --><!-- /ko -->
<!-- ko template: { name: 'settingsCustomControls_controlTemplate_output', data: $data, if: $data.hasOwnProperty('value') } --><!-- /ko --> <!-- ko template: { name: 'settingsCustomControls_controlTemplate_output', data: $data, if: $data.hasOwnProperty('value') } --><!-- /ko -->
</form> </form>
</script> </script>
@ -110,7 +109,7 @@
<script type="text/html" id="settingsCustomControls_controlTemplate_command"> <script type="text/html" id="settingsCustomControls_controlTemplate_command">
<button class="btn" data-bind="text: name" onclick="event.preventDefault()"></button> <button class="btn" data-bind="text: name" onclick="event.preventDefault()"></button>
</script> </script>
<script type="text/html" id="settingsCustomControls_controlTemplate_command_styled"> <script type="text/html" id="settingsCustomControls_controlTemplate_command_customClass">
<button data-bind="text: name, attr: { 'class': style }" onclick="event.preventDefault()"></button> <button data-bind="text: name, attr: { 'class': customClass }" onclick="event.preventDefault()"></button>
</script> </script>
<!-- End of templates for custom controls --> <!-- End of templates for custom controls -->