2 This file is part of Moodle - http://moodle.org/
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.
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.
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/>.
18 @template core/showmore
20 Displays content with 'Show more'/'Show less' feature.
22 Example context (json):
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"
31 <div class="showmore-container collapsed {{$extraclasses}}{{extraclasses}}{{/extraclasses}}" data-region="showmore">
34 class="btn btn-sm btn-link p-0 {{$buttonextraclasses}}{{buttonextraclasses}}{{/buttonextraclasses}}"
36 data-action="toggle-content"
38 <span class="collapsed-content"> {{#str}} showmore, core {{/str}} {{#pix}} t/expandedchevron, core {{/pix}} </span>
39 <span class="expanded-content"> {{#str}} showless, core {{/str}} {{#pix}} t/collapsedchevron_up, core {{/pix}} </span>
41 <div class="collapsed-content {{$collapsedextraclasses}}{{collapsedextraclasses}}{{/collapsedextraclasses}}">
42 {{$collapsedcontent}}{{{collapsedcontent}}}{{/collapsedcontent}}
44 <div class="expanded-content {{$expandedextraclasses}}{{expandedextraclasses}}{{/expandedextraclasses}}">
45 {{$expandedcontent}}{{{expandedcontent}}}{{/expandedcontent}}
49 require(['core/showmore'], function(showmore) {