Merge branch 'MDL-63880-master' of git://github.com/Chocolate-lightning/moodle

This commit is contained in:
Andrew Nicols 2019-02-07 13:53:53 +08:00
commit c882a45f10
24 changed files with 45 additions and 181 deletions

File diff suppressed because one or more lines are too long

View File

@ -64,7 +64,7 @@ function(
COURSES_CARDS: 'block_myoverview/view-cards',
COURSES_LIST: 'block_myoverview/view-list',
COURSES_SUMMARY: 'block_myoverview/view-summary',
NOCOURSES: 'block_myoverview/no-courses'
NOCOURSES: 'core_course/no-courses'
};
var NUMCOURSES_PERPAGE = [12, 24, 48];

View File

@ -54,7 +54,6 @@ $string['lastaccessed'] = 'Last accessed';
$string['list'] = 'List';
$string['myoverview:addinstance'] = 'Add a new course overview block';
$string['myoverview:myaddinstance'] = 'Add a new course overview block to Dashboard';
$string['nocourses'] = 'No courses';
$string['past'] = 'Past';
$string['pluginname'] = 'Course overview';
$string['privacy:metadata:overviewsortpreference'] = 'The Course overview block sort preference.';
@ -90,3 +89,6 @@ $string['timeline'] = 'Timeline';
$string['viewcoursename'] = 'View course {$a}';
$string['privacy:metadata:overviewlasttab'] = 'This stores the last tab selected by the user on the overview block.';
$string['viewcourse'] = 'View course';
// Deprecated since Moodle 3.7.
$string['nocourses'] = 'No courses';

View File

@ -12,4 +12,5 @@ sortbycourses,block_myoverview
sortbydates,block_myoverview
timeline,block_myoverview
viewcoursename,block_myoverview
privacy:metadata:overviewlasttab,block_myoverview
privacy:metadata:overviewlasttab,block_myoverview
nocourses,block_myoverview

View File

