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 m-1 {{!
53
        }} position-relative rounded dropdown-item-outline {{!
54
        }} {{#disabled}} dimmed_text {{/disabled}} {{!
55
        }} {{#selected}} option-selected-bg selected {{/selected}}"
56
    data-optionnumber="{{optionnumber}}"
57
    data-selected="{{selected}}"
58
>
59
    <div class="option-name w-100">
60
        <a
61
            class="stretched-link text-wrap font-weight-bold py-1 pl-2 {{!
62
                }} {{^disabled}} {{/disabled}} {{!
63
                }} {{#disabled}} disabled {{/disabled}} {{!
64
                }} {{#selected}} selected {{/selected}}"
65
            role="option"
66
            {{#selected}} aria-selected="true" {{/selected}}
67
            {{#description}} aria-describedby="{{optionuniqid}}" {{/description}}
68
            data-value="{{value}}"
69
            {{#hasurl}} href="{{{url}}}" {{/hasurl}}
70
            {{! If there is no url, supose JS will handle it somehow. }}
71
            {{^hasurl}} href="#" {{/hasurl}}
72
            {{#disabled}} tabindex="-1" {{/disabled}}
73
            {{#extras}}
74
                {{attribute}}="{{value}}"
75
            {{/extras}}
76
        >
77
 
78
            <div class="option-select-indicator">
79
                <span class="{{^selected}} d-none {{/selected}}" data-for="checkedIcon">
80
                    {{#pix}} i/checkedcircle, core, {{#str}} selected, form {{/str}} {{/pix}}
81
                </span>
82
                <span class="{{#selected}} d-none {{/selected}}" data-for="uncheckedIcon">
83
                    {{#pix}} i/uncheckedcircle{{/pix}}
84
                </span>
85
            </div>
86
            {{#icon}}
87
            <div class="option-icon mx-2">
88
                {{#pix}}{{key}}, {{component}}, {{title}}{{/pix}}
89
            </div>
90
            {{/icon}}
91
 
92
            <div>
93
                    {{name}}
94
 
95
                    {{#description}}
96
                    <div
97
                        id="{{optionuniqid}}"
98
                        class="option-description small text-wrap">
99
                        {{{description}}}
100
                    </div>
101
                    {{/description}}
102
            </div>
103
 
104
        </a>
105
    </div>
106
</div>