MDL-72735 core_course: style activity information on view page
[moodle.git] / lib / templates / activity_header.mustache
blob60417a265c050b7701b815fed5e434760679fd91
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/>.
17 {{!
18     @template core/activity_header
20     Activity header template.
22     Context variables required for this template:
23     * title - The title of the activity module
24     * description - The intro for the module
25     * completion - The completion info if available for the the module as acquired via the activity_information method
26     * additional_items - Any additional URL select navigation that needs to show up in the header
28     Example context (json):
29     {
30         "title": "Assignment 1",
31         "description": "The assignment does something",
32         "completion": "<div class='activitycompletion'>Some activity completion criteria</div>",
33         "additional_items": {
34             "id": "url_select_test",
35             "action": "https://example.com/post",
36             "formid": "url_select_form",
37             "sesskey": "sesskey",
38             "label": "core/url_select",
39             "helpicon": {
40                 "title": "Help with something",
41                 "text": "Help with something",
42                 "url": "http://example.org/help",
43                 "linktext": "",
44                 "icon":{
45                     "extraclasses": "iconhelp",
46                     "attributes": [
47                         {"name": "src", "value": "../../../pix/help.svg"},
48                         {"name": "alt", "value": "Help icon"}
49                     ]
50                 }
51             },
52             "showbutton": "Go",
53             "options": [{
54                 "name": "Group 1", "isgroup": true, "options":
55                 [
56                     {"name": "Item 1", "isgroup": false, "value": "1"},
57                     {"name": "Item 2", "isgroup": false, "value": "2"}
58                 ]},
59                 {"name": "Group 2", "isgroup": true, "options":
60                 [
61                     {"name": "Item 3", "isgroup": false, "value": "3"},
62                     {"name": "Item 4", "isgroup": false, "value": "4"}
63                 ]}],
64             "disabled": false,
65             "title": "Some cool title"
66         }
67     }
69 <span id="maincontent"></span>
70 {{#title}}
71     <h2>{{{title}}}</h2>
72 {{/title}}
73 <div class="activity-header">
74     {{#completion}}
75         <span class="sr-only">{{#str}} overallaggregation, completion {{/str}}</span>
76         {{{completion}}}
77     {{/completion}}
78     {{#description}}
79         <div class="activity-description small" id="intro">
80             {{{description}}}
81         </div>
82     {{/description}}
83 </div>
84 {{#additional_items}}
85     <nav aria-label="{{#str}} additionalcustomnav, core {{/str}}">
86         {{> core/url_select}}
87     </nav>
88 {{/additional_items}}