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 block_multiblock/dropdown-bootstrap3
19
 
20
    This template shows the multiple blocks in a tabbed 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-dropdown">
44
    <ul class="nav nav-pills" id="multiblock-container-{{multiblockid}}" role="tablist">
45
        <li role="presentation" class="nav-item dropdown active">
46
            <a class="dropdown-toggle" data-toggle="dropdown" href="#" role="button" aria-haspopup="true" aria-expanded="false">
47
                {{#multiblock}}{{#active}}{{title}}{{/active}}{{/multiblock}}
48
                <span class="caret"></span>
49
            </a>
50
            <ul class="dropdown-menu">
51
            {{#multiblock}}
52
                <li>
53
                    <a class="dropdown-item" id="multiblock-tab-{{multiblockid}}-{{id}}" data-toggle="tab" href="#multiblock-{{multiblockid}}-{{id}}" role="tab" aria-controls="multiblock-tab-{{multiblockid}}-{{id}}">{{{title}}}</a>
54
                </li>
55
            {{/multiblock}}
56
            </ul>
57
        </li>
58
    </ul>
59
    <div class="tab-content mt-3" id="multiblock-content-{{multiblockid}}">
60
        {{#multiblock}}
61
            <div class="tab-pane fade{{#active}} in active{{/active}}" id="multiblock-{{multiblockid}}-{{id}}" role="tabpanel" aria-labelledby="multiblock-tab-{{multiblockid}}-{{id}}">
62
                <div class="{{class}}">
63
                    {{{content}}}
64
                    <div class="footer">{{{footer}}}</div>
65
                    {{{annotation}}}
66
                </div>
67
            </div>
68
        {{/multiblock}}
69
    </div>
70
</div>
71
{{#js}}
72
require(['jquery'], function($) {
73
    $('#multiblock-container-{{multiblockid}} .dropdown-menu a').on('click', function() {
74
        $('#multiblock-container-{{multiblockid}} a.dropdown-toggle').html($(this).html() + ' <span class="caret"></span>');
75
    });
76
});
77
{{/js}}