@ -1,33 +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 <http://www.gnu.org/licenses/>.
}}
{{!
@template block_myoverview/no-courses
This template renders the no courses message.
Example context (json):
{
"nocoursesimg": "https://moodlesite/theme/image.php/boost/block_myoverview/1535727318/courses"
}
}}
<div class="text-xs-center text-center m-t-1" data-region="empty-message">
<img class="empty-placeholder-image-lg m-t-1"
src="{{nocoursesimg}}"
alt="{{#str}} nocourses, block_myoverview {{/str}}"
role="presentation">
<p class="text-muted mt-3">{{#str}} nocourses, block_myoverview {{/str}}</p>
</div>

View File

@ -25,34 +25,10 @@
<div data-region="loading-placeholder-content" aria-hidden="true">
{{#cards}}
<div class="card-deck dashboard-card-deck one-row" style="height: 13rem">
<div class="card dashboard-card border-0">
<div class="card-img-top bg-pulse-grey w-100" style="height: 7rem">
</div>
<div class="card-body course-info-container">
<div class="bg-pulse-grey w-100" style="height: 1rem"></div>
</div>
</div>
<div class="card dashboard-card border-0">
<div class="card-img-top bg-pulse-grey w-100" style="height: 7rem">
</div>
<div class="card-body course-info-container">
<div class="bg-pulse-grey w-100" style="height: 1rem"></div>
</div>
</div>
<div class="card dashboard-card border-0">
<div class="card-img-top bg-pulse-grey w-100" style="height: 7rem">
</div>
<div class="card-body course-info-container">
<div class="bg-pulse-grey w-100" style="height: 1rem"></div>
</div>
</div>
<div class="card dashboard-card border-0">
<div class="card-img-top bg-pulse-grey w-100" style="height: 7rem">
</div>
<div class="card-body course-info-container">
<div class="bg-pulse-grey w-100" style="height: 1rem"></div>
</div>
</div>
{{> core_course/placeholder-course }}
{{> core_course/placeholder-course }}
{{> core_course/placeholder-course }}
{{> core_course/placeholder-course }}
</div>
{{/cards}}
{{#list}}

View File

@ -1 +1 @@
define(["jquery","core_course/repository","core/templates","core/notification","core/pubsub","core_course/events"],function(a,b,c,d,e,f){var g={COURSES_VIEW:'[data-region="recentlyaccessedcourses-view"]',COURSES_VIEW_CONTENT:'[data-region="recentlyaccessedcourses-view-content"]'},h=10,i=function(a,c){return b.getLastAccessedCourses(a,c)},j=function(a,b){if(b.length>0)return c.render("block_recentlyaccessedcourses/view-cards",{courses:b});var d=a.attr("data-nocoursesimgurl");return c.render("block_recentlyaccessedcourses/no-courses",{nocoursesimgurl:d})},k=function(a,b){var e=b.find(g.COURSES_VIEW),f=b.find(g.COURSES_VIEW_CONTENT),k=i(a,h);return k.then(function(a){var b=j(e,a);return b.then(function(a,b){return c.replaceNodeContents(f,a,b)})["catch"](d.exception),k})["catch"](d.exception)},l=function(a,b){e.subscribe(f.favourited,function(){k(a,b)}),e.subscribe(f.unfavorited,function(){k(a,b)})},m=function(b,c){c=a(c),l(b,c),k(b,c)};return{init:m}});
define(["jquery","core_course/repository","core/templates","core/notification","core/pubsub","core_course/events"],function(a,b,c,d,e,f){var g={COURSES_VIEW:'[data-region="recentlyaccessedcourses-view"]',COURSES_VIEW_CONTENT:'[data-region="recentlyaccessedcourses-view-content"]'},h=10,i=function(a,c){return b.getLastAccessedCourses(a,c)},j=function(a,b){if(b.length>0)return c.render("core_course/view-cards",{courses:b});var d=a.attr("data-nocoursesimg");return c.render("core_course/no-courses",{nocoursesimg:d})},k=function(a,b){var e=b.find(g.COURSES_VIEW),f=b.find(g.COURSES_VIEW_CONTENT),k=i(a,h);return k.then(function(a){var b=j(e,a);return b.then(function(a,b){return c.replaceNodeContents(f,a,b)})["catch"](d.exception),k})["catch"](d.exception)},l=function(a,b){e.subscribe(f.favourited,function(){k(a,b)}),e.subscribe(f.unfavorited,function(){k(a,b)})},m=function(b,c){c=a(c),l(b,c),k(b,c)};return{init:m}});

View File

@ -69,13 +69,13 @@ define(
*/
var renderCourses = function(root, courses) {
if (courses.length > 0) {
return Templates.render('block_recentlyaccessedcourses/view-cards', {
return Templates.render('core_course/view-cards', {
courses: courses
});
} else {
var nocoursesimgurl = root.attr('data-nocoursesimgurl');
return Templates.render('block_recentlyaccessedcourses/no-courses', {
nocoursesimgurl: nocoursesimgurl
var nocoursesimgurl = root.attr('data-nocoursesimg');
return Templates.render('core_course/no-courses', {
nocoursesimg: nocoursesimgurl
});
}
};

View File

@ -49,7 +49,7 @@ class main implements renderable, templatable {
return [
'userid' => $USER->id,
'nocoursesimgurl' => $nocoursesurl
'nocoursesimg' => $nocoursesurl
];
}
}

View File

@ -20,8 +20,10 @@
* @copyright 2018 Victor Deniz <victor@moodle.com>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
$string['nocourses'] = 'No recent courses';
$string['pluginname'] = 'Recently accessed courses';
$string['privacy:metadata'] = 'The Recently accessed courses block does not store any personal data.';
$string['recentlyaccessedcourses:addinstance'] = 'Add a new Recently accessed courses block';
$string['recentlyaccessedcourses:myaddinstance'] = 'Add a new recently accessed courses block to Dashboard';
// Deprecated since Moodle 3.7.
$string['nocourses'] = 'No recent courses';

View File

@ -0,0 +1 @@
nocourses,block_recentlyaccessedcourses

View File

@ -22,7 +22,7 @@
Example context (json):
{
"userid": 2,
"nocoursesimgurl": "https://moodlesite/theme/image.php/boost/block_recentlyaccessedcourses/1535727318/courses"
"nocoursesimg": "https://moodlesite/theme/image.php/boost/block_recentlyaccessedcourses/1535727318/courses"
}
}}

View File

@ -21,19 +21,19 @@
Example context (json):
{
"nocoursesimgurl": "https://moodlesite/theme/image.php/boost/block_recentlyaccessedcourses/1535727318/courses"
"nocoursesimg": "https://moodlesite/theme/image.php/boost/block_recentlyaccessedcourses/1535727318/courses"
}
}}
<div id="recentlyaccessedcourses-view-{{uniqid}}"
data-region="recentlyaccessedcourses-view"
data-nocoursesimgurl="{{nocoursesimgurl}}">
data-nocoursesimg="{{nocoursesimg}}">
<div data-region="recentlyaccessedcourses-view-content">
<div data-region="recentlyaccessedcourses-loading-placeholder">
<div class="card-deck dashboard-card-deck one-row" style="height: 11.1rem">
{{> block_recentlyaccessedcourses/placeholder-course }}
{{> block_recentlyaccessedcourses/placeholder-course }}
{{> block_recentlyaccessedcourses/placeholder-course }}
{{> block_recentlyaccessedcourses/placeholder-course }}
{{> core_course/placeholder-course }}
{{> core_course/placeholder-course }}
{{> core_course/placeholder-course }}
{{> core_course/placeholder-course }}
</div>
</div>
</div>

View File

@ -1 +1 @@
define(["jquery","core/notification","block_starredcourses/repository","core/pubsub","core/templates","core_course/events"],function(a,b,c,d,e,f){var g={STARRED_COURSES_REGION_VIEW:'[data-region="starred-courses-view"]',STARRED_COURSES_REGION:'[data-region="starred-courses-view-content"]'},h=function(a,b){if(b.length>0)return e.render("block_starredcourses/view-cards",{courses:b});var c=a.find(g.STARRED_COURSES_REGION_VIEW).attr("data-nocoursesimg");return e.render("block_starredcourses/no-courses",{nocoursesimg:c})},i=function(a){var d=a.find(g.STARRED_COURSES_REGION),f={limit:0,offset:0};return c.getStarredCourses(f).then(function(b){return h(a,b)}).then(function(a,b){return e.replaceNodeContents(d,a,b)})["catch"](b.exception)},j=function(a){d.subscribe(f.favourited,function(){i(a)}),d.subscribe(f.unfavorited,function(){i(a)})},k=function(b){b=a(b),j(b),i(b)};return{init:k}});
define(["jquery","core/notification","block_starredcourses/repository","core/pubsub","core/templates","core_course/events"],function(a,b,c,d,e,f){var g={STARRED_COURSES_REGION_VIEW:'[data-region="starred-courses-view"]',STARRED_COURSES_REGION:'[data-region="starred-courses-view-content"]'},h=function(a,b){if(b.length>0)return e.render("core_course/view-cards",{courses:b});var c=a.find(g.STARRED_COURSES_REGION_VIEW).attr("data-nocoursesimg");return e.render("core_course/no-courses",{nocoursesimg:c})},i=function(a){var d=a.find(g.STARRED_COURSES_REGION),f={limit:0,offset:0};return c.getStarredCourses(f).then(function(b){return h(a,b)}).then(function(a,b){return e.replaceNodeContents(d,a,b)})["catch"](b.exception)},j=function(a){d.subscribe(f.favourited,function(){i(a)}),d.subscribe(f.unfavorited,function(){i(a)})},k=function(b){b=a(b),j(b),i(b)};return{init:k}});

View File

@ -53,12 +53,12 @@ function(
*/
var renderCourses = function(root, courses) {
if (courses.length > 0) {
return Templates.render('block_starredcourses/view-cards', {
return Templates.render('core_course/view-cards', {
courses: courses
});
} else {
var nocoursesimg = root.find(SELECTORS.STARRED_COURSES_REGION_VIEW).attr('data-nocoursesimg');
return Templates.render('block_starredcourses/no-courses', {
return Templates.render('core_course/no-courses', {
nocoursesimg: nocoursesimg
});
}

View File

@ -22,9 +22,10 @@
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
$string['nocourses'] = 'No starred courses';
$string['pluginname'] = 'Starred courses';
$string['privacy:metadata'] = 'The starred courses block does not store any personal data.';
$string['starredcourses:addinstance'] = 'Add a new starred courses block';
$string['starredcourses:myaddinstance'] = 'Add a new starred courses block to Dashboard';
// Deprecated since Moodle 3.7.
$string['nocourses'] = 'No starred courses';

View File

@ -0,0 +1 @@
nocourses,block_starredcourses

View File

@ -1,28 +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 <http://www.gnu.org/licenses/>.
}}
{{!
@template block_starredcourses/no-courses
This template renders the no courses message.
Example context (json):
{
"nocoursesimg": "https://moodlesite/theme/image.php/boost/block_recentcourses/1535727318/courses"
}
}}
<div class="text-xs-center text-center m-t-3" data-region="empty-message">
<img class="empty-placeholder-image-lg m-t-1"
src="{{nocoursesimg}}"
alt="{{#str}} nocourses, block_starredcourses {{/str}}"
role="presentation">
<p class="text-muted mt-3">{{#str}} nocourses, block_starredcourses {{/str}}</p>
</div>

View File

@ -1,26 +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 <http://www.gnu.org/licenses/>.
}}
{{!
@template block_starredcourses/placeholder-course
This template renders an course card item loading placeholder for the starred courses block.
Example context (json):
{}
}}
<div class="card dashboard-card border-0">
<div class="card-img-top bg-pulse-grey w-100" style="height: 7rem">
</div>
<div class="card-body recent-course-info-container">
<div class="bg-pulse-grey w-100" style="height: 1rem"></div>
</div>
</div>

View File

@ -1,33 +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 Licensebllsdsadfasfd
along with Moodle. If not, see <http://www.gnu.org/licenses/>.
}}
{{!
@template block_starredcourses/view-cards
This template renders the carousel for the starredcourses block.
Example context (json):
{
"courses": [
{
"name": "Assignment due 1",
"viewurl": "https://moodlesite/course/view.php?id=2",
"courseimage": "https://moodlesite/pluginfile/123/course/overviewfiles/123.jpg",
"fullname": "course 3"
}
]
}
}}
{{< core_course/coursecards }}
{{$classes}}one-row{{/classes}}
{{$coursename}} {{fullname}} {{/coursename}}
{{/ core_course/coursecards }}

View File

@ -30,9 +30,9 @@
<div data-region="starred-courses-view-content">
<div data-region="starred-courses-loading-placeholder">
<div class="card-deck dashboard-card-deck one-row" style="height: 11.1rem">
{{> block_starredcourses/placeholder-course }}
{{> block_starredcourses/placeholder-course }}
{{> block_starredcourses/placeholder-course }}
{{> core_course/placeholder-course }}
{{> core_course/placeholder-course }}
{{> core_course/placeholder-course }}
</div>
</div>
</div>

View File

@ -15,7 +15,7 @@
along with Moodle. If not, see <http://www.gnu.org/licenses/>.
}}
{{!
@template block_recentlyaccessedcourses/no-courses
@template core_course/no-courses
This template renders the no courses message.
@ -26,8 +26,8 @@
}}
<div class="text-xs-center text-center m-t-3" data-region="empty-message">
<img class="empty-placeholder-image-lg m-t-1"
src="{{nocoursesimgurl}}"
alt="{{#str}} nocourses, block_recentlyaccessedcourses {{/str}}"
src="{{nocoursesimg}}"
alt="{{#str}} nocourses, core {{/str}}"
role="presentation">
<p class="text-muted mt-3">{{#str}} nocourses, block_recentlyaccessedcourses {{/str}}</p>
<p class="text-muted mt-3">{{#str}} nocourses, core {{/str}}</p>
</div>

View File

@ -15,9 +15,9 @@
along with Moodle. If not, see <http://www.gnu.org/licenses/>.
}}
{{!
@template block_recentlyaccessedcourses/placeholder-course
@template core_course/placeholder-course
This template renders an course card item loading placeholder for the recentlyaccessedcourses block.
This template renders an course card item loading placeholder for multiple blocks.
Example context (json):
{}

View File

@ -15,9 +15,9 @@
along with Moodle. If not, see <http://www.gnu.org/licenses/>.
}}
{{!
@template block_recentlyaccessedcourses/view-cards
@template core_course/view-cards
This template renders the carousel for the recentlyaccessedcourses block.
This template renders the carousel for the recentlyaccessedcourses & starredcourses blocks.
Example context (json):
{