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/showmore
|
|
|
19 |
|
|
|
20 |
Displays content with 'Show more'/'Show less' feature.
|
|
|
21 |
|
|
|
22 |
Example context (json):
|
|
|
23 |
{
|
|
|
24 |
"collapsedcontent": "Hello...",
|
|
|
25 |
"expandedcontent": "Hello...<br>Is it me you're looking for? I can see it in your eyes",
|
|
|
26 |
"extraclasses": "p-3",
|
|
|
27 |
"collapsedextraclasses": "bg-secondary",
|
|
|
28 |
"expandedextraclasses": "bg-secondary"
|
|
|
29 |
}
|
|
|
30 |
}}
|
|
|
31 |
<div class="showmore-container w-100 d-inline-flex flex-wrap align-items-center justify-content-between collapsed {{$extraclasses}}{{extraclasses}}{{/extraclasses}}" data-region="showmore">
|
|
|
32 |
<div class="collapsed-content my-2 my-md-0 {{$collapsedextraclasses}}{{collapsedextraclasses}}{{/collapsedextraclasses}}">
|
|
|
33 |
{{$collapsedcontent}}{{{collapsedcontent}}}{{/collapsedcontent}}
|
|
|
34 |
</div>
|
|
|
35 |
<div class="expanded-content {{$expandedextraclasses}}{{expandedextraclasses}}{{/expandedextraclasses}}">
|
|
|
36 |
{{$expandedcontent}}{{{expandedcontent}}}{{/expandedcontent}}
|
|
|
37 |
</div>
|
|
|
38 |
<button
|
|
|
39 |
type="button"
|
|
|
40 |
class="my-2 my-md-0 btn btn-sm btn-secondary align-self-start {{$buttonextraclasses}}{{buttonextraclasses}}{{/buttonextraclasses}}"
|
|
|
41 |
aria-expanded="false"
|
|
|
42 |
data-action="toggle-content"
|
|
|
43 |
>
|
|
|
44 |
<span class="collapsed-content"> {{#str}} showmore, core {{/str}}</span>
|
|
|
45 |
<span class="expanded-content"> {{#str}} showless, core {{/str}}</span>
|
|
|
46 |
</button>
|
|
|
47 |
</div>
|
|
|
48 |
{{#js}}
|
|
|
49 |
require(['core/showmore'], function(showmore) {
|
|
|
50 |
showmore.init();
|
|
|
51 |
});
|
|
|
52 |
{{/js}}
|