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 block_multiblock/carousel-bootstrap3
|
|
|
19 |
|
|
|
20 |
This template shows the multiple blocks in a carousel view
|
|
|
21 |
|
|
|
22 |
Example context (json):
|
|
|
23 |
{
|
|
|
24 |
"multiblockid": 28,
|
|
|
25 |
"multiblock": [
|
|
|
26 |
{
|
|
|
27 |
"id": 1,
|
|
|
28 |
"title": "Block 1",
|
|
|
29 |
"content": "<p>Block 1</p>",
|
|
|
30 |
"footer": "My footer",
|
|
|
31 |
"active": true
|
|
|
32 |
},
|
|
|
33 |
{
|
|
|
34 |
"id": 2,
|
|
|
35 |
"title": "Block 2",
|
|
|
36 |
"content": "<p>Block 2</p>",
|
|
|
37 |
"footer": "",
|
|
|
38 |
"active": false
|
|
|
39 |
}
|
|
|
40 |
]
|
|
|
41 |
}
|
|
|
42 |
}}
|
|
|
43 |
<div class="multiblock multiblock-carousel multiblock-carousel-bootstrap3">
|
|
|
44 |
<div class="carousel slide" id="multiblock-content-{{multiblockid}}">
|
|
|
45 |
<div class="carousel-inner" role="listbox">
|
|
|
46 |
{{#multiblock}}
|
|
|
47 |
<div class="item{{#active}} active{{/active}}" id="multiblock-{{multiblockid}}-{{id}}">
|
|
|
48 |
<div class="{{class}}">
|
|
|
49 |
{{{content}}}
|
|
|
50 |
<div class="footer">{{{footer}}}</div>
|
|
|
51 |
{{{annotation}}}
|
|
|
52 |
</div>
|
|
|
53 |
</div>
|
|
|
54 |
{{/multiblock}}
|
|
|
55 |
</div>
|
|
|
56 |
<a class="carousel-control carousel-control-prev" href="#multiblock-content-{{multiblockid}}" role="button" data-slide="prev">
|
|
|
57 |
<span class="carousel-control" aria-hidden="true">
|
|
|
58 |
{{#flex_icon}} caret-left {{/flex_icon}}
|
|
|
59 |
</span>
|
|
|
60 |
<span class="sr-only">{{#str}} previous {{/str}}</span>
|
|
|
61 |
</a>
|
|
|
62 |
<a class="carousel-control carousel-control-next" href="#multiblock-content-{{multiblockid}}" role="button" data-slide="next">
|
|
|
63 |
<span class="carousel-control" aria-hidden="true">
|
|
|
64 |
{{#flex_icon}} caret-right {{/flex_icon}}
|
|
|
65 |
</span>
|
|
|
66 |
<span class="sr-only">{{#str}} next {{/str}}</span>
|
|
|
67 |
</a>
|
|
|
68 |
</div>
|
|
|
69 |
</div>
|
|
|
70 |
{{#js}}
|
|
|
71 |
require(['jquery', 'theme_roots/bootstrap'], function($) {
|
|
|
72 |
$('#multiblock-content-{{multiblockid}}').carousel();
|
|
|
73 |
});
|
|
|
74 |
{{/js}}
|