1 |
efrain |
1 |
{{!
|
|
|
2 |
This file is part of Moodle - http://moodle.org/
|
|
|
3 |
|
|
|
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.
|
|
|
8 |
|
|
|
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.
|
|
|
13 |
|
|
|
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/edit_profile_fields
|
|
|
19 |
|
|
|
20 |
UI for editing profile fields
|
|
|
21 |
|
|
|
22 |
Example context (json):
|
|
|
23 |
{
|
|
|
24 |
"baseurl": "index.php",
|
|
|
25 |
"sesskey": "12345",
|
|
|
26 |
"categories": [
|
|
|
27 |
{
|
|
|
28 |
"id": 1,
|
|
|
29 |
"name": "Cat1",
|
|
|
30 |
"fields": [
|
|
|
31 |
{"id": 1, "name": "Field1", "isfirst": true, "islast": false},
|
|
|
32 |
{"id": 2, "name": "Field2", "isfirst": false, "islast": false},
|
|
|
33 |
{"id": 3, "name": "Field3", "isfirst": false, "islast": true}
|
|
|
34 |
],
|
|
|
35 |
"hasfields": true,
|
|
|
36 |
"isfirst": true,
|
|
|
37 |
"candelete": true
|
|
|
38 |
},
|
|
|
39 |
{
|
|
|
40 |
"id": 2,
|
|
|
41 |
"name": "Cat2",
|
|
|
42 |
"candelete": true
|
|
|
43 |
},
|
|
|
44 |
{
|
|
|
45 |
"id": 3,
|
|
|
46 |
"name": "Cat3",
|
|
|
47 |
"islast": true,
|
|
|
48 |
"candelete": true
|
|
|
49 |
}
|
|
|
50 |
]
|
|
|
51 |
}
|
|
|
52 |
}}
|
|
|
53 |
|
|
|
54 |
<div class="profileeditor mt-3">
|
|
|
55 |
<a tabindex="0" role="button" class="btn btn-sm btn-secondary" data-action="editcategory">
|
|
|
56 |
<svg class="mr-2" width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
|
57 |
<path d="M4.75 6.75V8.25C4.75 9.35457 5.64543 10.25 6.75 10.25H8.25C9.35457 10.25 10.25 9.35457 10.25 8.25V6.75C10.25 5.64543 9.35457 4.75 8.25 4.75H6.75C5.64543 4.75 4.75 5.64543 4.75 6.75Z" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"></path>
|
|
|
58 |
<path d="M14.75 7H19.25" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"></path>
|
|
|
59 |
<path d="M17 4.75L17 9.25" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"></path>
|
|
|
60 |
<path d="M4.75 15.75V17.25C4.75 18.3546 5.64543 19.25 6.75 19.25H8.25C9.35457 19.25 10.25 18.3546 10.25 17.25V15.75C10.25 14.6454 9.35457 13.75 8.25 13.75H6.75C5.64543 13.75 4.75 14.6454 4.75 15.75Z" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"></path>
|
|
|
61 |
<path d="M13.75 15.75V17.25C13.75 18.3546 14.6454 19.25 15.75 19.25H17.25C18.3546 19.25 19.25 18.3546 19.25 17.25V15.75C19.25 14.6454 18.3546 13.75 17.25 13.75H15.75C14.6454 13.75 13.75 14.6454 13.75 15.75Z" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"></path>
|
|
|
62 |
</svg>
|
|
|
63 |
{{#str}}profilecreatecategory, admin{{/str}}
|
|
|
64 |
</a>
|
|
|
65 |
</div>
|
|
|
66 |
|
|
|
67 |
<div class="categorieslist">
|
|
|
68 |
{{#categories}}
|
|
|
69 |
<div data-category-id="{{id}}" id="category-{{id}}" class="mt-2">
|
|
|
70 |
<div>
|
|
|
71 |
<div class="categoryinstance w-100 mt-3 d-inline-flex align-items-center justify-content-between">
|
|
|
72 |
<h4 class="mb-0">
|
|
|
73 |
{{{name}}}
|
|
|
74 |
</h4>
|
|
|
75 |
|
|
|
76 |
<div class="ml-auto">
|
|
|
77 |
<a class="ml-3 btn btn-sm btn-icon btn-info" href="#" data-action="editcategory" data-id="{{id}}" data-name="{{name}}">
|
|
|
78 |
<svg width="24" height="24" fill="none" viewBox="0 0 24 24">
|
|
|
79 |
<path stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="1.5" d="M4.75 19.25L9 18.25L18.2929 8.95711C18.6834 8.56658 18.6834 7.93342 18.2929 7.54289L16.4571 5.70711C16.0666 5.31658 15.4334 5.31658 15.0429 5.70711L5.75 15L4.75 19.25Z"></path>
|
|
|
80 |
<path stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="1.5" d="M19.25 19.25H13.75"></path>
|
|
|
81 |
</svg>
|
|
|
82 |
</a>
|
|
|
83 |
{{#candelete}}
|
|
|
84 |
<a class="btn btn-sm btn-icon btn-danger" href="{{baseurl}}?action=deletecategory&id={{id}}&sesskey={{sesskey}}">
|
|
|
85 |
<svg width="24" height="24" fill="none" viewBox="0 0 24 24">
|
|
|
86 |
<path stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="1.5" d="M6.75 7.75L7.59115 17.4233C7.68102 18.4568 8.54622 19.25 9.58363 19.25H14.4164C15.4538 19.25 16.319 18.4568 16.4088 17.4233L17.25 7.75"></path>
|
|
|
87 |
<path stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="1.5" d="M9.75 7.5V6.75C9.75 5.64543 10.6454 4.75 11.75 4.75H12.25C13.3546 4.75 14.25 5.64543 14.25 6.75V7.5"></path>
|
|
|
88 |
<path stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="1.5" d="M5 7.75H19"></path>
|
|
|
89 |
</svg>
|
|
|
90 |
</a>
|
|
|
91 |
{{/candelete}}
|
|
|
92 |
{{^isfirst}}
|
|
|
93 |
<a class="btn btn-sm btn-icon btn-secondary" href="{{baseurl}}?id={{id}}&action=movecategory&dir=up&sesskey={{sesskey}}">
|
|
|
94 |
<svg width="24" height="24" fill="none" viewBox="0 0 24 24">
|
|
|
95 |
<path stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="1.5" d="M17.25 10.25L12 4.75L6.75 10.25"></path>
|
|
|
96 |
<path stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="1.5" d="M12 19.25V5.75"></path>
|
|
|
97 |
</svg>
|
|
|
98 |
</a>
|
|
|
99 |
{{/isfirst}}
|
|
|
100 |
{{^islast}}
|
|
|
101 |
<a class="btn btn-sm btn-icon btn-secondary" href="{{baseurl}}?id={{id}}&action=movecategory&dir=down&sesskey={{sesskey}}">
|
|
|
102 |
<svg width="24" height="24" fill="none" viewBox="0 0 24 24">
|
|
|
103 |
<path stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="1.5" d="M17.25 13.75L12 19.25L6.75 13.75"></path>
|
|
|
104 |
<path stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="1.5" d="M12 18.25V4.75"></path>
|
|
|
105 |
</svg>
|
|
|
106 |
</a>
|
|
|
107 |
{{/islast}}
|
|
|
108 |
</div>
|
|
|
109 |
|
|
|
110 |
<div class="ml-2">
|
|
|
111 |
{{#addfieldmenu}}{{> core/action_menu}}{{/addfieldmenu}}
|
|
|
112 |
</div>
|
|
|
113 |
</div>
|
|
|
114 |
|
|
|
115 |
</div>
|
|
|
116 |
|
|
|
117 |
<div class="profilefield">
|
|
|
118 |
{{#hasfields}}
|
|
|
119 |
<ul class="rui-profilefield list-group mt-2 mx-0">
|
|
|
120 |
{{#fields}}
|
|
|
121 |
<li class="list-group-item d-inline-flex justidy-content-between align-items-center">
|
|
|
122 |
<h5 class="mb-0">{{{name}}}</h5>
|
|
|
123 |
<div class="ml-auto">
|
|
|
124 |
<a class="btn btn-sm btn-icon btn-info" href="#" data-action="editfield" data-id="{{id}}" data-name="{{name}}">
|
|
|
125 |
<svg width="20" height="20" fill="none" viewBox="0 0 24 24">
|
|
|
126 |
<path stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="1.5" d="M4.75 19.25L9 18.25L18.2929 8.95711C18.6834 8.56658 18.6834 7.93342 18.2929 7.54289L16.4571 5.70711C16.0666 5.31658 15.4334 5.31658 15.0429 5.70711L5.75 15L4.75 19.25Z"></path>
|
|
|
127 |
<path stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="1.5" d="M19.25 19.25H13.75"></path>
|
|
|
128 |
</svg>
|
|
|
129 |
</a>
|
|
|
130 |
<a class="btn btn-sm btn-icon btn-danger" href="{{baseurl}}?action=deletefield&id={{id}}&sesskey={{sesskey}}">
|
|
|
131 |
<svg width="20" height="20" fill="none" viewBox="0 0 24 24">
|
|
|
132 |
<path stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="1.5" d="M6.75 7.75L7.59115 17.4233C7.68102 18.4568 8.54622 19.25 9.58363 19.25H14.4164C15.4538 19.25 16.319 18.4568 16.4088 17.4233L17.25 7.75"></path>
|
|
|
133 |
<path stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="1.5" d="M9.75 7.5V6.75C9.75 5.64543 10.6454 4.75 11.75 4.75H12.25C13.3546 4.75 14.25 5.64543 14.25 6.75V7.5"></path>
|
|
|
134 |
<path stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="1.5" d="M5 7.75H19"></path>
|
|
|
135 |
</svg>
|
|
|
136 |
</a>
|
|
|
137 |
{{^isfirst}}
|
|
|
138 |
<a class="btn btn-sm btn-icon btn-secondary" href="{{baseurl}}?id={{id}}&action=movefield&dir=up&sesskey={{sesskey}}">
|
|
|
139 |
<svg width="20" height="20" fill="none" viewBox="0 0 24 24">
|
|
|
140 |
<path stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="1.5" d="M17.25 10.25L12 4.75L6.75 10.25"></path>
|
|
|
141 |
<path stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="1.5" d="M12 19.25V5.75"></path>
|
|
|
142 |
</svg>
|
|
|
143 |
</a>
|
|
|
144 |
{{/isfirst}}
|
|
|
145 |
{{^islast}}
|
|
|
146 |
<a class="btn btn-sm btn-icon btn-secondary" href="{{baseurl}}?id={{id}}&action=movefield&dir=down&sesskey={{sesskey}}">
|
|
|
147 |
<svg width="20" height="20" fill="none" viewBox="0 0 24 24">
|
|
|
148 |
<path stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="1.5" d="M17.25 13.75L12 19.25L6.75 13.75"></path>
|
|
|
149 |
<path stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="1.5" d="M12 18.25V4.75"></path>
|
|
|
150 |
</svg>
|
|
|
151 |
</a>
|
|
|
152 |
{{/islast}}
|
|
|
153 |
</div>
|
|
|
154 |
</li>
|
|
|
155 |
{{/fields}}
|
|
|
156 |
</ul>
|
|
|
157 |
{{/hasfields}}
|
|
|
158 |
{{^hasfields}}
|
|
|
159 |
<div class="alert alert-warning mt-2">{{#str}}profilenofieldsdefined, admin{{/str}}</div>
|
|
|
160 |
{{/hasfields}}
|
|
|
161 |
</div>
|
|
|
162 |
</div>
|
|
|
163 |
{{/categories}}
|
|
|
164 |
</div>
|
|
|
165 |
|
|
|
166 |
{{#js}}
|
|
|
167 |
require(['core_user/edit_profile_fields'], function(s) {
|
|
|
168 |
s.init();
|
|
|
169 |
});
|
|
|
170 |
{{/js}}
|