Merge branch 'pr/2444' into maintenance
This commit is contained in:
commit
291fa88a82
3 files changed
+9
-1
No files matched your search
@@ -166,6 +166,10 @@ Controls
|
||||
clicked. This allows to override the direct sending of the command or commands to the printer with more
|
||||
sophisticated behaviour. The JavaScript snippet is ``eval``'d and processed in a context where the control
|
||||
it is part of is provided as local variable ``data`` and the ``ControlViewModel`` is available as ``self``.
|
||||
* - ``additionalClasses``
|
||||
- (Optional) Additional classes to apply to the button of a ``command``, ``commands``, ``script`` or ``javascript``
|
||||
control, other than the default ``btn``. Can be used to visually style the button, e.g. set to ``btn-danger`` to
|
||||
turn the button red.
|
||||
* - ``enabled``
|
||||
- (Optional) A JavaScript snippet returning either ``true`` or ``false`` determining whether the control
|
||||
should be enabled or not. This allow to override the default logic for this (disabled if printer is offline
|
||||
|
||||
@@ -226,6 +226,10 @@ $(function() {
|
||||
}
|
||||
}
|
||||
|
||||
if (control.hasOwnProperty("command") && !control.hasOwnProperty("additionalClasses")) {
|
||||
control.additionalClasses = "";
|
||||
}
|
||||
|
||||
control.processed = true;
|
||||
return control;
|
||||
};
|
||||
|
||||
@@ -173,6 +173,6 @@
|
||||
<label style="cursor: default" data-bind="text: output"></label>
|
||||
</script>
|
||||
<script type="text/html" id="customControls_controlTemplate_command">
|
||||
<button class="btn" data-bind="text: name, enable: $root.isCustomEnabled($data), click: function() { $root.clickCustom($data) }"></button>
|
||||
<button class="btn" data-bind="text: name, css: additionalClasses, enable: $root.isCustomEnabled($data), click: function() { $root.clickCustom($data) }"></button>
|
||||
</script>
|
||||
<!-- End of templates for custom controls -->
|
||||
Reference in new issue
Block a user