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/inplace_editable
|
|
|
19 |
|
|
|
20 |
Displays the value that can be edited inline.
|
|
|
21 |
|
|
|
22 |
Classes required for JS:
|
|
|
23 |
* none
|
|
|
24 |
|
|
|
25 |
Data attributes required for JS:
|
|
|
26 |
* data-inplaceeditable
|
|
|
27 |
* data-inplaceeditablelink
|
|
|
28 |
* data-component
|
|
|
29 |
* data-itemtype
|
|
|
30 |
* data-itemid
|
|
|
31 |
* data-value
|
|
|
32 |
* data-editlabel
|
|
|
33 |
* data-type
|
|
|
34 |
* data-options
|
|
|
35 |
|
|
|
36 |
Context variables required for this template:
|
|
|
37 |
* none
|
|
|
38 |
|
|
|
39 |
Example context (json):
|
|
|
40 |
{
|
|
|
41 |
"displayvalue" : "<a href=\"#\">Moodle</a>",
|
|
|
42 |
"value" : "Moodle",
|
|
|
43 |
"itemid" : "1",
|
|
|
44 |
"component" : "core_unknown",
|
|
|
45 |
"itemtype" : "unknown",
|
|
|
46 |
"edithint" : "Edit this",
|
|
|
47 |
"editlabel" : "New name for this",
|
|
|
48 |
"type" : "text",
|
|
|
49 |
"options" : "",
|
|
|
50 |
"linkeverything": 0
|
|
|
51 |
}
|
|
|
52 |
}}
|
|
|
53 |
{{#component}}
|
|
|
54 |
<span class="inplaceeditable inplaceeditable-{{type}}" data-inplaceeditable="1" data-component="{{component}}" data-itemtype="{{itemtype}}" data-itemid="{{itemid}}"
|
|
|
55 |
data-value="{{value}}" data-editlabel="{{editlabel}}" data-type="{{type}}" data-options="{{options}}">
|
|
|
56 |
{{^ linkeverything }}{{{displayvalue}}}{{/ linkeverything }}
|
|
|
57 |
<a href="#" class="quickeditlink aalink mx-2" data-inplaceeditablelink="1" title="{{edithint}}">
|
|
|
58 |
{{# linkeverything }}{{{displayvalue}}}{{/ linkeverything }}
|
|
|
59 |
<span class="quickediticon visibleifjs">
|
|
|
60 |
{{#editicon}}{{#pix}}{{key}}, {{component}}, {{{title}}}{{/pix}}{{/editicon}}
|
|
|
61 |
</span>
|
|
|
62 |
</a>
|
|
|
63 |
</span>
|
|
|
64 |
{{#js}}
|
|
|
65 |
require(['core/inplace_editable']);
|
|
|
66 |
{{/js}}
|
|
|
67 |
{{/component}}
|
|
|
68 |
{{^component}}
|
|
|
69 |
{{{displayvalue}}}
|
|
|
70 |
{{/component}}
|
|
|
71 |
|