MDL-57445 block_myoverview: Add timeline by date templates

Part of MDL-55611 epic.
This commit is contained in:
Cameron Ball
2017-04-03 11:35:37 +08:00
committed by Damyon Wiese
parent ca622fd9fa
commit 1c68e83b1f
6 changed files with 230 additions and 0 deletions
@@ -24,4 +24,9 @@
$string['myoverview:addinstance'] = 'Add a new my overview block';
$string['myoverview:myaddinstance'] = 'Add a new my overview block to Dashboard';
$string['next7days'] = 'Next 7 days';
$string['next30days'] = 'Next 30 days';
$string['pluginname'] = 'My overview';
$string['sortbycourses'] = 'Sort by courses';
$string['sortbydates'] = 'Sort by dates';
$string['timeline'] = 'Timeline';
@@ -0,0 +1,48 @@
{{!
This file is part of Moodle - http://moodle.org/
Moodle is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Moodle is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with Moodle. If not, see <http://www.gnu.org/licenses/>.
}}
{{!
@template block_myoverview/event-list-item
This template renders an event list item for the myoverview block.
}}
<li class="list-group-item" data-region="event-list-item">
<div class="container-fluid">
<div class="row">
{{#itemcount}}
<div class="pull-xs-right hidden-sm-down m-l-1">
<span class="tag tag-pill tag-default">{{.}}</span>
</div>
{{/itemcount}}
<div class="d-inline-block pull-xs-right hidden-sm-down m-l-1"><a href="{{{actionurl}}}">{{actionname}}</a></div>
<div class="d-inline-block pull-xs-right hidden-sm-down">{{enddate}}</div>
<div class="d-inline-block">
{{#icon}}{{#pix}} {{key}}, {{component}}, {{alttext}} {{/pix}}{{/icon}}
</div>
<div class="d-inline-block m-l-1">
<div class="container">
<div class="row">
<a href="{{{contexturl}}}">{{contextname}}</a>
</div>
<div class="row text-muted">
{{coursename}}
</div>
</div>
</div>
<div class="d-block text-xs-right hidden-md-up">{{enddate}}</div>
</div>
</div>
</li>
@@ -0,0 +1,34 @@
{{!
This file is part of Moodle - http://moodle.org/
Moodle is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Moodle is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with Moodle. If not, see <http://www.gnu.org/licenses/>.
}}
{{!
@template block_myoverview/event-list
This template renders a list of events for the myoverview block.
}}
<div data-region="event-list-container">
<h5>{{$title}}{{/title}}</h5>
<ul class="list-group event-list"
data-region="event-list"
data-start-day="{{$startday}}0{{/startday}}"
data-end-day="{{$endday}}7{{/endday}}"
data-limit="{{$limit}}10{{/limit}}"
data-offset="{{$offset}}0{{/offset}}">
{{> block_myoverview/event-list-items }}
</ul>
{{> core/loading }}
</div>
+47
View File
@@ -0,0 +1,47 @@
{{!
This file is part of Moodle - http://moodle.org/
Moodle is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Moodle is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with Moodle. If not, see <http://www.gnu.org/licenses/>.
}}
{{!
@template block_myoverview/main
This template renders the main content area for the myoverview block.
}}
<div id="block-myoverview-{{uniqid}}" class="block-myoverview container-fluid" data-region="myoverview">
<div class="row">
<ul class="nav nav-tabs" role="tablist">
<li class="nav-item">
<a class="nav-link active" href="#myoverview_timeline_view" role="tab" data-toggle="tab">
{{#str}} timeline, block_myoverview {{/str}}
</a>
</li>
<li class="nav-item">
<a class="nav-link" href="#myoverview_courses_view" role="tab" data-toggle="tab">
{{#str}} courses {{/str}}
</a>
</li>
</ul>
</div>
<div class="tab-content">
<div role="tabpanel" class="tab-pane fade in active" id="myoverview_timeline_view">
{{> block_myoverview/timeline-view }}
</div>
<div role="tabpanel" class="tab-pane fade" id="myoverview_courses_view">
{{> block_myoverview/courses-view }}
</div>
</div>
</div>
@@ -0,0 +1,46 @@
{{!
This file is part of Moodle - http://moodle.org/
Moodle is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Moodle is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with Moodle. If not, see <http://www.gnu.org/licenses/>.
}}
{{!
@template block_myoverview/timeline-view-dates
This template renders the timeline view by dates for the myoverview block.
}}
<div id="timeline-view-dates-{{uniqid}}" data-region="timeline-view-dates">
<div data-region="view-dates">
<div data-region="next-7-days">
{{< block_myoverview/event-list }}
{{$startday}}0{{/startday}}
{{$endday}}7{{/endday}}
{{$limit}}10{{/limit}}
{{$offset}}0{{/offset}}
{{$title}}{{#str}} next7days, block_myoverview {{/str}}{{/title}}
{{/ block_myoverview/event-list }}
</div>
<div class="m-t-2" data-region="next-30-days">
{{< block_myoverview/event-list }}
{{$startday}}8{{/startday}}
{{$endday}}30{{/endday}}
{{$limit}}10{{/limit}}
{{$offset}}0{{/offset}}
{{$title}}{{#str}} next30days, block_myoverview {{/str}}{{/title}}
{{/ block_myoverview/event-list }}
</div>
<div class="text-xs-center m-y-2">
<button type="button" class="btn btn-secondary" data-action="view-more">{{#str}} viewmore {{/str}}</button>
</div>
</div>
</div>
@@ -0,0 +1,50 @@
{{!
This file is part of Moodle - http://moodle.org/
Moodle is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Moodle is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with Moodle. If not, see <http://www.gnu.org/licenses/>.
}}
{{!
@template block_myoverview/timeline-view
This template renders the timeline view for the myoverview block.
}}
<div id="timeline-view-{{uniqid}}" data-region="timeline-view">
<div class="row text-xs-center">
<div class="btn-group m-y-2" role="group" data-toggle="btns">
<a class="btn btn-default active" href="#myoverview_timeline_dates" data-toggle="tab">
{{#str}} sortbydates, block_myoverview {{/str}}
</a>
<a class="btn btn-default" href="#myoverview_timeline_courses" data-toggle="tab">
{{#str}} sortbycourses, block_myoverview {{/str}}
</a>
</div>
</div>
<div class="tab-content">
<div class="tab-pane active fade in" id="myoverview_timeline_dates">
{{> block_myoverview/timeline-view-dates }}
</div>
<div class="tab-pane fade" id="myoverview_timeline_courses">
</div>
</div>
</div>
{{#js}}
require(['jquery', 'core/custom_interaction_events'], function($, customEvents) {
var root = $('#timeline-view-{{uniqid}}');
customEvents.define(root, [customEvents.events.activate]);
root.on(customEvents.events.activate, '[data-toggle="btns"] > .btn', function() {
root.find('.btn.active').removeClass('active');
});
});
{{/js}}