2020-05-19 05:02:56 -04:00
|
|
|
import App from '../../../base'
|
|
|
|
|
2023-10-17 04:36:46 -04:00
|
|
|
export default App.directive('toggleSwitch', function () {
|
|
|
|
return {
|
|
|
|
restrict: 'E',
|
|
|
|
scope: {
|
|
|
|
description: '@',
|
|
|
|
labelFalse: '@',
|
|
|
|
labelTrue: '@',
|
|
|
|
ngModel: '=',
|
|
|
|
},
|
|
|
|
template: `\
|
2018-11-05 05:06:39 -05:00
|
|
|
<fieldset class="toggle-switch">
|
2020-05-19 05:02:56 -04:00
|
|
|
<legend class="sr-only">{{description}}</legend>
|
2018-04-16 04:36:10 -04:00
|
|
|
|
2020-05-19 05:02:56 -04:00
|
|
|
<input
|
|
|
|
type="radio"
|
|
|
|
name="toggle-switch-{{$id}}"
|
|
|
|
class="toggle-switch-input"
|
|
|
|
id="toggle-switch-false-{{$id}}"
|
|
|
|
ng-value="false"
|
|
|
|
ng-model="ngModel"
|
|
|
|
>
|
2021-12-14 08:25:42 -05:00
|
|
|
<label for="toggle-switch-false-{{$id}}" class="toggle-switch-label"><span>{{labelFalse}}</span></label>
|
2018-04-16 04:36:10 -04:00
|
|
|
|
2020-05-19 05:02:56 -04:00
|
|
|
<input
|
|
|
|
type="radio"
|
|
|
|
class="toggle-switch-input"
|
|
|
|
name="toggle-switch-{{$id}}"
|
|
|
|
id="toggle-switch-true-{{$id}}"
|
|
|
|
ng-value="true"
|
|
|
|
ng-model="ngModel"
|
|
|
|
>
|
2021-12-14 08:25:42 -05:00
|
|
|
<label for="toggle-switch-true-{{$id}}" class="toggle-switch-label"><span>{{labelTrue}}</span></label>
|
2018-11-05 05:06:39 -05:00
|
|
|
</fieldset>\
|
2021-04-27 03:52:58 -04:00
|
|
|
`,
|
2023-10-17 04:36:46 -04:00
|
|
|
}
|
|
|
|
})
|