Merge branch 'MDL-72275-311-2' of git://github.com/mickhawkins/moodle into MOODLE_311_STABLE

This commit is contained in:
abgreeve 2021-09-30 10:03:27 +08:00
commit 250524cf5b
8 changed files with 74 additions and 12 deletions

View file

@ -1,2 +1,2 @@
define ("block_timeline/view_dates",["jquery","core/str","block_timeline/event_list","core/pubsub","core/paged_content_events"],function(a,b,c,d,e){var f={EVENT_LIST_CONTAINER:"[data-region=\"event-list-container\"]"},g=[5,10,25],h=function(a){var b=parseInt(a.data("limit"),10),c=!1,d=g.map(function(a){if(b==a){c=!0}return{value:a,active:b==a}});if(!c){d[0].active=!0}return d},i=function(b,c){var f=c+e.SET_ITEMS_PER_PAGE_LIMIT;d.subscribe(f,function(c){a(b).data("limit",c)})},j=function(d){var e=d.find(f.EVENT_LIST_CONTAINER),g=a(e).attr("id")+"user_block_timeline"+Math.random();i(d,g);var j=h(d),k={persistentLimitKey:"block_timeline_user_limit_preference",eventNamespace:g};b.get_string("ariaeventlistpaginationnavdates","block_timeline").then(function(a){c.init(e,j,{},a,k);return a}).catch(function(){c.init(e,j,{},"",k)})};return{init:function init(b){b=a(b);if(b.hasClass("active")){j(b);b.data("seen",!0)}},reset:function reset(a){a.removeAttr("data-seen");if(a.hasClass("active")){j(a);a.data("seen",!0)}},shown:function shown(a){if(!a.data("seen")){j(a);a.data("seen",!0)}}}});
define ("block_timeline/view_dates",["jquery","core/str","block_timeline/event_list","core/pubsub","core/paged_content_events"],function(a,b,c,d,e){var f={EVENT_LIST_CONTAINER:"[data-region=\"event-list-container\"]"},g=[5,10,25],h=function(a){var b=parseInt(a.data("limit"),10),c=!1,d=g.map(function(a){if(b==a){c=!0}return{value:a,active:b==a}});if(!c){d[0].active=!0}return d},i=function(b,c){var f=c+e.SET_ITEMS_PER_PAGE_LIMIT;d.subscribe(f,function(c){a(b).data("limit",c)})},j=function(d){var e=d.find(f.EVENT_LIST_CONTAINER),g=a(e).attr("id")+"user_block_timeline"+Math.random();i(d,g);var j=h(d),k={persistentLimitKey:"block_timeline_user_limit_preference",eventNamespace:g};b.get_string("ariaeventlistpaginationnavdates","block_timeline").then(function(a){c.init(e,j,{},a,k);return a}).catch(function(){c.init(e,j,{},"",k)})};return{init:function init(b){b=a(b);if(b.hasClass("active")){j(b);b.attr("data-seen",!0)}},reset:function reset(a){a.removeAttr("data-seen");if(a.hasClass("active")){j(a);a.attr("data-seen",!0)}},shown:function shown(a){if(!a.attr("data-seen")){j(a);a.attr("data-seen",!0)}}}});
//# sourceMappingURL=view_dates.min.js.map

File diff suppressed because one or more lines are too long

View file

