Boolean editors - adds ID attribute to umbToggle (#6512)

This commit is contained in:
Lee Kelleher
2019-10-14 12:56:21 +01:00
committed by Sebastiaan Janssen
parent e0481ac4de
commit 16dc634cf9
4 changed files with 6 additions and 2 deletions
@@ -54,6 +54,7 @@
</pre>
@param {boolean} checked Set to <code>true</code> or <code>false</code> to toggle the switch.
@param {string} inputId Set the <code>id</code> of the toggle.
@param {callback} onClick The function which should be called when the toggle is clicked.
@param {string=} showLabels Set to <code>true</code> or <code>false</code> to show a "On" or "Off" label next to the switch.
@param {string=} labelOn Set a custom label for when the switched is turned on. It will default to "On".
@@ -122,6 +123,7 @@
scope: {
checked: "=",
disabled: "=",
inputId: "@",
onClick: "&",
labelOn: "@?",
labelOff: "@?",
@@ -1,4 +1,4 @@
<button role="checkbox" aria-checked="{{checked}}" ng-click="click()" type="button" class="umb-toggle" ng-disabled="disabled" ng-class="{'umb-toggle--checked': checked, 'umb-toggle--disabled': disabled}">
<button role="checkbox" aria-checked="{{checked}}" ng-click="click()" type="button" class="umb-toggle" ng-disabled="disabled" ng-class="{'umb-toggle--checked': checked, 'umb-toggle--disabled': disabled}" id="{{inputId}}">
<span ng-if="!labelPosition && showLabels === 'true' || labelPosition === 'left' && showLabels === 'true'">
<span ng-if="!checked" class="umb-toggle__label umb-toggle__label--left">{{ displayLabelOff }}</span>
@@ -1,5 +1,6 @@
<div ng-controller="Umbraco.PrevalueEditors.BooleanController">
<umb-toggle
input-id="{{model.alias}}"
checked="toggleValue"
on-click="toggle()">
</umb-toggle>
@@ -1,5 +1,6 @@
<div class="umb-property-editor umb-boolean" ng-controller="Umbraco.PropertyEditors.BooleanController">
<umb-toggle
input-id="{{model.alias}}"
checked="renderModel.value"
on-click="toggle()"
show-labels="{{model.config.labelOn ? 'true': 'false'}}"
@@ -7,4 +8,4 @@
label-on="{{model.config.labelOn}}"
label-off="{{model.config.labelOn}}">
</umb-toggle>
</div>
</div>