Proyectos de Subversion Moodle

Rev

| Ultima modificación | Ver Log |

Rev Autor Línea Nro. Línea
1441 ariadna 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/collapsable_section
19
 
20
    Standard collapsible section.
21
 
22
    Optional blocks:
23
    * extraclasses - additional classes.
24
    * elementid - optional element id.
25
    * titlecontent - the collpasible title content.
26
    * sectioncontent - the collapsible content.
27
    * extras - custom HTML attributes for the component.
28
    * expandlabel - the label for the expand icon.
29
    * collapselabel - the label for the collapse icon.
30
 
31
    Example context (json):
32
    {
33
        "titlecontent": "New content",
34
        "sectioncontent": "New content",
35
        "classes": "someclass",
36
        "extras": [
37
            {
38
                "attribute": "data-example",
39
                "value": "something"
40
            }
41
        ],
42
        "open": true,
43
        "expandlabel": "Expand",
44
        "collapselabel": "Collapse",
45
        "elementid": "someuniqueid"
46
    }
47
}}
48
<div
49
    class="collapsable-section mb-3 {{!
50
        }} {{$ extraclasses }} {{!
51
            }} {{#classes}} {{classes}} {{/classes}} {{!
52
        }} {{/ extraclasses }}"
53
    id="{{$ elementid }}{{!
54
            }}{{#elementid}}collapsable_section_{{elementid}}{{/elementid}}{{!
55
            }}{{^elementid}}collapsable_section_{{uniqid}}{{/elementid}}{{!
56
        }}{{/ elementid }}_collapsible"
57
>
58
    <div class="d-flex">
59
        <div class="d-flex align-items-center position-relative">
60
            <a
61
                role="button"
62
                data-bs-toggle="collapse"
63
                href="#{{$ elementid }}{{!
64
                        }}{{#elementid}}{{elementid}}{{/elementid}}{{!
65
                        }}{{^elementid}}collapsable_{{uniqid}}{{/elementid}}{{!
66
                    }}{{/ elementid }}"
67
                {{#open}} aria-expanded="true" {{/open}}
68
                {{^open}} aria-expanded="false" {{/open}}
69
                aria-controls="{{$ elementid }}{{!
70
                        }}{{#elementid}}{{elementid}}{{/elementid}}{{!
71
                        }}{{^elementid}}collapsable_{{uniqid}}{{/elementid}}{{!
72
                    }}{{/ elementid }}"
73
                class="btn btn-icon me-3 icons-collapse-expand justify-content-center {{!
74
                    }} {{^open}} collapsed {{/open}}"
75
            >
76
                <span
77
                    class="collapsed-icon icon-no-margin p-2"
78
                    title="{{!
79
                        }}{{$ expandlabel }}{{!
80
                            }}{{#expandlabel}}{{expandlabel}}{{/expandlabel}}{{!
81
                            }}{{^expandlabel}}{{#str}} expand, core {{/str}}{{/expandlabel}}{{!
82
                        }}{{/ expandlabel }}{{!
83
                    }}"
84
                >
85
                    <span class="dir-rtl-hide">{{#pix}} t/collapsedchevron, core {{/pix}}</span>
86
                    <span class="dir-ltr-hide">{{#pix}} t/collapsedchevron_rtl, core {{/pix}}</span>
87
                    <span class="visually-hidden">{{!
88
                        }}{{$ expandlabel }}{{!
89
                            }}{{#expandlabel}}{{expandlabel}}{{/expandlabel}}{{!
90
                            }}{{^expandlabel}}{{#str}} expand, core {{/str}}{{/expandlabel}}{{!
91
                        }}{{/ expandlabel }}{{!
92
                    }}</span>
93
                </span>
94
                <span
95
                    class="expanded-icon icon-no-margin p-2"
96
                    title="{{!
97
                        }}{{$ collapselabel }}{{!
98
                            }}{{#collapselabel}}{{collapselabel}}{{/collapselabel}}{{!
99
                            }}{{^collapselabel}}{{#str}} collapse, core {{/str}}{{/collapselabel}}{{!
100
                        }}{{/ collapselabel }}{{!
101
                    }}"
102
                >
103
                    {{#pix}} t/expandedchevron, core {{/pix}}
104
                    <span class="visually-hidden">{{!
105
                        }}{{$ collapselabel }}{{!
106
                            }}{{#collapselabel}}{{collapselabel}}{{/collapselabel}}{{!
107
                            }}{{^collapselabel}}{{#str}} collapse, core {{/str}}{{/collapselabel}}{{!
108
                        }}{{/ collapselabel }}{{!
109
                    }}</span>
110
                </span>
111
            </a>
112
            <h3
113
                class="d-flex align-self-stretch align-items-center mb-0"
114
                id="{{$ elementid }}{{!
115
                    }}{{#elementid}}collapsable_section_{{elementid}}{{/elementid}}{{!
116
                    }}{{^elementid}}collapsable_section_{{uniqid}}{{/elementid}}{{!
117
                }}{{/ elementid }}_title"
118
            >
119
                {{$ titlecontent }}
120
                    {{{titlecontent}}}
121
                {{/ titlecontent }}
122
            </h3>
123
        </div>
124
    </div>
125
    <div
126
        id="{{$ elementid }}{{!
127
                }}{{#elementid}}{{elementid}}{{/elementid}}{{!
128
                }}{{^elementid}}collapsable_{{uniqid}}{{/elementid}}{{!
129
            }}{{/ elementid }}"
130
        class="content collapse {{#open}}show{{/open}} pt-3"
131
        data-mdl-component="core/local/collapsable_section"
132
        {{$ extras }}
133
            {{#extras}}
134
            {{attribute}}="{{value}}"
135
            {{/extras}}
136
        {{/ extras }}
137
    >
138
        {{$ sectioncontent }}
139
            {{{sectioncontent}}}
140
        {{/ sectioncontent }}
141
    </div>
142
</div>
143
{{#js}}
144
require(['core/local/collapsable_section/controls'], function(Controls) {
145
    Controls.init();
146
});
147
{{/js}}