Skip to content

Commit

Permalink
MDL-73470 core: Move toggle template to core
Browse files Browse the repository at this point in the history
  • Loading branch information
roland04 committed Jan 25, 2022
1 parent e63604f commit 7950874
Show file tree
Hide file tree
Showing 8 changed files with 75 additions and 47 deletions.
2 changes: 2 additions & 0 deletions lang/en/reportbuilder.php
Expand Up @@ -92,6 +92,7 @@
$string['deletereportconfirm'] = 'Are you sure you want to delete the report \'{$a}\' and all associated data?';
$string['deleteschedule'] = 'Delete schedule';
$string['deletescheduleconfirm'] = 'Are you sure you want to delete the schedule \'{$a}\'?';
$string['disableschedule'] = 'Disable schedule';
$string['editaudience'] = 'Edit audience \'{$a}\'';
$string['editdetails'] = 'Edit details';
$string['editor'] = 'Editor';
Expand All @@ -100,6 +101,7 @@
$string['editreportname'] = 'Edit report name';
$string['editscheduledetails'] = 'Edit schedule details';
$string['editschedulename'] = 'Edit schedule name';
$string['enableschedule'] = 'Enable schedule';
$string['entitycourse'] = 'Course';
$string['entityuser'] = 'User';
$string['errorreportcreate'] = 'You cannot create a new report';
Expand Down
48 changes: 48 additions & 0 deletions lib/templates/toggle.mustache
@@ -0,0 +1,48 @@
{{!
This file is part of Moodle - http://moodle.org/
Moodle is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Moodle is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with Moodle. If not, see <http://www.gnu.org/licenses/>.
}}
{{!
@template core/toggle
Template for toggle element
Example context (json):
{
"id": "reality-toggle-3",
"checked": true,
"disabled": false,
"dataattributes": [{
"name": "action",
"value": "toggle-reality"
}],
"label": "Enable/disable reality",
"labelclasses": "sr-only"
}
}}

<div class="custom-control custom-switch {{$extraclasses}}{{extraclasses}}{{/extraclasses}}">
<input type="checkbox" class="custom-control-input" id="{{$id}}{{id}}{{/id}}"
{{$attributes}}
{{#dataattributes}}data-{{name}}="{{value}}" {{/dataattributes}}
{{#checked}}checked{{/checked}}
{{#disabled}}disabled{{/disabled}}
{{/attributes}}>
{{$labelmarkup}}
<label class="custom-control-label" for="{{$id}}{{id}}{{/id}}">
<span class="{{$labelclasses}}{{labelclasses}}{{/labelclasses}}">{{$label}}{{label}}{{/label}}</span>
</label>
{{/labelmarkup}}
</div>
2 changes: 1 addition & 1 deletion reportbuilder/amd/build/schedules.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 7950874

Please sign in to comment.