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 core/dynamic_tabs
19
 
20
    Template for showing dynamic tabs
21
 
22
    Example context (json):
23
    {
24
        "dataattributes": [ {"name": "programid", "value": "13"} ],
25
        "showtabsnavigation": "1",
26
        "tabs": [
27
            {
28
                "shortname": "tab1",
29
                "displayname": "Tab 1",
30
                "content": "Content of tab 1",
31
                "enabled": "1"
32
            },
33
            {
34
                "shortname": "tab2",
35
                "displayname": "Tab 2",
36
                "content": "Content of tab 2",
37
                "enabled": "1"
38
            }
39
        ]
40
    }
41
}}
42
{{! We must not use the JS helper otherwise this gets executed too late. Tell behat to wait. }}
43
<script>
44
    M.util.js_pending('core_dynamic_tabs_init');
45
</script>
46
 
47
<div class="dynamictabs">
48
    {{#showtabsnavigation}}
49
        <ul class="nav nav-tabs mb-4 moodle-has-zindex" id="dynamictabs-tabs" role="tablist">
50
            {{#tabs}}
51
                <li class="nav-item" role="presentation">
52
                    <a class="nav-link {{#active}}active{{/active}} {{^enabled}}disabled{{/enabled}}" id="{{shortname}}-tab" data-toggle="tab" href="#{{shortname}}" role="tab" aria-controls="{{shortname}}">
53
                        {{{displayname}}}
54
                    </a>
55
                </li>
56
            {{/tabs}}
57
        </ul>
58
    {{/showtabsnavigation}}
59
    <div class="tab-content" id="dynamictabs-content">
60
        {{#tabs}}
61
            <div class="tab-pane fade container-fluid {{#active}}show active{{/active}}"
62
                 id="{{shortname}}"
63
                 role="tabpanel"
64
                 aria-labelledby="{{shortname}}-tab"
65
                 data-tab-content="{{shortname}}"
66
                 data-tab-class="{{tabclass}}"
67
                {{#dataattributes}}data-{{name}}="{{value}}"{{/dataattributes}}>
68
                {{{content}}}
69
            </div>
70
        {{/tabs}}
71
    </div>
72
</div>
73
 
74
{{#js}}
75
    require(['core/dynamic_tabs'], function(Tabs) {
76
        Tabs.init();
77
        M.util.js_complete('core_dynamic_tabs_init');
78
    });
79
{{/js}}