MDL-60179 core: make it clear what enrolment instance is being edited
[moodle.git] / user / templates / status_field.mustache
blob0a594286f1110e370371c781af340d37878e9386
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_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     * enrolactions array - Optional. Array of enrol actions consisting of:
33       * url string - The URL of the enrol action link.
34       * attributes array - The array of attributes for the enrol action link.
35       * icon string - The HTML output for the enrol action icon.
37     Example context (json):
38     {
39         "fullname": "Student John",
40         "coursename": "TC 1",
41         "enrolinstancename": "Manual enrolment",
42         "status": "Active",
43         "active": true,
44         "timestart": "1 January 2017",
45         "timeend": "31 January 2018",
46         "enrolactions": [
47             {
48                 "url": "#",
49                 "attributes": [
50                     {
51                         "name": "class",
52                         "value": "action-class"
53                     }
54                 ],
55                 "icon": "<i class=\"icon fa fa-cog fa-fw\" aria-hidden=\"true\" title=\"Edit enrolment\" aria-label=\"\"></i>"
56             }
57         ]
58     }
60 <div data-fullname="{{fullname}}" data-coursename="{{coursename}}" data-enrolinstancename="{{enrolinstancename}}"
61      data-status="{{status}}" data-timestart="{{timestart}}" data-timeend="{{timeend}}">
62     <span class="label {{#active}}label-success{{/active}}{{#suspended}}label-warning{{/suspended}}{{#notcurrent}}label-default{{/notcurrent}}">{{status}}</span>
63     <a data-action="showdetails" href="#" role="button" tabindex="0">{{!
64         }}{{#pix}}docs, core, {{enrolinstancename}}{{/pix}}{{!
65     }}</a>
66     {{#enrolactions}}
67     <a href="{{url}}" role="button" {{#attributes}}{{name}}="{{value}}" {{/attributes}}>{{!
68         }}{{{icon}}}{{!
69     }}</a>
70     {{/enrolactions}}
71 </div>