Merge branch 'MDL-64855-37_block_myoverview_course_category_display' of https://githu...
[moodle.git] / blocks / myoverview / templates / view-summary.mustache
1 {{!
2     This file is part of Moodle - http://moodle.org/
4     Moodle is free software: you can redistribute it and/or modify
5     it under the terms of the GNU General Public License as published by
6     the Free Software Foundation, either version 3 of the License, or
7     (at your option) any later version.
9     Moodle is distributed in the hope that it will be useful,
10     but WITHOUT ANY WARRANTY; without even the implied warranty of
11     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12     GNU General Public License for more details.
14     You should have received a copy of the GNU General Public License
15     along with Moodle.  If not, see <http://www.gnu.org/licenses/>.
16 }}
17 {{!
18     @template block_myoverview/view-summary
20     This template renders the list view for the myoverview block.
22     Example context (json):
23     {
24         "courses": [
25             {
26                 "name": "Assignment due 1",
27                 "viewurl": "https://moodlesite/course/view.php?id=2",
28                 "courseimage": "https://moodlesite/pluginfile/123/course/overviewfiles/123.jpg",
29                 "fullname": "course 3",
30                 "summary": "This course is about assignments",
31                 "hasprogress": true,
32                 "progress": 10,
33                 "coursecategory": "Miscellaneous"
34             }
35         ]
36     }
37 }}
38 <div role="list">
39 {{#courses}}
40     <div class="course-summaryitem mb-1 p-2" role="listitem"
41         data-region="course-content"
42         data-course-id="{{{id}}}">
43         <div class="d-flex">
44             <a href="{{viewurl}}" tabindex="-1">
45                 <div class="summaryimage rounded-circle mr-1" style='background-image: url("{{{courseimage}}}");'>
46                     <span class="sr-only">{{#str}}aria:courseimage, core_course{{/str}}</span>
47                 </div>
48             </a>
50             <div class="align-self-stretch d-flex flex-column w-100">
51                 <div class="d-flex mb-1">
52                     <a href="{{viewurl}}" class="coursename">
53                         <div class="text-muted muted mb-1 d-flex" style="flex-flow:wrap;">
54                             <span class="sr-only">
55                                 {{#str}}aria:coursecategory, core_course{{/str}}
56                             </span>
57                             {{#displaycategories}}
58                                 <div>{{{coursecategory}}}</div>
59                             {{/displaycategories}}
60                             {{#showshortname}}
61                             <div class="pl-1 pr-1">|</div>
62                             <span class="sr-only">
63                                 {{#str}}aria:courseshortname, core_course{{/str}}
64                             </span>
65                             <div>{{{shortname}}}</div>
66                             {{/showshortname}}
67                         </div>
68                         {{> core_course/favouriteicon }}
69                         <span class="sr-only">
70                             {{#str}}aria:coursename, core_course{{/str}}
71                         </span>
72                         <h6 class="d-inline h5">{{{fullname}}}</h6>
73                     </a>
74                     {{> block_myoverview/course-action-menu }}
75                 </div>
76                 <div class="summary">
77                     <span class="sr-only">{{#str}}aria:coursesummary, block_myoverview{{/str}}</span>
78                     {{{summary}}}
79                 </div>
80                 <div class="ml-auto mt-auto w-50 p-t-1">
81                     {{#hasprogress}}
82                         {{> block_myoverview/progress-bar}}
83                     {{/hasprogress}}
84                 </div>
85             </div>
86         </div>
87     </div>
88 {{/courses}}
89 </div>