2018-11-05 05:06:39 -05:00
|
|
|
/* eslint-disable
|
|
|
|
max-len,
|
|
|
|
*/
|
|
|
|
// TODO: This file was created by bulk-decaffeinate.
|
|
|
|
// Fix any style issues and re-enable lint.
|
|
|
|
/*
|
|
|
|
* decaffeinate suggestions:
|
|
|
|
* DS102: Remove unnecessary code created because of implicit returns
|
|
|
|
* Full docs: https://github.com/decaffeinate/decaffeinate/blob/master/docs/suggestions.md
|
|
|
|
*/
|
2020-05-19 05:02:56 -04:00
|
|
|
import App from '../../../base'
|
|
|
|
|
|
|
|
export default App.directive('toggleSwitch', () => ({
|
|
|
|
restrict: 'E',
|
|
|
|
scope: {
|
|
|
|
description: '@',
|
|
|
|
labelFalse: '@',
|
|
|
|
labelTrue: '@',
|
2021-04-27 03:52:58 -04:00
|
|
|
ngModel: '=',
|
2020-05-19 05:02:56 -04:00
|
|
|
},
|
|
|
|
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"
|
|
|
|
>
|
|
|
|
<label for="toggle-switch-false-{{$id}}" class="toggle-switch-label">{{labelFalse}}</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"
|
|
|
|
>
|
|
|
|
<label for="toggle-switch-true-{{$id}}" class="toggle-switch-label">{{labelTrue}}</label>
|
2018-04-16 04:36:10 -04:00
|
|
|
|
2020-05-19 05:02:56 -04:00
|
|
|
<span class="toggle-switch-selection" aria-hidden="true"></span>
|
2018-11-05 05:06:39 -05:00
|
|
|
</fieldset>\
|
2021-04-27 03:52:58 -04:00
|
|
|
`,
|
2020-05-19 05:02:56 -04:00
|
|
|
}))
|