MDL-57447 block_myoverview: add context for courses view
[moodle.git] / blocks / myoverview / templates / courses-view.mustache
CommitLineData
992c6304
CB
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_myoverview/courses-view
19
20 This template renders the courses view for the myoverview block.
50819832
RW
21
22 Example context (json):
23 {}
992c6304
CB
24}}
25<div id="courses-view-{{uniqid}}" data-region="courses-view">
42f80a9a 26 <div class="row text-xs-center text-center">
0fc7dbce
SL
27 <div class="btn-group m-y-2" role="group" data-toggle="btns">
28 <a class="btn btn-default active" href="#myoverview_courses_view_in_progress" data-toggle="tab">
992c6304 29 {{#str}} inprogress, block_myoverview {{/str}}
0fc7dbce
SL
30 </a>
31 <a class="btn btn-default" href="#myoverview_courses_view_future" data-toggle="tab">
992c6304 32 {{#str}} future, block_myoverview {{/str}}
0fc7dbce
SL
33 </a>
34 <a class="btn btn-default" href="#myoverview_courses_view_past" data-toggle="tab">
992c6304 35 {{#str}} past, block_myoverview {{/str}}
0fc7dbce 36 </a>
992c6304
CB
37 </div>
38 </div>
0fc7dbce
SL
39 <div class="tab-content">
40 <div class="tab-pane active fade in" id="myoverview_courses_view_in_progress">
9ac2e865
RW
41 {{#inprogress}}
42 {{< block_myoverview/courses-view-by-status }}
43 {{$status}}1{{/status}}
44 {{/ block_myoverview/courses-view-by-status }}
45 {{/inprogress}}
0fc7dbce
SL
46 </div>
47 <div class="tab-pane fade" id="myoverview_courses_view_future">
9ac2e865
RW
48 {{#future}}
49 {{< block_myoverview/courses-view-by-status }}
50 {{$status}}2{{/status}}
51 {{/ block_myoverview/courses-view-by-status }}
52 {{/future}}
0fc7dbce
SL
53 </div>
54 <div class="tab-pane fade" id="myoverview_courses_view_past">
9ac2e865
RW
55 {{#past}}
56 {{< block_myoverview/courses-view-by-status }}
57 {{$status}}0{{/status}}
58 {{/ block_myoverview/courses-view-by-status }}
59 {{/past}}
0fc7dbce 60 </div>
992c6304
CB
61 </div>
62</div>
0fc7dbce
SL
63{{#js}}
64require(['jquery', 'core/custom_interaction_events'], function($, customEvents) {
65 var root = $('#courses-view-{{uniqid}}');
66 customEvents.define(root, [customEvents.events.activate]);
67 root.on(customEvents.events.activate, '[data-toggle="btns"] > .btn', function() {
68 root.find('.btn.active').removeClass('active');
69 });
70});
e8f4d954 71{{/js}}