MDL-64506 templates: Move BS2 labels to BS4 badges
[moodle.git] / user / templates / status_field.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 core_user/status_field
20     Template for the enrolment status field.
22     Context variables required for this template:
23     * fullname string - The user's full name.
24     * coursename string - The course name.
25     * enrolinstancename string - The enrolment instance name.
26     * status string - The enrolment status.
27     * active boolean - Flag to indicate whether the user has an active enrolment.
28     * suspended boolean - Flag to indicate whether the user is suspended.
29     * notcurrent boolean - Flag to indicate whether the user's enrolment is active, but not current.
30     * timestart string - Optional. The enrolment time start.
31     * timeend string - Optional. The enrolment time end.
32     * timeenrolled string - Optional. The time when the user was enrolled.
33     * enrolactions array - Optional. Array of enrol actions consisting of:
34       * url string - The URL of the enrol action link.
35       * attributes array - The array of attributes for the enrol action link.
36       * icon string - The HTML output for the enrol action icon.
38     Example context (json):
39     {
40         "fullname": "Student John",
41         "coursename": "TC 1",
42         "enrolinstancename": "Manual enrolment",
43         "status": "Active",
44         "active": true,
45         "timestart": "1 January 2017",
46         "timeend": "31 January 2018",
47         "timeenrolled": "31 December 2016",
48         "enrolactions": [
49             {
50                 "url": "#",
51                 "attributes": [
52                     {
53                         "name": "class",
54                         "value": "action-class"
55                     }
56                 ],
57                 "icon": "<i class=\"icon fa fa-cog fa-fw\" aria-hidden=\"true\" title=\"Edit enrolment\" aria-label=\"\"></i>"
58             }
59         ]
60     }
61 }}
62 <div data-fullname="{{fullname}}" data-coursename="{{coursename}}" data-enrolinstancename="{{enrolinstancename}}"
63      data-status="{{status}}" data-timestart="{{timestart}}" data-timeend="{{timeend}}" data-timeenrolled="{{timeenrolled}}">
64     <span class="badge {{#active}}badge-success{{/active}}{{#suspended}}badge-warning{{/suspended}}{{#notcurrent}}badge-secondary{{/notcurrent}}">{{status}}</span>
65     <a data-action="showdetails" href="#" role="button" tabindex="0">{{!
66         }}{{#pix}}docs, core, {{enrolinstancename}}{{/pix}}{{!
67     }}</a>
68     {{#enrolactions}}
69     <a href="{{url}}" role="button" {{#attributes}}{{name}}="{{value}}" {{/attributes}}>{{!
70         }}{{{icon}}}{{!
71     }}</a>
72     {{/enrolactions}}
73 </div>