diff --git a/blocks/myoverview/templates/course-action-menu.mustache b/blocks/myoverview/templates/course-action-menu.mustache index 1ce2d5ad46e..e1f70d27d98 100644 --- a/blocks/myoverview/templates/course-action-menu.mustache +++ b/blocks/myoverview/templates/course-action-menu.mustache @@ -39,7 +39,7 @@ {{#pix}} i/star, core, {{#str}} favourites, block_myoverview {{/str}} {{/pix}} {{#str}} addtofavourites, block_myoverview {{/str}} @@ -50,7 +50,7 @@ {{#str}} removefromfavourites, block_myoverview {{/str}}
@@ -60,7 +60,7 @@ {{#pix}} i/show, core, {{#str}} hidden, block_myoverview {{/str}} {{/pix}} {{#str}} show, block_myoverview {{/str}} @@ -71,7 +71,7 @@ {{#pix}} i/hide, core, {{#str}} hidden, block_myoverview {{/str}} {{/pix}} {{#str}} hidecourse, block_myoverview {{/str}} diff --git a/blocks/myoverview/templates/view-cards.mustache b/blocks/myoverview/templates/view-cards.mustache index 5e4bf56eff0..f74554a1cd5 100644 --- a/blocks/myoverview/templates/view-cards.mustache +++ b/blocks/myoverview/templates/view-cards.mustache @@ -34,33 +34,20 @@ } }} -
-{{#courses}} -
- -
- {{#str}}aria:courseimage, core_course{{/str}} -
-
-
-
- - {{> block_myoverview/course-action-menu }} -
-
+{{< core_course/coursecards }} + {{$menu}} + {{> block_myoverview/course-action-menu }} + {{/menu}} + {{$progress}} {{#hasprogress}} - + {{/hasprogress}} -
-{{/courses}} -
\ No newline at end of file + {{/progress}} + {{$coursename}} + + {{#shortentext}}50, {{{fullname}}} {{/shortentext}} + + {{/coursename}} +{{/ core_course/coursecards }} diff --git a/blocks/myoverview/templates/view-list.mustache b/blocks/myoverview/templates/view-list.mustache index 6661455b2d6..12913017a2e 100644 --- a/blocks/myoverview/templates/view-list.mustache +++ b/blocks/myoverview/templates/view-list.mustache @@ -41,13 +41,19 @@ data-course-id="{{{id}}}">
{{#hasprogress}}
diff --git a/blocks/myoverview/templates/view-summary.mustache b/blocks/myoverview/templates/view-summary.mustache index abc725fafb1..b2b640c062b 100644 --- a/blocks/myoverview/templates/view-summary.mustache +++ b/blocks/myoverview/templates/view-summary.mustache @@ -48,13 +48,19 @@
diff --git a/blocks/recentlyaccessedcourses/templates/view-cards.mustache b/blocks/recentlyaccessedcourses/templates/view-cards.mustache index 2f0db9c9785..7964d9f3e72 100644 --- a/blocks/recentlyaccessedcourses/templates/view-cards.mustache +++ b/blocks/recentlyaccessedcourses/templates/view-cards.mustache @@ -33,25 +33,8 @@ } }} - \ No newline at end of file + +{{< core_course/coursecards }} + {{$classes}}one-row{{/classes}} + {{$coursename}} {{fullname}} {{/coursename}} +{{/ core_course/coursecards }} diff --git a/blocks/starredcourses/templates/view-cards.mustache b/blocks/starredcourses/templates/view-cards.mustache index 0ae646aa9a9..b84d24eebeb 100644 --- a/blocks/starredcourses/templates/view-cards.mustache +++ b/blocks/starredcourses/templates/view-cards.mustache @@ -26,25 +26,8 @@ ] } }} - + +{{< core_course/coursecards }} + {{$classes}}one-row{{/classes}} + {{$coursename}} {{fullname}} {{/coursename}} +{{/ core_course/coursecards }} diff --git a/course/classes/external/course_summary_exporter.php b/course/classes/external/course_summary_exporter.php index 2a1416c36cf..bef5cad89c0 100644 --- a/course/classes/external/course_summary_exporter.php +++ b/course/classes/external/course_summary_exporter.php @@ -54,7 +54,7 @@ class course_summary_exporter extends \core\external\exporter { } protected function get_other_values(renderer_base $output) { - + global $CFG; $courseimage = self::get_course_image($this->data); if (!$courseimage) { $courseimage = self::get_course_pattern($this->data); @@ -72,7 +72,8 @@ class course_summary_exporter extends \core\external\exporter { 'progress' => $progress, 'hasprogress' => $hasprogress, 'isfavourite' => $this->related['isfavourite'], - 'hidden' => boolval(get_user_preferences('block_myoverview_hidden_course_' . $this->data->id, 0)) + 'hidden' => boolval(get_user_preferences('block_myoverview_hidden_course_' . $this->data->id, 0)), + 'showshortname' => $CFG->courselistshortnames ? true : false ); } @@ -145,6 +146,9 @@ class course_summary_exporter extends \core\external\exporter { 'timeaccess' => array( 'type' => PARAM_INT, 'optional' => true + ), + 'showshortname' => array( + 'type' => PARAM_BOOL ) ); } diff --git a/course/templates/coursecards.mustache b/course/templates/coursecards.mustache new file mode 100644 index 00000000000..00cb8923e08 --- /dev/null +++ b/course/templates/coursecards.mustache @@ -0,0 +1,70 @@ +{{! + 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/view-cards + + This template renders the cards view for the myoverview 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", + "hasprogress": true, + "progress": 10 + } + ] + } +}} + + diff --git a/course/templates/favouriteicon.mustache b/course/templates/favouriteicon.mustache index 31292a86a08..5f2cc130f9b 100644 --- a/course/templates/favouriteicon.mustache +++ b/course/templates/favouriteicon.mustache @@ -25,7 +25,7 @@ "isfavourite": true } }} - diff --git a/lang/en/course.php b/lang/en/course.php index 3e32f80962b..84b17bef17c 100644 --- a/lang/en/course.php +++ b/lang/en/course.php @@ -22,8 +22,9 @@ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ -$string['aria:courseimage'] = 'Course image:'; -$string['aria:coursename'] = 'Course name:'; +$string['aria:courseimage'] = 'Course image'; +$string['aria:courseshortname'] = 'Course short name'; +$string['aria:coursename'] = 'Course name'; $string['aria:favourite'] = 'Course is starred'; $string['favourite'] = 'Starred course'; $string['privacy:perpage'] = 'The number of courses to show per page.'; diff --git a/theme/boost/scss/moodle/blocks.scss b/theme/boost/scss/moodle/blocks.scss index 8661198bec5..7151c72912d 100644 --- a/theme/boost/scss/moodle/blocks.scss +++ b/theme/boost/scss/moodle/blocks.scss @@ -102,6 +102,9 @@ $card-gutter : $card-deck-margin * 2; .btn-link { color: inherit; } + .multiline { + white-space: normal; + } .btn.btn-link.btn-icon { height: 36px; width: 36px; diff --git a/theme/boost/style/moodle.css b/theme/boost/style/moodle.css index 7791d6dc8a6..0fd1139cb7a 100644 --- a/theme/boost/style/moodle.css +++ b/theme/boost/style/moodle.css @@ -11240,6 +11240,9 @@ div.editor_atto_toolbar button .icon { .block .block-cards .btn-link { color: inherit; } +.block .block-cards .multiline { + white-space: normal; } + .block .block-cards .btn.btn-link.btn-icon, .block .block-cards #page-grade-grading-manage .actions .btn-link.btn-icon.action, #page-grade-grading-manage .actions .block .block-cards .btn-link.btn-icon.action, .block .block-cards #rubric-rubric.gradingform_rubric #rubric-criteria .criterion .addlevel input.btn-link.btn-icon, #rubric-rubric.gradingform_rubric #rubric-criteria .criterion .addlevel .block .block-cards input.btn-link.btn-icon, .block .block-cards #rubric-rubric.gradingform_rubric .btn-link.btn-icon.addcriterion, #rubric-rubric.gradingform_rubric .block .block-cards .btn-link.btn-icon.addcriterion { height: 36px; width: 36px; diff --git a/theme/bootstrapbase/less/moodle/blocks.less b/theme/bootstrapbase/less/moodle/blocks.less index 94d568a49a7..c1177495e5e 100644 --- a/theme/bootstrapbase/less/moodle/blocks.less +++ b/theme/bootstrapbase/less/moodle/blocks.less @@ -287,6 +287,9 @@ border: 1px solid @tableBorder; .border-radius(@baseBorderRadius); } + .multiline { + white-space: normal; + } .summary img { max-width: 100%; } diff --git a/theme/bootstrapbase/style/moodle.css b/theme/bootstrapbase/style/moodle.css index cc303cfa24a..3e9c6ae609f 100644 --- a/theme/bootstrapbase/style/moodle.css +++ b/theme/bootstrapbase/style/moodle.css @@ -16376,6 +16376,9 @@ body { -moz-border-radius: 4px; border-radius: 4px; } +.block .block-cards .multiline { + white-space: normal; +} .block .block-cards .summary img { max-width: 100%; } diff --git a/theme/bootstrapbase/templates/block_myoverview/course-action-menu.mustache b/theme/bootstrapbase/templates/block_myoverview/course-action-menu.mustache index 5819ea84527..7dfca469616 100644 --- a/theme/bootstrapbase/templates/block_myoverview/course-action-menu.mustache +++ b/theme/bootstrapbase/templates/block_myoverview/course-action-menu.mustache @@ -35,24 +35,38 @@ {{#pix}} i/moremenu, core {{/pix}}