on-demand release 4.4dev+
[moodle.git] / question / templates / column_header.mustache
blob50558ca47a3b6a720939f01a799f2e8635c38e27
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_question/column_header
20     Displays the <th> header cell for a column in the question bank.
22     Context variables required for this template:
23         * extraclasses: CSS classes to add to the th. E.g. "questionstatus pr-3".
24         * help: (optional, may be omitted) help icon. The structure here needs to be as from help_icon::export_for_template().
26         Other fields vary, depending on whether the column is sortable.
28         Column with plain title, not sortable:
29             * sortable: false
30             * tiptitle: Column name (e.g. "Status")
31             * sorttip: (optional) must be true if tip is present.
32             * tip: (optional) a tool tip to show, if the title needs explanation. E.g. "Select questions for bulk actions".
34         Sortable column, with a single type of sort (e.g. question type)
35             * sortable: true
36             * sortlinks: HTML of the title, in a link to sort by this. E.g. "<a href=\"http:\/\/localhost\/moodle_head\/question\/edit.php?courseid=100000&amp;qbs1=-qbank_viewquestiontype%5Cquestion_type_column&amp;qbs2=qbank_viewquestionname%5Cquestion_name_idnumber_tags_column-name\" title=\"Sort by Question type descending\">\n    T<i class=\"icon fa fa-sort-asc fa-fw iconsort\"  title=\"Ascending\" role=\"img\" aria-label=\"Ascending\"><\/i>\n<\/a>"
38         Sortable column, with an overall title, and multiple sort types (e.g. question name/idnumber)
39             * sortable: true
40             * title: "Question"
41             * sortlinks: Several sort links concatenated. E.g. "<a href=\"http:\/\/localhost\/moodle_head\/question\/edit.php?courseid=100000&amp;qbs1=qbank_viewquestionname%5Cquestion_name_idnumber_tags_column-name&amp;qbs2=qbank_viewquestiontype%5Cquestion_type_column\" title=\"Sort by Question name ascending\">\n    Question name\n<\/a> \/ <a href=\"http:\/\/localhost\/moodle_head\/question\/edit.php?courseid=100000&amp;qbs1=qbank_viewquestionname%5Cquestion_name_idnumber_tags_column-idnumber&amp;qbs2=qbank_viewquestiontype%5Cquestion_type_column&amp;qbs3=qbank_viewquestionname%5Cquestion_name_idnumber_tags_column-name\" title=\"Sort by ID number ascending\">\n    ID number\n<\/a>"
43     Example context (json):
44     {
45         "sortable": false,
46         "extraclasses": "checkbox pr-1",
47         "tiptitle": "<input id=\"qbheadercheckbox\" name=\"qbheadercheckbox\" type=\"checkbox\"  value=\"1\" data-action=\"toggle\" data-toggle=\"master\" data-togglegroup=\"qbank\" data-toggle-selectall=\"Select all\" data-toggle-deselectall=\"Deselect all\"><label for=\"qbheadercheckbox\" class=\"accesshide\">Select all<\/label>",
48         "sorttip": true,
49         "tip": "Select questions for bulk actions",
50         "class": "plugin_class",
51         "name": "plugin_name"
52     }
54 <th class="header align-top {{extraclasses}}"
55     scope="col"
56     data-pluginname="{{class}}"
57     data-name="{{name}}"
58     data-columnid="{{columnid}}"
59     {{#width}}style="width: {{width}};"{{/width}}>
60     <div class="header-container">
61         <div class="header-text">
62         {{#title}}
63             <div class="title mr-1">{{title}}</div>
64         {{/title}}
65         {{^sortable}}
66             {{^sorttip}}
67                 <span class="mr-1">{{tiptitle}}</span>
68             {{/sorttip}}
69             {{#sorttip}}
70                 <span class="mr-1" title="{{tip}}">{{{tiptitle}}}</span>
71             {{/sorttip}}
72         {{/sortable}}
73         {{#help}}
74             {{>core/help_icon}}
75         {{/help}}
76         {{#actionmenu}}{{>core/action_menu}}{{/actionmenu}}
77         </div>
78     </div>
79     {{#sortable}}
80         <div class="sorters">
81             {{{sortlinks}}}
82         </div>
83     {{/sortable}}
84 </th>