Proyectos de Subversion Moodle

Rev

| Ultima modificación | Ver Log |

Rev Autor Línea Nro. Línea
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/choicelist/option
19
 
20
    Default template for a choicelist option.
21
 
22
    Any mustache can user this template to render options in a custom choicelist wrapper.
23
 
24
    Classes required for JS:
25
    * none
26
 
27
    Context variables required for this template:
28
    * optionuniqid String - unique option id.
29
    * value String - option value.
30
    * name String - options name.
31
    * optionnumber Number - option number.
32
 
33
    Example context (json):
34
    {
35
        "value": "value2",
36
        "name": "Second option",
37
        "description": "Second option description",
38
        "icon": {
39
            "extraclasses": "iconhelp",
40
            "attributes": [
41
                {"name": "src", "value": "../../../pix/help.svg"},
42
                {"name": "alt", "value": "Help icon"}
43
            ]
44
        },
45
        "hasicon": true,
46
        "optionnumber": 2,
47
        "optionuniqid": "option2uniqid",
48
        "selected": true
49
    }
50
}}
51
<div
52
    class="d-flex flex-row align-items-start p-2 mb-1 {{!
53
        }} position-relative rounded dropdown-item-outline {{!
54
        }} {{#disabled}} dimmed_text {{/disabled}} {{!
55
        }} {{#selected}} border bg-primary-light selected {{/selected}}"
56
    data-optionnumber="{{optionnumber}}"
57
    data-selected="{{selected}}"
58
    data-selected-classes = "border bg-primary-light selected"
59
>
60
    <div class="option-select-indicator">
61
        <span class="{{^selected}} d-none {{/selected}}" data-for="checkedIcon">
62
            {{#pix}} i/checkedcircle, core, {{#str}} selected, form {{/str}} {{/pix}}
63
        </span>
64
        <span class="{{#selected}} d-none {{/selected}}" data-for="uncheckedIcon">
65
            {{#pix}} i/uncheckedcircle{{/pix}}
66
        </span>
67
    </div>
68
    {{#icon}}
69
    <div class="option-icon">
70
        {{#pix}}{{key}}, {{component}}, {{title}}{{/pix}}
71
    </div>
72
    {{/icon}}
73
    <div class="option-name">
74
        <a
75
            class="stretched-link text-wrap font-weight-bold {{!
76
                }} {{^disabled}} text-dark {{/disabled}} {{!
77
                }} {{#disabled}} disabled {{/disabled}} {{!
78
                }} {{#selected}} selected {{/selected}}"
79
            role="option"
80
            {{#selected}} aria-selected="true" {{/selected}}
81
            {{#description}} aria-describedby="{{optionuniqid}}" {{/description}}
82
            data-value="{{value}}"
83
            {{#hasurl}} href="{{{url}}}" {{/hasurl}}
84
            {{! If there is no url, supose JS will handle it somehow. }}
85
            {{^hasurl}} href="#" {{/hasurl}}
86
            {{#disabled}} tabindex="-1" {{/disabled}}
87
            {{#extras}}
88
                {{attribute}}="{{value}}"
89
            {{/extras}}
90
        >
91
            {{name}}
92
        </a>
93
        {{#description}}
94
        <div
95
            id="{{optionuniqid}}"
96
            class="option-description small text-muted text-wrap">
97
            {{{description}}}
98
        </div>
99
        {{/description}}
100
    </div>
101
</div>