@ -118,7 +118,7 @@ function(
root = $(root);
if (root.hasClass('active')) {
load(root);
root.data('seen', true);
root.attr('data-seen', true);
}
};
@ -132,7 +132,7 @@ function(
root.removeAttr('data-seen');
if (root.hasClass('active')) {
load(root);
root.data('seen', true);
root.attr('data-seen', true);
}
};
@ -142,9 +142,9 @@ function(
* @param {object} root The root element for the timeline courses view.
*/
var shown = function(root) {
if (!root.data('seen')) {
if (!root.attr('data-seen')) {
load(root);
root.data('seen', true);
root.attr('data-seen', true);
}
};

View file

@ -102,7 +102,7 @@ class main implements renderable, templatable {
*/
private function get_filter_offsets() {
$limit = false;
$limit = '';
if (in_array($this->filter, [BLOCK_TIMELINE_FILTER_BY_NONE, BLOCK_TIMELINE_FILTER_BY_OVERDUE])) {
$offset = -14;
if ($this->filter == BLOCK_TIMELINE_FILTER_BY_OVERDUE) {
@ -170,8 +170,8 @@ class main implements renderable, templatable {
'sorttimelinecourses' => $this->order == BLOCK_TIMELINE_SORT_BY_COURSES,
'selectedfilter' => $this->filter,
'hasdaysoffset' => true,
'hasdayslimit' => $offsets['dayslimit'] !== false ,
'nodayslimit' => $offsets['dayslimit'] === false ,
'hasdayslimit' => $offsets['dayslimit'] !== '' ,
'nodayslimit' => $offsets['dayslimit'] === '' ,
'limit' => $this->limit
];
return array_merge($contextvariables, $filters, $offsets);

View file

@ -98,7 +98,7 @@
{{#str}} next3months, block_timeline {{/str}}
</a>
<a
class="dropdown-item {{#next6months}} active {{/next6months}}"
class="dropdown-item"
href="#"
data-from="0"
data-to="180"

View file

@ -58,7 +58,7 @@
data-limit="2"
data-offset="0"
data-days-limit="{{dayslimit}}"
data-days-offset="0"
data-days-offset="{{daysoffset}}"
data-no-events-url="{{urls.noevents}}"
id="view_courses_{{uniqid}}"
>

View file

@ -77,7 +77,7 @@ Feature: The timeline block allows users to see upcoming courses
And I click on "Sort by dates" "link" in the "Timeline" "block"
And I click on "Sort timeline items" "button" in the "Timeline" "block"
And I click on "Sort by courses" "link" in the "Timeline" "block"
And I reload the page
When I reload the page
Then I should see "Course 1" in the "Timeline" "block"
And I should see "Course 2" in the "Timeline" "block"
And I should see "More courses" in the "Timeline" "block"
@ -89,3 +89,45 @@ Feature: The timeline block allows users to see upcoming courses
And I should not see "Test feedback 2 closes" in the "Timeline" "block"
And I should not see "Test feedback 3 closes" in the "Timeline" "block"
And I should not see "Test assign 1 is due" in the "Timeline" "block"
Scenario: Persistent All in course view
Given I log in as "student1"
And I click on "Sort timeline items" "button" in the "Timeline" "block"
And I click on "Sort by courses" "link" in the "Timeline" "block"
And I click on "Filter timeline items" "button" in the "Timeline" "block"
And I click on "All" "link" in the "Timeline" "block"
When I reload the page
And I click on "More courses" "button" in the "Timeline" "block"
Then I should see "Course 3" in the "Timeline" "block"
And I should see "Course 2" in the "Timeline" "block"
And I should see "Course 1" in the "Timeline" "block"
And I should see "Test choice 1 closes" in the "Timeline" "block"
And I should see "Test choice 3 closes" in the "Timeline" "block"
And I should see "Test feedback 1 closes" in the "Timeline" "block"
And I should see "Test feedback 2 closes" in the "Timeline" "block"
And I should see "Test feedback 3 closes" in the "Timeline" "block"
And I should see "Test assign 1 is due" in the "Timeline" "block"
And I should not see "More courses" in the "Timeline" "block"
And I should not see "Course 4" in the "Timeline" "block"
And I should not see "Test choice 2 closes" in the "Timeline" "block"
And I should not see "Test feedback 4 closes" in the "Timeline" "block"
Scenario: Current filtering always applies in courses view
Given I log in as "student1"
And I click on "Sort timeline items" "button" in the "Timeline" "block"
And I click on "Sort by courses" "link" in the "Timeline" "block"
And I click on "Filter timeline items" "button" in the "Timeline" "block"
And I click on "Overdue" "link" in the "Timeline" "block"
And I reload the page
And I should see "Test assign 1 is due" in the "Timeline" "block"
And I should not see "Test feedback 2 closes" in the "Timeline" "block"
And I click on "Sort timeline items" "button" in the "Timeline" "block"
And I click on "Sort by dates" "link" in the "Timeline" "block"
And I click on "Filter timeline items" "button" in the "Timeline" "block"
# Confirm that when we switch back to courses view, the "All" filer continues to be applied (and not "overdue").
When I click on "All" "link" in the "Timeline" "block"
And I click on "Sort timeline items" "button" in the "Timeline" "block"
And I click on "Sort by courses" "link" in the "Timeline" "block"
And I click on "More courses" "button" in the "Timeline" "block"
Then I should see "Test assign 1 is due" in the "Timeline" "block"
And I should see "Test feedback 2 closes" in the "Timeline" "block"

View file

@ -119,3 +119,23 @@ Feature: The timeline block allows users to see upcoming activities
And I should not see "Test choice 1 closes" in the "Timeline" "block"
And I should not see "Test choice 3 closes" in the "Timeline" "block"
And I should not see "Test feedback 3 closes" in the "Timeline" "block"
Scenario: Current filtering always applies in date view
Given I log in as "student1"
And I click on "Filter timeline items" "button" in the "Timeline" "block"
And I click on "Overdue" "link" in the "Timeline" "block"
And I reload the page
# Expand to 25 results, to ensure we see the earliest and latest timeline items.
And I click on "Show 5 activities per page" "button" in the "Timeline" "block"
And I click on "25" "link"
And I should see "Test assign 1 is due" in the "Timeline" "block"
And I should not see "Test feedback 2 closes" in the "Timeline" "block"
And I click on "Sort timeline items" "button" in the "Timeline" "block"
And I click on "Sort by courses" "link" in the "Timeline" "block"
And I click on "Filter timeline items" "button" in the "Timeline" "block"
# Confirm that when we switch back to date view, the "All" filer continues to be applied (and not "overdue")
When I click on "All" "link" in the "Timeline" "block"
And I click on "Sort timeline items" "button" in the "Timeline" "block"
And I click on "Sort by dates" "link" in the "Timeline" "block"
Then I should see "Test assign 1 is due" in the "Timeline" "block"
And I should see "Test feedback 2 closes" in the "Timeline" "block"