| 1 |
efrain |
1 |
{{!
|
|
|
2 |
This file is part of Moodle - http://moodle.org/
|
|
|
3 |
|
|
|
4 |
Moodle is free software: you can redistribute it and/or modify
|
|
|
5 |
it under the terms of the GNU General Public License as published by
|
|
|
6 |
the Free Software Foundation, either version 3 of the License, or
|
|
|
7 |
(at your option) any later version.
|
|
|
8 |
|
|
|
9 |
Moodle is distributed in the hope that it will be useful,
|
|
|
10 |
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
11 |
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
12 |
GNU General Public License for more details.
|
|
|
13 |
|
|
|
14 |
You should have received a copy of the GNU General Public License
|
|
|
15 |
along with Moodle. If not, see <http://www.gnu.org/licenses/>.
|
|
|
16 |
}}
|
|
|
17 |
{{!
|
|
|
18 |
@template core/local/dropdown/status
|
|
|
19 |
|
|
|
20 |
Displays a dropdown status selector component.
|
|
|
21 |
|
|
|
22 |
Classes required for JS:
|
|
|
23 |
* none
|
|
|
24 |
|
|
|
25 |
Context variables required for this template:
|
|
|
26 |
* buttoncontent String - the dropdown trigger button content.
|
|
|
27 |
* choices Array - the status options.
|
|
|
28 |
|
|
|
29 |
Example context (json):
|
|
|
30 |
{
|
|
|
31 |
"buttonid" : "someinternalid",
|
|
|
32 |
"buttoncontent" : "Trigger button",
|
|
|
33 |
"choices" : {
|
|
|
34 |
"hasoptions": true,
|
|
|
35 |
"dialogcontent": "Dialog content",
|
|
|
36 |
"options": [
|
|
|
37 |
{
|
|
|
38 |
"optionid": "option1",
|
|
|
39 |
"value": "value1",
|
|
|
40 |
"name": "First option",
|
|
|
41 |
"description": "First option description",
|
|
|
42 |
"hasicon": false,
|
|
|
43 |
"first": true,
|
|
|
44 |
"optionnumber": 1,
|
|
|
45 |
"optionuniqid": "option1uniqid",
|
|
|
46 |
"selected": true
|
|
|
47 |
},
|
|
|
48 |
{
|
|
|
49 |
"optionid": "option2",
|
|
|
50 |
"value": "value2",
|
|
|
51 |
"name": "Second option",
|
|
|
52 |
"description": "Second option description",
|
|
|
53 |
"icon": {
|
|
|
54 |
"extraclasses": "iconhelp",
|
|
|
55 |
"attributes": [
|
|
|
56 |
{"name": "src", "value": "../../../pix/help.svg"},
|
|
|
57 |
{"name": "alt", "value": "Help icon"}
|
|
|
58 |
]
|
|
|
59 |
},
|
|
|
60 |
"hasicon": true,
|
|
|
61 |
"optionnumber": 2,
|
|
|
62 |
"optionuniqid": "option2uniqid"
|
|
|
63 |
},
|
|
|
64 |
{
|
|
|
65 |
"optionid": "option3",
|
|
|
66 |
"value": "value3",
|
|
|
67 |
"name": "Third option",
|
|
|
68 |
"description": "Third option description",
|
|
|
69 |
"icon": {
|
|
|
70 |
"extraclasses": "iconhelp",
|
|
|
71 |
"attributes": [
|
|
|
72 |
{"name": "src", "value": "../../../pix/help.svg"},
|
|
|
73 |
{"name": "alt", "value": "Help icon"}
|
|
|
74 |
]
|
|
|
75 |
},
|
|
|
76 |
"hasicon": true,
|
|
|
77 |
"disabled": true,
|
|
|
78 |
"optionnumber": 3,
|
|
|
79 |
"optionuniqid": "option3uniqid"
|
|
|
80 |
}
|
|
|
81 |
]
|
|
|
82 |
},
|
|
|
83 |
"extras" : [
|
|
|
84 |
{
|
|
|
85 |
"attribute" : "data-example",
|
|
|
86 |
"value" : "stickyfooter"
|
|
|
87 |
}
|
|
|
88 |
],
|
|
|
89 |
"buttonclasses" : "extraclasses"
|
|
|
90 |
}
|
|
|
91 |
}}
|
|
|
92 |
{{< core/local/dropdown/dialog }}
|
|
|
93 |
{{$ dialogcontent }}
|
|
|
94 |
{{#dialogcontent}}
|
|
|
95 |
<div class="pb-2 border-bottom">{{{dialogcontent}}}</div>
|
|
|
96 |
{{/dialogcontent}}
|
|
|
97 |
{{#choices}}
|
|
|
98 |
{{> core/local/choicelist }}
|
|
|
99 |
{{/choices}}
|
|
|
100 |
{{/ dialogcontent }}
|
|
|
101 |
{{/ core/local/dropdown/dialog }}
|
|
|
102 |
{{#js}}
|
|
|
103 |
require(['core/local/dropdown/status'], function(Module) {
|
|
|
104 |
Module.init('#' + '{{$ dropdownid }}{{!
|
|
|
105 |
}}{{#dropdownid}}{{dropdownid}}{{/dropdownid}}{{!
|
|
|
106 |
}}{{^dropdownid}}dropdownDialog_{{uniqid}}{{/dropdownid}}{{!
|
|
|
107 |
}}{{/ dropdownid }}');
|
|
|
108 |
});
|
|
|
109 |
{{/js}}
|