From 44eb44e41500205a7adc96e671aa0434cc2d3a4c Mon Sep 17 00:00:00 2001 From: Ryan Wyllie Date: Mon, 27 Aug 2018 16:41:27 +0800 Subject: [PATCH] MDL-63044 block_myoverview: remove timeline view --- .../build/calendar_events_repository.min.js | 1 - blocks/myoverview/amd/build/event_list.min.js | 1 - .../amd/build/event_list_by_course.min.js | 1 - .../amd/src/calendar_events_repository.js | 168 ------- blocks/myoverview/amd/src/event_list.js | 416 ------------------ .../amd/src/event_list_by_course.js | 108 ----- blocks/myoverview/classes/output/main.php | 3 - .../myoverview/lang/en/block_myoverview.php | 7 - blocks/myoverview/lib.php | 52 --- blocks/myoverview/pix/activities.svg | 41 -- .../templates/course-event-list-item.mustache | 69 --- .../course-event-list-items.mustache | 63 --- .../templates/course-event-list.mustache | 110 ----- .../myoverview/templates/course-item.mustache | 44 -- .../templates/course-summary.mustache | 49 --- ...-view-nav-grouping-display-filter.mustache | 40 ++ .../templates/courses-view.mustache | 19 - .../templates/event-list-group.mustache | 75 ---- .../templates/event-list-item.mustache | 76 ---- .../templates/event-list-items.mustache | 68 --- .../myoverview/templates/event-list.mustache | 87 ---- blocks/myoverview/templates/main.mustache | 30 +- .../templates/timeline-view-courses.mustache | 121 ----- .../templates/timeline-view-dates.mustache | 35 -- .../templates/timeline-view.mustache | 49 --- .../behat/block_myoverview_dashboard.feature | 42 +- .../behat/block_myoverview_progress.feature | 22 - theme/boost/scss/moodle/blocks.scss | 28 -- theme/boost/style/moodle.css | 19 - theme/bootstrapbase/less/moodle/blocks.less | 32 -- theme/bootstrapbase/style/moodle.css | 26 -- .../course-event-list-item.mustache | 95 ---- .../course-event-list.mustache | 110 ----- .../block_myoverview/course-item.mustache | 44 -- .../block_myoverview/course-summary.mustache | 51 --- ...-view-nav-grouping-display-filter.mustache | 41 ++ .../block_myoverview/courses-view.mustache | 13 - .../event-list-group.mustache | 75 ---- .../block_myoverview/event-list-item.mustache | 104 ----- .../templates/block_myoverview/main.mustache | 37 +- .../block_myoverview/timeline-view.mustache | 55 --- 41 files changed, 108 insertions(+), 2419 deletions(-) delete mode 100644 blocks/myoverview/amd/build/calendar_events_repository.min.js delete mode 100644 blocks/myoverview/amd/build/event_list.min.js delete mode 100644 blocks/myoverview/amd/build/event_list_by_course.min.js delete mode 100644 blocks/myoverview/amd/src/calendar_events_repository.js delete mode 100644 blocks/myoverview/amd/src/event_list.js delete mode 100644 blocks/myoverview/amd/src/event_list_by_course.js delete mode 100644 blocks/myoverview/lib.php delete mode 100644 blocks/myoverview/pix/activities.svg delete mode 100644 blocks/myoverview/templates/course-event-list-item.mustache delete mode 100644 blocks/myoverview/templates/course-event-list-items.mustache delete mode 100644 blocks/myoverview/templates/course-event-list.mustache delete mode 100644 blocks/myoverview/templates/course-item.mustache delete mode 100644 blocks/myoverview/templates/course-summary.mustache create mode 100644 blocks/myoverview/templates/courses-view-nav-grouping-display-filter.mustache delete mode 100644 blocks/myoverview/templates/event-list-group.mustache delete mode 100644 blocks/myoverview/templates/event-list-item.mustache delete mode 100644 blocks/myoverview/templates/event-list-items.mustache delete mode 100644 blocks/myoverview/templates/event-list.mustache delete mode 100644 blocks/myoverview/templates/timeline-view-courses.mustache delete mode 100644 blocks/myoverview/templates/timeline-view-dates.mustache delete mode 100644 blocks/myoverview/templates/timeline-view.mustache delete mode 100644 theme/bootstrapbase/templates/block_myoverview/course-event-list-item.mustache delete mode 100644 theme/bootstrapbase/templates/block_myoverview/course-event-list.mustache delete mode 100644 theme/bootstrapbase/templates/block_myoverview/course-item.mustache delete mode 100644 theme/bootstrapbase/templates/block_myoverview/course-summary.mustache create mode 100644 theme/bootstrapbase/templates/block_myoverview/courses-view-nav-grouping-display-filter.mustache delete mode 100644 theme/bootstrapbase/templates/block_myoverview/event-list-group.mustache delete mode 100644 theme/bootstrapbase/templates/block_myoverview/event-list-item.mustache delete mode 100644 theme/bootstrapbase/templates/block_myoverview/timeline-view.mustache diff --git a/blocks/myoverview/amd/build/calendar_events_repository.min.js b/blocks/myoverview/amd/build/calendar_events_repository.min.js deleted file mode 100644 index 5c6e35a1419..00000000000 --- a/blocks/myoverview/amd/build/calendar_events_repository.min.js +++ /dev/null @@ -1 +0,0 @@ -define(["jquery","core/ajax","core/notification"],function(a,b,c){var d=20,e=function(a){a.hasOwnProperty("limit")||(a.limit=d),a.limitnum=a.limit,delete a.limit,a.hasOwnProperty("starttime")&&(a.timesortfrom=a.starttime,delete a.starttime),a.hasOwnProperty("endtime")&&(a.timesortto=a.endtime,delete a.endtime);var e={methodname:"core_calendar_get_action_events_by_course",args:a},f=b.call([e])[0];return f.fail(c.exception),f},f=function(a){a.hasOwnProperty("limit")||(a.limit=10),a.limitnum=a.limit,delete a.limit,a.hasOwnProperty("starttime")&&(a.timesortfrom=a.starttime,delete a.starttime),a.hasOwnProperty("endtime")&&(a.timesortto=a.endtime,delete a.endtime);var d={methodname:"core_calendar_get_action_events_by_courses",args:a},e=b.call([d])[0];return e.fail(c.exception),e},g=function(a){a.hasOwnProperty("limit")||(a.limit=d),a.limitnum=a.limit,delete a.limit,a.hasOwnProperty("starttime")&&(a.timesortfrom=a.starttime,delete a.starttime),a.hasOwnProperty("endtime")&&(a.timesortto=a.endtime,delete a.endtime);var e={methodname:"core_calendar_get_action_events_by_timesort",args:a},f=b.call([e])[0];return f.fail(c.exception),f};return{queryByTime:g,queryByCourse:e,queryByCourses:f}}); \ No newline at end of file diff --git a/blocks/myoverview/amd/build/event_list.min.js b/blocks/myoverview/amd/build/event_list.min.js deleted file mode 100644 index 343b46ee841..00000000000 --- a/blocks/myoverview/amd/build/event_list.min.js +++ /dev/null @@ -1 +0,0 @@ -define(["jquery","core/notification","core/templates","core/custom_interaction_events","block_myoverview/calendar_events_repository"],function(a,b,c,d,e){var f=86400,g={EMPTY_MESSAGE:'[data-region="empty-message"]',ROOT:'[data-region="event-list-container"]',EVENT_LIST:'[data-region="event-list"]',EVENT_LIST_CONTENT:'[data-region="event-list-content"]',EVENT_LIST_GROUP_CONTAINER:'[data-region="event-list-group-container"]',LOADING_ICON_CONTAINER:'[data-region="loading-icon-container"]',VIEW_MORE_BUTTON:'[data-action="view-more"]'},h={EVENT_LIST_ITEMS:"block_myoverview/event-list-items",COURSE_EVENT_LIST_ITEMS:"block_myoverview/course-event-list-items"},i=function(a){a.attr("data-loaded-all",!0)},j=function(a){return!!a.attr("data-loaded-all")},k=function(a){var b=a.find(g.LOADING_ICON_CONTAINER),c=a.find(g.VIEW_MORE_BUTTON);a.addClass("loading"),b.removeClass("hidden"),c.prop("disabled",!0)},l=function(a){var b=a.find(g.LOADING_ICON_CONTAINER),c=a.find(g.VIEW_MORE_BUTTON);a.removeClass("loading"),b.addClass("hidden"),j(a)?c.addClass("hidden"):c.prop("disabled",!1)},m=function(a){return a.hasClass("loading")},n=function(a){a.attr("data-has-events",!0)},o=function(a){return!!a.attr("data-has-events")},p=function(a,b){b?n(a):o(a)||q(a)},q=function(a){a.find(g.EVENT_LIST_CONTENT).addClass("hidden"),a.find(g.EMPTY_MESSAGE).removeClass("hidden")},r=function(a,b,d){return a.removeClass("hidden"),c.render(d,{events:b}).done(function(b,d){c.appendNodeContents(a.find(g.EVENT_LIST),b,d)})},s=function(a,b){var c=b.timesort||0;return c-a},t=function(a,b,c){var d=a.attr("data-midnight"),e=+c.attr("data-start-day")*f,g=+c.attr("data-end-day")*f,h=s(d,b);return""===c.attr("data-end-day")?e<=h:e<=h&&h. - -/** - * A javascript module to retrieve calendar events from the server. - * - * @module block_myoverview/calendar_events_repository - * @class repository - * @package block_myoverview - * @copyright 2016 Ryan Wyllie - * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later - */ -define(['jquery', 'core/ajax', 'core/notification'], function($, Ajax, Notification) { - - var DEFAULT_LIMIT = 20; - - /** - * Retrieve a list of calendar events for the logged in user for the - * given course. - * - * Valid args are: - * int courseid Only get events for this course - * int starttime Only get events after this time - * int endtime Only get events before this time - * int limit Limit the number of results returned - * int aftereventid Offset the result set from the given id - * - * @method queryByCourse - * @param {object} args The request arguments - * @return {promise} Resolved with an array of the calendar events - */ - var queryByCourse = function(args) { - if (!args.hasOwnProperty('limit')) { - args.limit = DEFAULT_LIMIT; - } - - args.limitnum = args.limit; - delete args.limit; - - if (args.hasOwnProperty('starttime')) { - args.timesortfrom = args.starttime; - delete args.starttime; - } - - if (args.hasOwnProperty('endtime')) { - args.timesortto = args.endtime; - delete args.endtime; - } - - var request = { - methodname: 'core_calendar_get_action_events_by_course', - args: args - }; - - var promise = Ajax.call([request])[0]; - - promise.fail(Notification.exception); - - return promise; - }; - - /** - * Retrieve a list of calendar events for the given courses for the - * logged in user. - * - * Valid args are: - * array courseids Get events for these courses - * int starttime Only get events after this time - * int endtime Only get events before this time - * int limit Limit the number of results returned - * - * @method queryByCourses - * @param {object} args The request arguments - * @return {promise} Resolved with an array of the calendar events - */ - var queryByCourses = function(args) { - if (!args.hasOwnProperty('limit')) { - // This is intentionally smaller than the default limit. - args.limit = 10; - } - - args.limitnum = args.limit; - delete args.limit; - - if (args.hasOwnProperty('starttime')) { - args.timesortfrom = args.starttime; - delete args.starttime; - } - - if (args.hasOwnProperty('endtime')) { - args.timesortto = args.endtime; - delete args.endtime; - } - - var request = { - methodname: 'core_calendar_get_action_events_by_courses', - args: args - }; - - var promise = Ajax.call([request])[0]; - - promise.fail(Notification.exception); - - return promise; - }; - - /** - * Retrieve a list of calendar events for the logged in user after the given - * time. - * - * Valid args are: - * int starttime Only get events after this time - * int endtime Only get events before this time - * int limit Limit the number of results returned - * int aftereventid Offset the result set from the given id - * - * @method queryByTime - * @param {object} args The request arguments - * @return {promise} Resolved with an array of the calendar events - */ - var queryByTime = function(args) { - if (!args.hasOwnProperty('limit')) { - args.limit = DEFAULT_LIMIT; - } - - args.limitnum = args.limit; - delete args.limit; - - if (args.hasOwnProperty('starttime')) { - args.timesortfrom = args.starttime; - delete args.starttime; - } - - if (args.hasOwnProperty('endtime')) { - args.timesortto = args.endtime; - delete args.endtime; - } - - var request = { - methodname: 'core_calendar_get_action_events_by_timesort', - args: args - }; - - var promise = Ajax.call([request])[0]; - - promise.fail(Notification.exception); - - return promise; - }; - - return { - queryByTime: queryByTime, - queryByCourse: queryByCourse, - queryByCourses: queryByCourses, - }; -}); diff --git a/blocks/myoverview/amd/src/event_list.js b/blocks/myoverview/amd/src/event_list.js deleted file mode 100644 index 8a1bd910b61..00000000000 --- a/blocks/myoverview/amd/src/event_list.js +++ /dev/null @@ -1,416 +0,0 @@ -// 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 . - -/** - * Javascript to load and render the list of calendar events for a - * given day range. - * - * @module block_myoverview/event_list - * @package block_myoverview - * @copyright 2016 Ryan Wyllie - * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later - */ -define(['jquery', 'core/notification', 'core/templates', - 'core/custom_interaction_events', - 'block_myoverview/calendar_events_repository'], - function($, Notification, Templates, CustomEvents, CalendarEventsRepository) { - - var SECONDS_IN_DAY = 60 * 60 * 24; - - var SELECTORS = { - EMPTY_MESSAGE: '[data-region="empty-message"]', - ROOT: '[data-region="event-list-container"]', - EVENT_LIST: '[data-region="event-list"]', - EVENT_LIST_CONTENT: '[data-region="event-list-content"]', - EVENT_LIST_GROUP_CONTAINER: '[data-region="event-list-group-container"]', - LOADING_ICON_CONTAINER: '[data-region="loading-icon-container"]', - VIEW_MORE_BUTTON: '[data-action="view-more"]' - }; - - var TEMPLATES = { - EVENT_LIST_ITEMS: 'block_myoverview/event-list-items', - COURSE_EVENT_LIST_ITEMS: 'block_myoverview/course-event-list-items' - }; - - /** - * Set a flag on the element to indicate that it has completed - * loading all event data. - * - * @method setLoadedAll - * @private - * @param {object} root The container element - */ - var setLoadedAll = function(root) { - root.attr('data-loaded-all', true); - }; - - /** - * Check if all event data has finished loading. - * - * @method hasLoadedAll - * @private - * @param {object} root The container element - * @return {bool} if the element has completed all loading - */ - var hasLoadedAll = function(root) { - return !!root.attr('data-loaded-all'); - }; - - /** - * Set the element state to loading. - * - * @method startLoading - * @private - * @param {object} root The container element - */ - var startLoading = function(root) { - var loadingIcon = root.find(SELECTORS.LOADING_ICON_CONTAINER), - viewMoreButton = root.find(SELECTORS.VIEW_MORE_BUTTON); - - root.addClass('loading'); - loadingIcon.removeClass('hidden'); - viewMoreButton.prop('disabled', true); - }; - - /** - * Remove the loading state from the element. - * - * @method stopLoading - * @private - * @param {object} root The container element - */ - var stopLoading = function(root) { - var loadingIcon = root.find(SELECTORS.LOADING_ICON_CONTAINER), - viewMoreButton = root.find(SELECTORS.VIEW_MORE_BUTTON); - - root.removeClass('loading'); - loadingIcon.addClass('hidden'); - - if (!hasLoadedAll(root)) { - // Only enable the button if we've got more events to load. - viewMoreButton.prop('disabled', false); - } else { - viewMoreButton.addClass('hidden'); - } - }; - - /** - * Check if the element is currently loading some event data. - * - * @method isLoading - * @private - * @param {object} root The container element - * @returns {Boolean} - */ - var isLoading = function(root) { - return root.hasClass('loading'); - }; - - /** - * Flag the root element to remember that it contains events. - * - * @method setHasContent - * @private - * @param {object} root The container element - */ - var setHasContent = function(root) { - root.attr('data-has-events', true); - }; - - /** - * Check if the root element has had events loaded. - * - * @method hasContent - * @private - * @param {object} root The container element - * @return {bool} - */ - var hasContent = function(root) { - return root.attr('data-has-events') ? true : false; - }; - - /** - * Update the visibility of the content area. The content area - * is hidden if we have no events. - * - * @method updateContentVisibility - * @private - * @param {object} root The container element - * @param {int} eventCount A count of the events we just received. - */ - var updateContentVisibility = function(root, eventCount) { - if (eventCount) { - // We've rendered some events, let's remember that. - setHasContent(root); - } else { - // If this is the first time trying to load events and - // we don't have any then there isn't any so let's show - // the empty message. - if (!hasContent(root)) { - hideContent(root); - } - } - }; - - /** - * Hide the content area and display the empty content message. - * - * @method hideContent - * @private - * @param {object} root The container element - */ - var hideContent = function(root) { - root.find(SELECTORS.EVENT_LIST_CONTENT).addClass('hidden'); - root.find(SELECTORS.EMPTY_MESSAGE).removeClass('hidden'); - }; - - /** - * Render a group of calendar events and add them to the event - * list. - * - * @method renderGroup - * @private - * @param {object} group The group container element - * @param {array} calendarEvents The list of calendar events - * @param {string} templateName The template name - * @return {promise} Resolved when the elements are attached to the DOM - */ - var renderGroup = function(group, calendarEvents, templateName) { - - group.removeClass('hidden'); - - return Templates.render( - templateName, - {events: calendarEvents} - ).done(function(html, js) { - Templates.appendNodeContents(group.find(SELECTORS.EVENT_LIST), html, js); - }); - }; - - /** - * Determine the time (in seconds) from the given timestamp until the calendar - * event will need actioning. - * - * @method timeUntilEvent - * @private - * @param {int} timestamp The time to compare with - * @param {object} event The calendar event - * @return {int} - */ - var timeUntilEvent = function(timestamp, event) { - var orderTime = event.timesort || 0; - return orderTime - timestamp; - }; - - /** - * Check if the given calendar event should be added to the given event - * list group container. The event list group container will specify a - * day range for the time boundary it is interested in. - * - * If only a start day is specified for the container then it will be treated - * as an open catchment for all events that begin after that time. - * - * @method eventBelongsInContainer - * @private - * @param {object} root The root element - * @param {object} event The calendar event - * @param {object} container The group event list container - * @return {bool} - */ - var eventBelongsInContainer = function(root, event, container) { - var todayTime = root.attr('data-midnight'), - timeUntilContainerStart = +container.attr('data-start-day') * SECONDS_IN_DAY, - timeUntilContainerEnd = +container.attr('data-end-day') * SECONDS_IN_DAY, - timeUntilEventNeedsAction = timeUntilEvent(todayTime, event); - - if (container.attr('data-end-day') === '') { - return timeUntilContainerStart <= timeUntilEventNeedsAction; - } else { - return timeUntilContainerStart <= timeUntilEventNeedsAction && - timeUntilEventNeedsAction < timeUntilContainerEnd; - } - }; - - /** - * Return a function that can be used to filter a list of events based on the day - * range specified on the given event list group container. - * - * @method getFilterCallbackForContainer - * @private - * @param {object} root The root element - * @param {object} container Event list group container - * @return {function} - */ - var getFilterCallbackForContainer = function(root, container) { - return function(event) { - return eventBelongsInContainer(root, event, $(container)); - }; - }; - - /** - * Render the given calendar events in the container element. The container - * elements must have a day range defined using data attributes that will be - * used to group the calendar events according to their order time. - * - * @method render - * @private - * @param {object} root The container element - * @param {array} calendarEvents A list of calendar events - * @return {promise} Resolved with a count of the number of rendered events - */ - var render = function(root, calendarEvents) { - var renderCount = 0; - var templateName = TEMPLATES.EVENT_LIST_ITEMS; - - if (root.attr('data-course-id')) { - templateName = TEMPLATES.COURSE_EVENT_LIST_ITEMS; - } - - // Loop over each of the element list groups and find the set of calendar events - // that belong to that group (as defined by the group's day range). The matching - // list of calendar events are rendered and added to the DOM within that group. - return $.when.apply($, $.map(root.find(SELECTORS.EVENT_LIST_GROUP_CONTAINER), function(container) { - var events = calendarEvents.filter(getFilterCallbackForContainer(root, container)); - - if (events.length) { - renderCount += events.length; - return renderGroup($(container), events, templateName); - } else { - return null; - } - })).then(function() { - return renderCount; - }); - }; - - /** - * Retrieve a list of calendar events, render and append them to the end of the - * existing list. The events will be loaded based on the set of data attributes - * on the root element. - * - * This function can be provided with a jQuery promise. If it is then it won't - * attempt to load data by itself, instead it will use the given promise. - * - * The provided promise must resolve with an an object that has an events key - * and value is an array of calendar events. - * E.g. - * { events: ['event 1', 'event 2'] } - * - * @method load - * @param {object} root The root element of the event list - * @param {object} promise A jQuery promise resolved with events - * @return {promise} A jquery promise - */ - var load = function(root, promise) { - root = $(root); - var limit = +root.attr('data-limit'), - courseId = +root.attr('data-course-id'), - lastId = root.attr('data-last-id'), - midnight = root.attr('data-midnight'), - startTime = midnight - (14 * SECONDS_IN_DAY); - - // Don't load twice. - if (isLoading(root)) { - return $.Deferred().resolve(); - } - - startLoading(root); - - // If we haven't been provided a promise to resolve the - // data then we will load our own. - if (typeof promise == 'undefined') { - var args = { - starttime: startTime, - limit: limit, - }; - - if (lastId) { - args.aftereventid = lastId; - } - - // If we have a course id then we only want events from that course. - if (courseId) { - args.courseid = courseId; - promise = CalendarEventsRepository.queryByCourse(args); - } else { - // Otherwise we want events from any course. - promise = CalendarEventsRepository.queryByTime(args); - } - } - - // Request data from the server. - return promise.then(function(result) { - if (!result.events.length) { - // No events, nothing to do. - setLoadedAll(root); - return 0; - } - - var calendarEvents = result.events; - - // Remember the last id we've seen. - root.attr('data-last-id', calendarEvents[calendarEvents.length - 1].id); - - if (calendarEvents.length < limit) { - // No more events to load, disable loading button. - setLoadedAll(root); - } - - // Render the events. - return render(root, calendarEvents).then(function(renderCount) { - if (renderCount < calendarEvents.length) { - // If the number of events that was rendered is less than - // the number we sent for rendering we can assume that there - // are no groups to add them in. Since the ordering of the - // events is guaranteed it means that any future requests will - // also yield events that can't be rendered, so let's not bother - // sending any more requests. - setLoadedAll(root); - } - return calendarEvents.length; - }); - }).then(function(eventCount) { - return updateContentVisibility(root, eventCount); - }).fail( - Notification.exception - ).always(function() { - stopLoading(root); - }); - }; - - /** - * Register the event listeners for the container element. - * - * @method registerEventListeners - * @param {object} root The root element of the event list - */ - var registerEventListeners = function(root) { - CustomEvents.define(root, [CustomEvents.events.activate]); - root.on(CustomEvents.events.activate, SELECTORS.VIEW_MORE_BUTTON, function() { - load(root); - }); - }; - - return { - init: function(root) { - root = $(root); - load(root); - registerEventListeners(root); - }, - registerEventListeners: registerEventListeners, - load: load, - rootSelector: SELECTORS.ROOT, - }; -}); diff --git a/blocks/myoverview/amd/src/event_list_by_course.js b/blocks/myoverview/amd/src/event_list_by_course.js deleted file mode 100644 index 32d52cc53ea..00000000000 --- a/blocks/myoverview/amd/src/event_list_by_course.js +++ /dev/null @@ -1,108 +0,0 @@ -// 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 . - -/** - * Javascript to load and render the list of calendar events grouping by course. - * - * @module block_myoverview/events_by_course_list - * @package block_myoverview - * @copyright 2016 Simey Lameze - * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later - */ -define( -[ - 'jquery', - 'block_myoverview/event_list', - 'block_myoverview/calendar_events_repository' -], -function($, EventList, EventsRepository) { - - var SECONDS_IN_DAY = 60 * 60 * 24; - - var SELECTORS = { - EVENTS_BY_COURSE_CONTAINER: '[data-region="course-events-container"]', - EVENT_LIST_CONTAINER: '[data-region="event-list-container"]', - }; - - /** - * Loop through course events containers and load calendar events for that course. - * - * @method load - * @param {Object} root The root element of sort by course list. - */ - var load = function(root) { - var courseBlocks = root.find(SELECTORS.EVENTS_BY_COURSE_CONTAINER); - - if (!courseBlocks.length) { - return; - } - - var eventList = courseBlocks.find(SELECTORS.EVENT_LIST_CONTAINER).first(); - var midnight = eventList.attr('data-midnight'); - var startTime = midnight - (14 * SECONDS_IN_DAY); - var limit = eventList.attr('data-limit'); - var courseIds = courseBlocks.map(function() { - return $(this).attr('data-course-id'); - }).get(); - - // Load the first set of events for each course in a single request. - // We want to avoid sending an individual request for each course because - // there could be lots of them. - var coursesPromise = EventsRepository.queryByCourses({ - courseids: courseIds, - starttime: startTime, - limit: limit - }); - - // Load the events into each course block. - courseBlocks.each(function(index, container) { - container = $(container); - var courseId = container.attr('data-course-id'); - var eventListContainer = container.find(EventList.rootSelector); - var promise = $.Deferred(); - - // Once all of the course events have been loaded then we need - // to extract just the ones relevant to this course block and - // hand them to the event list to render. - coursesPromise.done(function(result) { - var events = []; - // Get this course block's events from the collection returned - // from the server. - var courseGroup = result.groupedbycourse.filter(function(group) { - return group.courseid == courseId; - }); - - if (courseGroup.length) { - events = courseGroup[0].events; - } - - promise.resolve({events: events}); - }).fail(function(e) { - promise.reject(e); - }); - - // Provide the event list with a promise that will be resolved - // when we have received the events from the server. - EventList.load(eventListContainer, promise); - }); - }; - - return { - init: function(root) { - root = $(root); - load(root); - } - }; -}); diff --git a/blocks/myoverview/classes/output/main.php b/blocks/myoverview/classes/output/main.php index 51d6b903af3..46834f318b3 100644 --- a/blocks/myoverview/classes/output/main.php +++ b/blocks/myoverview/classes/output/main.php @@ -29,7 +29,6 @@ use renderer_base; use templatable; use core_completion\progress; -require_once($CFG->dirroot . '/blocks/myoverview/lib.php'); require_once($CFG->libdir . '/completionlib.php'); /** @@ -71,14 +70,12 @@ class main implements renderable, templatable { $coursesview = new courses_view($courses, $coursesprogress); $nocoursesurl = $output->image_url('courses', 'block_myoverview')->out(); - $noeventsurl = $output->image_url('activities', 'block_myoverview')->out(); return [ 'midnight' => usergetmidnight(time()), 'coursesview' => $coursesview->export_for_template($output), 'urls' => [ 'nocourses' => $nocoursesurl, - 'noevents' => $noeventsurl ], ]; } diff --git a/blocks/myoverview/lang/en/block_myoverview.php b/blocks/myoverview/lang/en/block_myoverview.php index f6a1e65eaeb..df3ae6652b4 100644 --- a/blocks/myoverview/lang/en/block_myoverview.php +++ b/blocks/myoverview/lang/en/block_myoverview.php @@ -31,15 +31,8 @@ $string['nocourses'] = 'No courses'; $string['nocoursesinprogress'] = 'No in progress courses'; $string['nocoursesfuture'] = 'No future courses'; $string['nocoursespast'] = 'No past courses'; -$string['noevents'] = 'No upcoming activities due'; -$string['next30days'] = 'Next 30 days'; -$string['next7days'] = 'Next 7 days'; $string['past'] = 'Past'; $string['pluginname'] = 'Course overview'; -$string['recentlyoverdue'] = 'Recently overdue'; -$string['sortbycourses'] = 'Sort by courses'; -$string['sortbydates'] = 'Sort by dates'; -$string['timeline'] = 'Timeline'; $string['viewcourse'] = 'View course'; $string['viewcoursename'] = 'View course {$a}'; $string['privacy:metadata'] = 'The myoverview block does not store any personal data.'; diff --git a/blocks/myoverview/lib.php b/blocks/myoverview/lib.php deleted file mode 100644 index a73db2566ac..00000000000 --- a/blocks/myoverview/lib.php +++ /dev/null @@ -1,52 +0,0 @@ -. - -/** - * Contains functions called by core. - * - * @package block_myoverview - * @copyright 2017 Mark Nelson - * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later - */ - -defined('MOODLE_INTERNAL') || die(); - -/** - * The timeline view. - */ -define('BLOCK_MYOVERVIEW_TIMELINE_VIEW', 'timeline'); - -/** - * The courses view. - */ -define('BLOCK_MYOVERVIEW_COURSES_VIEW', 'courses'); - -/** - * Returns the name of the user preferences as well as the details this plugin uses. - * - * @return array - */ -function block_myoverview_user_preferences() { - $preferences = array(); - $preferences['block_myoverview_last_tab'] = array( - 'type' => PARAM_ALPHA, - 'null' => NULL_NOT_ALLOWED, - 'default' => BLOCK_MYOVERVIEW_TIMELINE_VIEW, - 'choices' => array(BLOCK_MYOVERVIEW_TIMELINE_VIEW, BLOCK_MYOVERVIEW_COURSES_VIEW) - ); - - return $preferences; -} diff --git a/blocks/myoverview/pix/activities.svg b/blocks/myoverview/pix/activities.svg deleted file mode 100644 index ed7546ade4d..00000000000 --- a/blocks/myoverview/pix/activities.svg +++ /dev/null @@ -1,41 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/blocks/myoverview/templates/course-event-list-item.mustache b/blocks/myoverview/templates/course-event-list-item.mustache deleted file mode 100644 index 55c0e46c883..00000000000 --- a/blocks/myoverview/templates/course-event-list-item.mustache +++ /dev/null @@ -1,69 +0,0 @@ -{{! - 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 . -}} -{{! - @template block_myoverview/course-event-list-item - - This template renders an event list item for the myoverview block - in the courses view. - - Example context (json): - { - "name": "Assignment due 1", - "url": "https://www.google.com", - "timesort": 1490320388, - "action": { - "name": "Submit assignment", - "url": "https://www.google.com", - "itemcount": 1, - "showitemcount": true, - "actionable": true - }, - "icon": { - "key": "icon", - "component": "mod_assign", - "alttext": "Assignment icon" - } - } -}} -
  • -
    -
    -
    - {{#icon}}{{#pix}} {{key}}, {{component}}, {{alttext}} {{/pix}}{{/icon}} -
    -
    - {{{name}}} -

    - {{#userdate}} {{timesort}}, {{#str}} strftimerecent {{/str}} {{/userdate}} -

    -
    -
    -
    - {{#action.actionable}} - {{action.name}} - {{#action.itemcount}} - {{#action.showitemcount}} - {{.}} - {{/action.showitemcount}} - {{/action.itemcount}} - {{/action.actionable}} - {{^action.actionable}} -
    {{action.name}}
    - {{/action.actionable}} -
    -
    -
  • diff --git a/blocks/myoverview/templates/course-event-list-items.mustache b/blocks/myoverview/templates/course-event-list-items.mustache deleted file mode 100644 index 10a1c435dc0..00000000000 --- a/blocks/myoverview/templates/course-event-list-items.mustache +++ /dev/null @@ -1,63 +0,0 @@ -{{! - 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 . -}} -{{! - @template block_myoverview/course-event-list-items - - This template renders a group of event list items for the myoverview block - sort by courses view. - - Example context (json): - { - "events": [ - { - "name": "Assignment due 1", - "url": "https://www.google.com", - "timesort": 1490320388, - "action": { - "name": "Submit assignment", - "url": "https://www.google.com", - "itemcount": 1, - "actionable": true - }, - "icon": { - "key": "icon", - "component": "mod_assign", - "alttext": "Assignment icon" - } - }, - { - "name": "Assignment due 2", - "url": "https://www.google.com", - "timesort": 1490320388, - "action": { - "name": "Submit assignment", - "url": "https://www.google.com", - "itemcount": 1, - "actionable": true - }, - "icon": { - "key": "icon", - "component": "mod_assign", - "alttext": "Assignment icon" - } - } - ] - } -}} -{{#events}} - {{> block_myoverview/course-event-list-item }} -{{/events}} diff --git a/blocks/myoverview/templates/course-event-list.mustache b/blocks/myoverview/templates/course-event-list.mustache deleted file mode 100644 index d7f9fb283c7..00000000000 --- a/blocks/myoverview/templates/course-event-list.mustache +++ /dev/null @@ -1,110 +0,0 @@ -{{! - 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 . -}} -{{! - @template block_myoverview/course-event-list - - This template renders a list of events for the myoverview block - sort by courses view. - - Example context (json): - { - "urls": { - "noevents": "#" - } - } -}} -
    - -
    - {{< block_myoverview/event-list-group }} - {{$title}}{{#str}} recentlyoverdue, block_myoverview {{/str}}{{/title}} - {{$extratitleclasses}}text-danger{{/extratitleclasses}} - {{$startday}}-14{{/startday}} - {{$endday}}0{{/endday}} - {{$eventlistitems}} - {{> block_myoverview/course-event-list-items }} - {{/eventlistitems}} - {{/ block_myoverview/event-list-group }} - {{< block_myoverview/event-list-group }} - {{$title}}{{#str}} today {{/str}}{{/title}} - {{$extratitleclasses}}{{/extratitleclasses}} - {{$startday}}0{{/startday}} - {{$endday}}1{{/endday}} - {{$eventlistitems}} - {{> block_myoverview/course-event-list-items }} - {{/eventlistitems}} - {{/ block_myoverview/event-list-group }} - {{< block_myoverview/event-list-group }} - {{$title}}{{#str}} next7days, block_myoverview {{/str}}{{/title}} - {{$extratitleclasses}}{{/extratitleclasses}} - {{$startday}}1{{/startday}} - {{$endday}}7{{/endday}} - {{$eventlistitems}} - {{> block_myoverview/course-event-list-items }} - {{/eventlistitems}} - {{/ block_myoverview/event-list-group }} - {{< block_myoverview/event-list-group }} - {{$title}}{{#str}} next30days, block_myoverview {{/str}}{{/title}} - {{$extratitleclasses}}{{/extratitleclasses}} - {{$startday}}7{{/startday}} - {{$endday}}30{{/endday}} - {{$eventlistitems}} - {{> block_myoverview/course-event-list-items }} - {{/eventlistitems}} - {{/ block_myoverview/event-list-group }} - {{< block_myoverview/event-list-group }} - {{$title}}{{#str}} future, block_myoverview {{/str}}{{/title}} - {{$extratitleclasses}}{{/extratitleclasses}} - {{$startday}}30{{/startday}} - {{$endday}}{{/endday}} - {{$eventlistitems}} - {{> block_myoverview/course-event-list-items }} - {{/eventlistitems}} - {{/ block_myoverview/event-list-group }} - -
    - -
    -
    - -
    -{{#js}} -require(['jquery', 'block_myoverview/event_list'], function($, EventList) { - var root = $("#event-list-container-{{$courseid}}{{/courseid}}"); - EventList.registerEventListeners(root); -}); -{{/js}} diff --git a/blocks/myoverview/templates/course-item.mustache b/blocks/myoverview/templates/course-item.mustache deleted file mode 100644 index c7ce9d88682..00000000000 --- a/blocks/myoverview/templates/course-item.mustache +++ /dev/null @@ -1,44 +0,0 @@ -{{! - 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 . -}} -{{! - @template block_myoverview/course-item - - This template renders the each course block containing a summary and calendar events. - - Example context (json): - { - "shortname": "course 3", - "viewurl": "https://www.google.com", - "summary": "It is a long established fact that a reader will be distracted by the readable content of a page when looking at its layout." - } -}} -
  • -
    -
    -
    - {{> block_myoverview/course-summary }} -
    -
    - {{< block_myoverview/course-event-list }} - {{$limit}}10{{/limit}} - {{$offset}}0{{/offset}} - {{$courseid}}{{id}}{{/courseid}} - {{/ block_myoverview/course-event-list }} -
    -
    -
    -
  • diff --git a/blocks/myoverview/templates/course-summary.mustache b/blocks/myoverview/templates/course-summary.mustache deleted file mode 100644 index 53f40a018ca..00000000000 --- a/blocks/myoverview/templates/course-summary.mustache +++ /dev/null @@ -1,49 +0,0 @@ -{{! - 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 . -}} -{{! - @template block_myoverview/course-summary - - This template renders the course summary (view by courses) for the myoverview block. - - Example context (json): - { - "fullnamedisplay": "course 3", - "viewurl": "https://www.google.com", - "summary": "It is a long established fact that a reader will be distracted by the readable content of a page when looking at its layout." - } -}} -
    -
    - {{> block_myoverview/progress-chart}} -

    {{{fullnamedisplay}}}

    -
    -
    -
    -
    -
    - {{> block_myoverview/progress-chart}} -
    -
    - -
    -
    -

    - {{#shortentext}} 140, {{{summary}}}{{/shortentext}} -

    -
    diff --git a/blocks/myoverview/templates/courses-view-nav-grouping-display-filter.mustache b/blocks/myoverview/templates/courses-view-nav-grouping-display-filter.mustache new file mode 100644 index 00000000000..f7aa27534b4 --- /dev/null +++ b/blocks/myoverview/templates/courses-view-nav-grouping-display-filter.mustache @@ -0,0 +1,40 @@ +{{! + 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 . +}} +{{! + @template block_myoverview/courses-view-nav-grouping-display-filter + + This template renders the main content area for the myoverview block. + + Example context (json): + {} +}} + diff --git a/blocks/myoverview/templates/courses-view.mustache b/blocks/myoverview/templates/courses-view.mustache index 14ffa493f73..cb5b9261a5f 100644 --- a/blocks/myoverview/templates/courses-view.mustache +++ b/blocks/myoverview/templates/courses-view.mustache @@ -24,25 +24,6 @@ }}
    {{#hascourses}} -
    {{#inprogress}} diff --git a/blocks/myoverview/templates/event-list-group.mustache b/blocks/myoverview/templates/event-list-group.mustache deleted file mode 100644 index 340fdcbb4a6..00000000000 --- a/blocks/myoverview/templates/event-list-group.mustache +++ /dev/null @@ -1,75 +0,0 @@ -{{! - 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 . -}} -{{! - @template block_myoverview/event-list-group - - This template renders a list of events for the myoverview block. - - Example context (json): - { - "events": [ - { - "enddate": "Nov 4th, 10am", - "name": "Assignment due 1", - "url": "https://www.google.com", - "course": { - "fullname": "Course 1" - }, - "action": { - "name": "Submit assignment", - "url": "https://www.google.com", - "itemcount": 1 - }, - "icon": { - "key": "icon", - "component": "mod_assign", - "alttext": "Assignment icon" - } - }, - { - "enddate": "Nov 4th, 10am", - "name": "Assignment due 2", - "url": "https://www.google.com", - "course": { - "fullname": "Course 1" - }, - "action": { - "name": "Submit assignment", - "url": "https://www.google.com", - "itemcount": 1 - }, - "icon": { - "key": "icon", - "component": "mod_assign", - "alttext": "Assignment icon" - } - } - ] - } -}} - diff --git a/blocks/myoverview/templates/event-list-item.mustache b/blocks/myoverview/templates/event-list-item.mustache deleted file mode 100644 index a269b5cb10c..00000000000 --- a/blocks/myoverview/templates/event-list-item.mustache +++ /dev/null @@ -1,76 +0,0 @@ -{{! - 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 . -}} -{{! - @template block_myoverview/event-list-item - - This template renders an event list item for the myoverview block. - - Example context (json): - { - "name": "Assignment due 1", - "url": "https://www.google.com", - "timesort": 1490320388, - "course": { - "fullnamedisplay": "Course 1" - }, - "action": { - "name": "Submit assignment", - "url": "https://www.google.com", - "itemcount": 1, - "showitemcount": true, - "actionable": true - }, - "icon": { - "key": "icon", - "component": "mod_assign", - "alttext": "Assignment icon" - } - } -}} -
  • -
    -
    -
    - {{#icon}}{{#pix}} {{key}}, {{component}}, {{alttext}} {{/pix}}{{/icon}} -
    -
    - {{{name}}} -

    {{{course.fullnamedisplay}}}

    -
    -
    -
    -
    -
    - {{#userdate}} {{timesort}}, {{#str}} strftimerecent {{/str}} {{/userdate}} -
    -
    - {{#action.actionable}} - {{action.name}} - {{#action.itemcount}} - {{#action.showitemcount}} - {{.}} - {{/action.showitemcount}} - {{/action.itemcount}} - {{/action.actionable}} - {{^action.actionable}} -
    {{action.name}}
    - {{/action.actionable}} -
    -
    -
    -
    -
  • diff --git a/blocks/myoverview/templates/event-list-items.mustache b/blocks/myoverview/templates/event-list-items.mustache deleted file mode 100644 index 2dc770bfc5e..00000000000 --- a/blocks/myoverview/templates/event-list-items.mustache +++ /dev/null @@ -1,68 +0,0 @@ -{{! - 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 . -}} -{{! - @template block_myoverview/event-list-items - - This template renders a group of event list items for the myoverview block. - - Example context (json): - { - "events": [ - { - "name": "Assignment due 1", - "url": "https://www.google.com", - "timesort": 1490320388, - "course": { - "fullnamedisplay": "Course 1" - }, - "action": { - "name": "Submit assignment", - "url": "https://www.google.com", - "itemcount": 1, - "actionable": true - }, - "icon": { - "key": "icon", - "component": "mod_assign", - "alttext": "Assignment icon" - } - }, - { - "name": "Assignment due 2", - "url": "https://www.google.com", - "timesort": 1490320388, - "course": { - "fullnamedisplay": "Course 1" - }, - "action": { - "name": "Submit assignment", - "url": "https://www.google.com", - "itemcount": 1, - "actionable": true - }, - "icon": { - "key": "icon", - "component": "mod_assign", - "alttext": "Assignment icon" - } - } - ] - } -}} -{{#events}} - {{> block_myoverview/event-list-item }} -{{/events}} diff --git a/blocks/myoverview/templates/event-list.mustache b/blocks/myoverview/templates/event-list.mustache deleted file mode 100644 index dbe3d25da7b..00000000000 --- a/blocks/myoverview/templates/event-list.mustache +++ /dev/null @@ -1,87 +0,0 @@ -{{! - 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 . -}} -{{! - @template block_myoverview/event-list - - This template renders a list of events for the myoverview block. - - Example context (json): - { - } -}} -
    - -
    - {{< block_myoverview/event-list-group }} - {{$title}}{{#str}} recentlyoverdue, block_myoverview {{/str}}{{/title}} - {{$extratitleclasses}}text-danger{{/extratitleclasses}} - {{$startday}}-14{{/startday}} - {{$endday}}0{{/endday}} - {{/ block_myoverview/event-list-group }} - {{< block_myoverview/event-list-group }} - {{$title}}{{#str}} today {{/str}}{{/title}} - {{$extratitleclasses}}{{/extratitleclasses}} - {{$startday}}0{{/startday}} - {{$endday}}1{{/endday}} - {{/ block_myoverview/event-list-group }} - {{< block_myoverview/event-list-group }} - {{$title}}{{#str}} next7days, block_myoverview {{/str}}{{/title}} - {{$extratitleclasses}}{{/extratitleclasses}} - {{$startday}}1{{/startday}} - {{$endday}}7{{/endday}} - {{/ block_myoverview/event-list-group }} - {{< block_myoverview/event-list-group }} - {{$title}}{{#str}} next30days, block_myoverview {{/str}}{{/title}} - {{$extratitleclasses}}{{/extratitleclasses}} - {{$startday}}7{{/startday}} - {{$endday}}30{{/endday}} - {{/ block_myoverview/event-list-group }} - {{< block_myoverview/event-list-group }} - {{$title}}{{#str}} future, block_myoverview {{/str}}{{/title}} - {{$extratitleclasses}}{{/extratitleclasses}} - {{$startday}}30{{/startday}} - {{$endday}}{{/endday}} - {{/ block_myoverview/event-list-group }} - -
    - -
    -
    - -
    -{{#js}} -require(['jquery', 'block_myoverview/event_list'], function($, EventList) { - var root = $("#event-list-container-{{$courseid}}{{/courseid}}"); - EventList.registerEventListeners(root); -}); -{{/js}} diff --git a/blocks/myoverview/templates/main.mustache b/blocks/myoverview/templates/main.mustache index 8eb3394fe83..fef8e9f3db9 100644 --- a/blocks/myoverview/templates/main.mustache +++ b/blocks/myoverview/templates/main.mustache @@ -24,26 +24,20 @@ }}
    - -
    -
    - {{> block_myoverview/timeline-view }} -
    -
    +
    +
    {{#coursesview}} - {{> block_myoverview/courses-view }} + {{#hascourses}} +
    + {{> block_myoverview/courses-view-nav-grouping-display-filter }} +
    + {{/hascourses}} {{/coursesview}}
    +
    + {{#coursesview}} + {{> block_myoverview/courses-view }} + {{/coursesview}} +
    diff --git a/blocks/myoverview/templates/timeline-view-courses.mustache b/blocks/myoverview/templates/timeline-view-courses.mustache deleted file mode 100644 index 6f350227b8f..00000000000 --- a/blocks/myoverview/templates/timeline-view-courses.mustache +++ /dev/null @@ -1,121 +0,0 @@ -{{! - 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 . -}} -{{! - @template block_myoverview/timeline-view-courses - - This template renders the timeline view by courses for the myoverview block. - - Example context (json): - {} -}} -
    - {{#coursesview}} - {{#inprogress}} - {{#haspages}} - {{#pages}} - - {{/pages}} -
    - -
    - {{/haspages}} - {{^haspages}} -
    - {{#str}} nocoursesinprogress, block_myoverview {{/str}} -

    {{#str}} nocoursesinprogress, block_myoverview {{/str}}

    -
    - {{/haspages}} - {{/inprogress}} - {{^inprogress}} -
    - {{#str}} nocoursesinprogress, block_myoverview {{/str}} -

    {{#str}} nocoursesinprogress, block_myoverview {{/str}}

    -
    - {{/inprogress}} - {{/coursesview}} -
    -{{#js}} - require(['jquery', 'core/custom_interaction_events', 'block_myoverview/event_list_by_course'], - function($, CustomEvents, EventListByCourse) { - - var root = $("#sort-by-courses-view-{{uniqid}}"); - // This flag is used so that we can delay the loading of the events until the tab - // is toggled by the user. - var seen = false; - - CustomEvents.define(root, [CustomEvents.events.activate]); - // Show more courses and load their events when the user clicks the "more courses" - // button. - root.on(CustomEvents.events.activate, '[data-action="more-courses"]', function(e, data) { - var button = $(e.target); - var blocks = root.find('[data-region="course-block"].hidden'); - - if (blocks && blocks.length) { - var block = blocks.first(); - EventListByCourse.init(block); - block.removeClass('hidden'); - } - - // If there was only one hidden block then we have no more to show now - // so we can disable the button. - if (blocks && blocks.length == 1) { - button.addClass('hidden'); - } - - if (data) { - data.originalEvent.preventDefault(); - data.originalEvent.stopPropagation(); - } - e.stopPropagation(); - }); - - // Listen for when the user changes tab so that we can show the first set of courses - // and load their events when they request the sort by courses view for the first time. - root.closest('[data-region="timeline-view"]').on('shown shown.bs.tab', function(e) { - if (seen) { - return; - } - - var tab = $(e.target); - var tabTarget = $(tab.attr('href')); - - if (!tabTarget || !tabTarget.length) { - return; - } - - var viewCourses = tabTarget.find('#sort-by-courses-view-{{uniqid}}'); - - if (viewCourses && viewCourses.length && !seen) { - seen = true; - viewCourses.find('[data-action="more-courses"]').trigger(CustomEvents.events.activate); - } - }); - }); -{{/js}} diff --git a/blocks/myoverview/templates/timeline-view-dates.mustache b/blocks/myoverview/templates/timeline-view-dates.mustache deleted file mode 100644 index 66cb8ea7b27..00000000000 --- a/blocks/myoverview/templates/timeline-view-dates.mustache +++ /dev/null @@ -1,35 +0,0 @@ -{{! - 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 . -}} -{{! - @template block_myoverview/timeline-view-dates - - This template renders the timeline view by dates for the myoverview block. - - Example context (json): - {} -}} -
    - {{< block_myoverview/event-list }} - {{$limit}}20{{/limit}} - {{/ block_myoverview/event-list }} -
    -{{#js}} - require(['jquery', 'block_myoverview/event_list'], function($, EventList) { - var root = $("#timeline-view-dates-{{uniqid}}").find('[data-region="event-list-container"]'); - EventList.load(root); - }); -{{/js}} diff --git a/blocks/myoverview/templates/timeline-view.mustache b/blocks/myoverview/templates/timeline-view.mustache deleted file mode 100644 index 9d57cd26b59..00000000000 --- a/blocks/myoverview/templates/timeline-view.mustache +++ /dev/null @@ -1,49 +0,0 @@ -{{! - 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 . -}} -{{! - @template block_myoverview/timeline-view - - This template renders the timeline view for the myoverview block. - - Example context (json): - {} -}} -
    - - -
    -
    - {{> block_myoverview/timeline-view-dates }} -
    -
    - {{> block_myoverview/timeline-view-courses }} -
    -
    -
    \ No newline at end of file diff --git a/blocks/myoverview/tests/behat/block_myoverview_dashboard.feature b/blocks/myoverview/tests/behat/block_myoverview_dashboard.feature index bf6f356adda..de3735901bb 100644 --- a/blocks/myoverview/tests/behat/block_myoverview_dashboard.feature +++ b/blocks/myoverview/tests/behat/block_myoverview_dashboard.feature @@ -1,5 +1,5 @@ @block @block_myoverview @javascript -Feature: The my overview block allows users to easily access their courses and see upcoming activities +Feature: The my overview block allows users to easily access their courses In order to enable the my overview block in a course As a student I can add the my overview block to my dashboard @@ -14,59 +14,23 @@ Feature: The my overview block allows users to easily access their courses and s | Course 1 | C1 | 0 | ##1 month ago## | ##15 days ago## | | Course 2 | C2 | 0 | ##yesterday## | ##tomorrow## | | Course 3 | C3 | 0 | ##first day of next month## | ##last day of next month## | - And the following "activities" exist: - | activity | course | idnumber | name | intro | timeopen | timeclose | - | choice | C2 | choice1 | Test choice 1 | Test choice description | ##yesterday## | ##tomorrow## | - | choice | C1 | choice2 | Test choice 2 | Test choice description | ##1 month ago## | ##15 days ago## | - | choice | C3 | choice3 | Test choice 3 | Test choice description | ##first day of +5 months## | ##last day of +5 months## | - | feedback | C2 | feedback1 | Test feedback 1 | Test feedback description | ##yesterday## | ##tomorrow## | - | feedback | C3 | feedback3 | Test feedback 3 | Test feedback description | ##first day of +5 months## | ##last day of +5 months## | And the following "course enrolments" exist: | user | course | role | | student1 | C1 | student | | student1 | C2 | student | | student1 | C3 | student | - Scenario: View courses and upcoming activities on timeline view - Given I log in as "student1" - And I click on "Timeline" "link" in the "Course overview" "block" - When I click on "Sort by dates" "link" in the "Course overview" "block" - Then I should see "Next 7 days" in the "Course overview" "block" - And I should see "Test choice 1 closes" in the "Course overview" "block" - And I should see "View choices" in the "Course overview" "block" - And I should see "Test feedback 1 closes" in the "Course overview" "block" - And I should see "Answer the questions" in the "Course overview" "block" - And I should see "Future" in the "Course overview" "block" - And I should see "Test choice 3 closes" in the "Course overview" "block" - And I should see "Test feedback 3 closes" in the "Course overview" "block" - And I log out - - Scenario: Past activities should not be displayed on the timeline view - Given I log in as "student1" - And I click on "Timeline" "link" in the "Course overview" "block" - When I click on "Sort by dates" "link" in the "Course overview" "block" - And I should not see "Test choice 2 closes" in the "Course overview" "block" - And I log out - Scenario: See the courses I am enrolled by their status on courses view Given I log in as "student1" - And I click on "Courses" "link" in the "Course overview" "block" - And I click on "In progress" "link" in the "Course overview" "block" And I should see "Course 2" in the "Course overview" "block" And I should not see "Course 1" in the "Course overview" "block" + And I click on "In progress" "button" in the "Course overview" "block" And I click on "Future" "link" in the "Course overview" "block" And I should see "Course 3" in the "Course overview" "block" And I should not see "Course 1" in the "Course overview" "block" + And I click on "Future" "button" in the "Course overview" "block" When I click on "Past" "link" in the "Course overview" "block" Then I should see "Course 1" in the "Course overview" "block" And I should not see "Course 2" in the "Course overview" "block" And I should not see "Course 3" in the "Course overview" "block" And I log out - - Scenario: No activities should be displayed if the user is not enrolled - Given I log in as "student2" - And I click on "Timeline" "link" in the "Course overview" "block" - And I should see "No upcoming activities" in the "Course overview" "block" - When I click on "Courses" "link" in the "Course overview" "block" - Then I should see "No courses" in the "Course overview" "block" - And I log out diff --git a/blocks/myoverview/tests/behat/block_myoverview_progress.feature b/blocks/myoverview/tests/behat/block_myoverview_progress.feature index 44cd5398341..5ed56564e80 100644 --- a/blocks/myoverview/tests/behat/block_myoverview_progress.feature +++ b/blocks/myoverview/tests/behat/block_myoverview_progress.feature @@ -20,18 +20,6 @@ Feature: Course overview block show users their progress on courses | teacher1 | C1 | editingteacher | | student1 | C1 | student | - Scenario: Course progress percentage should not be displayed if completion is not enabled - Given I log in as "student1" - And I click on "Timeline" "link" in the "Course overview" "block" - When I click on "Sort by courses" "link" in the "Course overview" "block" - Then I should see "Test choice 1 closes" in the "#myoverview_timeline_courses" "css_element" - And I should not see "0%" in the "Course overview" "block" - And I click on "Courses" "link" in the "Course overview" "block" - And I click on "In progress" "link" in the "Course overview" "block" - And I should see "Course 1" in the "Course overview" "block" - And I should not see "0%" in the "Course overview" "block" - And I log out - Scenario: User complete activity and verify his progress Given I log in as "teacher1" And I am on "Course 1" course homepage with editing mode on @@ -43,21 +31,11 @@ Feature: Course overview block show users their progress on courses And I press "Save and return to course" And I log out And I log in as "student1" - And I click on "Sort by courses" "link" in the "Course overview" "block" - And I should see "Test choice 1 closes" in the "#myoverview_timeline_courses" "css_element" - And I should see "0%" in the "Course overview" "block" - And I click on "Courses" "link" in the "Course overview" "block" - When I click on "In progress" "link" in the "Course overview" "block" Then I should see "Course 1" in the "Course overview" "block" And I should see "0%" in the "Course overview" "block" And I am on "Course 1" course homepage And I follow "Test choice 1" And I follow "Dashboard" in the user menu - And I click on "Timeline" "link" in the "Course overview" "block" - And I click on "Sort by courses" "link" in the "Course overview" "block" - And I should see "100%" in the "Course overview" "block" - And I click on "Courses" "link" in the "Course overview" "block" - And I click on "In progress" "link" in the "Course overview" "block" And I should see "Course 1" in the "Course overview" "block" And I should see "100%" in the "Course overview" "block" And I log out diff --git a/theme/boost/scss/moodle/blocks.scss b/theme/boost/scss/moodle/blocks.scss index 10bf359369b..4ab424ae658 100644 --- a/theme/boost/scss/moodle/blocks.scss +++ b/theme/boost/scss/moodle/blocks.scss @@ -158,34 +158,6 @@ $doughnut-fill-colour: $brand-warning; } .block_myoverview { - .event-list-item { - .event-icon { - vertical-align: middle; - - &::before { - content: ''; - display: inline-block; - height: 100%; - vertical-align: middle; - } - } - - .event-name-container { - vertical-align: middle; - max-width: calc(100% - 50px); - - .event-name { - display: block; - } - } - } - - .content-centred { - max-width: 900px; - margin-left: auto; - margin-right: auto; - } - .empty-placeholder-image-sm { height: 50px; } diff --git a/theme/boost/style/moodle.css b/theme/boost/style/moodle.css index 04614767c77..afcb3100dbf 100644 --- a/theme/boost/style/moodle.css +++ b/theme/boost/style/moodle.css @@ -11375,25 +11375,6 @@ div.editor_atto_toolbar button .icon { width: 45px; font-size: 45px; } -.block_myoverview .event-list-item .event-icon { - vertical-align: middle; } - .block_myoverview .event-list-item .event-icon::before { - content: ''; - display: inline-block; - height: 100%; - vertical-align: middle; } - -.block_myoverview .event-list-item .event-name-container { - vertical-align: middle; - max-width: calc(100% - 50px); } - .block_myoverview .event-list-item .event-name-container .event-name { - display: block; } - -.block_myoverview .content-centred { - max-width: 900px; - margin-left: auto; - margin-right: auto; } - .block_myoverview .empty-placeholder-image-sm { height: 50px; } diff --git a/theme/bootstrapbase/less/moodle/blocks.less b/theme/bootstrapbase/less/moodle/blocks.less index 44c7038d900..79229ac3cda 100644 --- a/theme/bootstrapbase/less/moodle/blocks.less +++ b/theme/bootstrapbase/less/moodle/blocks.less @@ -347,38 +347,6 @@ margin-left: 0; } - .event-list-item { - border-bottom: 1px solid @tableBorder; - padding-bottom: 10px; - margin-bottom: 10px; - - &:last-of-type { - border-bottom: none; - padding-bottom: 0; - margin-bottom: 0; - } - - .event-icon { - vertical-align: middle; - - &::before { - content: ''; - display: inline-block; - height: 100%; - vertical-align: middle; - } - } - - .event-name-container { - vertical-align: middle; - max-width: ~"calc(100% - 50px)"; - - .event-name { - display: block; - } - } - } - .empty-placeholder-image-sm { height: 50px; } diff --git a/theme/bootstrapbase/style/moodle.css b/theme/bootstrapbase/style/moodle.css index faa74e58c04..30731b7d966 100644 --- a/theme/bootstrapbase/style/moodle.css +++ b/theme/bootstrapbase/style/moodle.css @@ -16520,32 +16520,6 @@ body { .block_myoverview .row-fluid [class*="span"] { margin-left: 0; } -.block_myoverview .event-list-item { - border-bottom: 1px solid #ddd; - padding-bottom: 10px; - margin-bottom: 10px; -} -.block_myoverview .event-list-item:last-of-type { - border-bottom: none; - padding-bottom: 0; - margin-bottom: 0; -} -.block_myoverview .event-list-item .event-icon { - vertical-align: middle; -} -.block_myoverview .event-list-item .event-icon::before { - content: ''; - display: inline-block; - height: 100%; - vertical-align: middle; -} -.block_myoverview .event-list-item .event-name-container { - vertical-align: middle; - max-width: calc(100% - 50px); -} -.block_myoverview .event-list-item .event-name-container .event-name { - display: block; -} .block_myoverview .empty-placeholder-image-sm { height: 50px; } diff --git a/theme/bootstrapbase/templates/block_myoverview/course-event-list-item.mustache b/theme/bootstrapbase/templates/block_myoverview/course-event-list-item.mustache deleted file mode 100644 index be2a0e014cf..00000000000 --- a/theme/bootstrapbase/templates/block_myoverview/course-event-list-item.mustache +++ /dev/null @@ -1,95 +0,0 @@ -{{! - 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 . -}} -{{! - @template block_myoverview/course-event-list-item - - This template renders an event list item for the myoverview block - in the courses view. - - Example context (json): - { - "name": "Assignment due 1", - "url": "https://www.google.com", - "timesort": 1490320388, - "action": { - "name": "Submit assignment", - "url": "https://www.google.com", - "itemcount": 1, - "showitemcount": true, - "actionable": true - }, - "icon": { - "key": "icon", - "component": "mod_assign", - "alttext": "Assignment icon" - } - } -}} -
  • -
    -
    -
    - {{#icon}}{{#pix}} {{key}}, {{component}}, {{alttext}} {{/pix}}{{/icon}} -
    -
    - {{{name}}} -
    - {{#userdate}} {{timesort}}, {{#str}} strftimerecent {{/str}} {{/userdate}} -
    -
    -
    -
    - {{#action.actionable}} - {{action.name}} - {{#action.itemcount}} - {{#action.showitemcount}} - {{.}} - {{/action.showitemcount}} - {{/action.itemcount}} - {{/action.actionable}} - {{^action.actionable}} -
    {{action.name}}
    - {{/action.actionable}} -
    -
    -
    -
    -
    - {{#icon}}{{#pix}} {{key}}, {{component}}, {{alttext}} {{/pix}}{{/icon}} -
    -
    - {{{name}}} -
    - {{#userdate}} {{timesort}}, {{#str}} strftimerecent {{/str}} {{/userdate}} -
    -
    -
    -
    -
    -
    -
    - {{#icon}}{{#pix}} {{key}}, {{component}}, {{alttext}} {{/pix}}{{/icon}} -
    -
    - {{{name}}} -
    - {{#userdate}} {{timesort}}, {{#str}} strftimerecent {{/str}} {{/userdate}} -
    -
    -
    -
    -
  • diff --git a/theme/bootstrapbase/templates/block_myoverview/course-event-list.mustache b/theme/bootstrapbase/templates/block_myoverview/course-event-list.mustache deleted file mode 100644 index cb2bd12f8d5..00000000000 --- a/theme/bootstrapbase/templates/block_myoverview/course-event-list.mustache +++ /dev/null @@ -1,110 +0,0 @@ -{{! - 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 . -}} -{{! - @template block_myoverview/course-event-list - - This template renders a list of events for the myoverview block - sort by courses view. - - Example context (json): - { - "urls": { - "noevents": "#" - } - } -}} -
    - -
    - {{< block_myoverview/event-list-group }} - {{$title}}{{#str}} recentlyoverdue, block_myoverview {{/str}}{{/title}} - {{$extratitleclasses}}text-danger{{/extratitleclasses}} - {{$startday}}-14{{/startday}} - {{$endday}}0{{/endday}} - {{$eventlistitems}} - {{> block_myoverview/course-event-list-items }} - {{/eventlistitems}} - {{/ block_myoverview/event-list-group }} - {{< block_myoverview/event-list-group }} - {{$title}}{{#str}} today {{/str}}{{/title}} - {{$extratitleclasses}}{{/extratitleclasses}} - {{$startday}}0{{/startday}} - {{$endday}}1{{/endday}} - {{$eventlistitems}} - {{> block_myoverview/course-event-list-items }} - {{/eventlistitems}} - {{/ block_myoverview/event-list-group }} - {{< block_myoverview/event-list-group }} - {{$title}}{{#str}} next7days, block_myoverview {{/str}}{{/title}} - {{$extratitleclasses}}{{/extratitleclasses}} - {{$startday}}1{{/startday}} - {{$endday}}7{{/endday}} - {{$eventlistitems}} - {{> block_myoverview/course-event-list-items }} - {{/eventlistitems}} - {{/ block_myoverview/event-list-group }} - {{< block_myoverview/event-list-group }} - {{$title}}{{#str}} next30days, block_myoverview {{/str}}{{/title}} - {{$extratitleclasses}}{{/extratitleclasses}} - {{$startday}}7{{/startday}} - {{$endday}}30{{/endday}} - {{$eventlistitems}} - {{> block_myoverview/course-event-list-items }} - {{/eventlistitems}} - {{/ block_myoverview/event-list-group }} - {{< block_myoverview/event-list-group }} - {{$title}}{{#str}} future, block_myoverview {{/str}}{{/title}} - {{$extratitleclasses}}{{/extratitleclasses}} - {{$startday}}30{{/startday}} - {{$endday}}{{/endday}} - {{$eventlistitems}} - {{> block_myoverview/course-event-list-items }} - {{/eventlistitems}} - {{/ block_myoverview/event-list-group }} - -
    - -
    -
    - -
    -{{#js}} -require(['jquery', 'block_myoverview/event_list'], function($, EventList) { - var root = $("#event-list-container-{{$courseid}}{{/courseid}}"); - EventList.registerEventListeners(root); -}); -{{/js}} diff --git a/theme/bootstrapbase/templates/block_myoverview/course-item.mustache b/theme/bootstrapbase/templates/block_myoverview/course-item.mustache deleted file mode 100644 index d3f093a6cee..00000000000 --- a/theme/bootstrapbase/templates/block_myoverview/course-item.mustache +++ /dev/null @@ -1,44 +0,0 @@ -{{! - 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 . -}} -{{! - @template block_myoverview/course-item - - This template renders the each course block containing a summary and calendar events. - - Example context (json): - { - "shortname": "course 3", - "viewurl": "https://www.google.com", - "summary": "It is a long established fact that a reader will be distracted by the readable content of a page when looking at its layout." - } -}} -
  • -
    -
    -
    - {{> block_myoverview/course-summary }} -
    -
    - {{< block_myoverview/course-event-list }} - {{$limit}}10{{/limit}} - {{$offset}}0{{/offset}} - {{$courseid}}{{id}}{{/courseid}} - {{/ block_myoverview/course-event-list }} -
    -
    -
    -
  • diff --git a/theme/bootstrapbase/templates/block_myoverview/course-summary.mustache b/theme/bootstrapbase/templates/block_myoverview/course-summary.mustache deleted file mode 100644 index 4141d61f192..00000000000 --- a/theme/bootstrapbase/templates/block_myoverview/course-summary.mustache +++ /dev/null @@ -1,51 +0,0 @@ -{{! - 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 . -}} -{{! - @template block_myoverview/course-summary - - This template renders the course summary (view by courses) for the myoverview block. - - Example context (json): - { - "fullnamedisplay": "course 3", - "viewurl": "https://www.google.com", - "summary": "It is a long established fact that a reader will be distracted by the readable content of a page when looking at its layout." - } -}} -
    -
    - {{> block_myoverview/progress-chart}} -

    {{{fullnamedisplay}}}

    -
    -
    -
    -
    -
    - {{> block_myoverview/progress-chart}} -
    -
    - -
    -
    -

    - {{#shortentext}} 140, {{{summary}}}{{/shortentext}} -

    -
    diff --git a/theme/bootstrapbase/templates/block_myoverview/courses-view-nav-grouping-display-filter.mustache b/theme/bootstrapbase/templates/block_myoverview/courses-view-nav-grouping-display-filter.mustache new file mode 100644 index 00000000000..0cd929cd0ff --- /dev/null +++ b/theme/bootstrapbase/templates/block_myoverview/courses-view-nav-grouping-display-filter.mustache @@ -0,0 +1,41 @@ +{{! + 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 . +}} +{{! + @template block_myoverview/courses-view-nav-grouping-display-filter + + This template renders the main content area for the myoverview block. + + Example context (json): + {} +}} + diff --git a/theme/bootstrapbase/templates/block_myoverview/courses-view.mustache b/theme/bootstrapbase/templates/block_myoverview/courses-view.mustache index 950ab5a15c4..5bfc78dea49 100644 --- a/theme/bootstrapbase/templates/block_myoverview/courses-view.mustache +++ b/theme/bootstrapbase/templates/block_myoverview/courses-view.mustache @@ -24,19 +24,6 @@ }}
    {{#hascourses}} -
    {{#inprogress}} diff --git a/theme/bootstrapbase/templates/block_myoverview/event-list-group.mustache b/theme/bootstrapbase/templates/block_myoverview/event-list-group.mustache deleted file mode 100644 index 2fd6bfbae87..00000000000 --- a/theme/bootstrapbase/templates/block_myoverview/event-list-group.mustache +++ /dev/null @@ -1,75 +0,0 @@ -{{! - 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 . -}} -{{! - @template block_myoverview/event-list-group - - This template renders a list of events for the myoverview block. - - Example context (json): - { - "events": [ - { - "enddate": "Nov 4th, 10am", - "name": "Assignment due 1", - "url": "https://www.google.com", - "course": { - "fullname": "Course 1" - }, - "action": { - "name": "Submit assignment", - "url": "https://www.google.com", - "itemcount": 1 - }, - "icon": { - "key": "icon", - "component": "mod_assign", - "alttext": "Assignment icon" - } - }, - { - "enddate": "Nov 4th, 10am", - "name": "Assignment due 2", - "url": "https://www.google.com", - "course": { - "fullname": "Course 1" - }, - "action": { - "name": "Submit assignment", - "url": "https://www.google.com", - "itemcount": 1 - }, - "icon": { - "key": "icon", - "component": "mod_assign", - "alttext": "Assignment icon" - } - } - ] - } -}} - diff --git a/theme/bootstrapbase/templates/block_myoverview/event-list-item.mustache b/theme/bootstrapbase/templates/block_myoverview/event-list-item.mustache deleted file mode 100644 index 16174f32b0c..00000000000 --- a/theme/bootstrapbase/templates/block_myoverview/event-list-item.mustache +++ /dev/null @@ -1,104 +0,0 @@ -{{! - 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 . -}} -{{! - @template block_myoverview/event-list-item - - This template renders an event list item for the myoverview block. - - Example context (json): - { - "name": "Assignment due 1", - "url": "https://www.google.com", - "timesort": 1490320388, - "course": { - "fullnamedisplay": "Course 1" - }, - "action": { - "name": "Submit assignment", - "url": "https://www.google.com", - "itemcount": 1, - "showitemcount": true, - "actionable": true - }, - "icon": { - "key": "icon", - "component": "mod_assign", - "alttext": "Assignment icon" - } - } -}} -
  • -
    -
    -
    - {{#icon}}{{#pix}} {{key}}, {{component}}, {{alttext}} {{/pix}}{{/icon}} -
    -
    - {{{name}}} -
    {{{course.fullnamedisplay}}}
    -
    -
    -
    -
    -
    - {{#userdate}} {{timesort}}, {{#str}} strftimerecent {{/str}} {{/userdate}} -
    -
    - {{#action.actionable}} - {{action.name}} - {{#action.itemcount}} - {{#action.showitemcount}} - {{.}} - {{/action.showitemcount}} - {{/action.itemcount}} - {{/action.actionable}} - {{^action.actionable}} -
    {{action.name}}
    - {{/action.actionable}} -
    -
    -
    -
    -
    -
    -
    - {{#icon}}{{#pix}} {{key}}, {{component}}, {{alttext}} {{/pix}}{{/icon}} -
    -
    - {{name}} -
    {{{course.fullnamedisplay}}}
    -
    -
    -
    - {{#userdate}} {{timesort}}, {{#str}} strftimerecent {{/str}} {{/userdate}} -
    -
    -
    -
    -
    - {{#icon}}{{#pix}} {{key}}, {{component}}, {{alttext}} {{/pix}}{{/icon}} -
    -
    - {{{name}}} -
    {{{course.fullnamedisplay}}}
    -
    -
    - {{#userdate}} {{timesort}}, {{#str}} strftimerecent {{/str}} {{/userdate}} -
    -
    -
    -
  • diff --git a/theme/bootstrapbase/templates/block_myoverview/main.mustache b/theme/bootstrapbase/templates/block_myoverview/main.mustache index 42577fed2eb..3a8a005509d 100644 --- a/theme/bootstrapbase/templates/block_myoverview/main.mustache +++ b/theme/bootstrapbase/templates/block_myoverview/main.mustache @@ -24,33 +24,20 @@ }}
    - - -
    -
    - {{> block_myoverview/timeline-view }} -
    -
    +
    +
    {{#coursesview}} - {{> block_myoverview/courses-view }} + {{#hascourses}} +
    + {{> block_myoverview/courses-view-nav-grouping-display-filter }} +
    + {{/hascourses}} {{/coursesview}}
    +
    + {{#coursesview}} + {{> block_myoverview/courses-view }} + {{/coursesview}} +
    -{{#js}} -require(['jquery', 'block_myoverview/tab_preferences'], function($, TabPreferences) { - var root = $('#block-myoverview-view-choices-{{uniqid}}'); - TabPreferences.registerEventListeners(root); -}); -{{/js}} diff --git a/theme/bootstrapbase/templates/block_myoverview/timeline-view.mustache b/theme/bootstrapbase/templates/block_myoverview/timeline-view.mustache deleted file mode 100644 index 9ccdb7d4325..00000000000 --- a/theme/bootstrapbase/templates/block_myoverview/timeline-view.mustache +++ /dev/null @@ -1,55 +0,0 @@ -{{! - 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 . -}} -{{! - @template block_myoverview/timeline-view - - This template renders the timeline view for the myoverview block. - - Example context (json): - {} -}} -
    - - -
    -
    - {{> block_myoverview/timeline-view-dates }} -
    -
    - {{> block_myoverview/timeline-view-courses }} -
    -
    -
    -{{#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'); - $(this).addClass('active'); - }); -}); -{{/js}}