moodle/lib/templates/inplace_editable.mustache
Damyon Wiese f3ecea3af4 MDL-59368 groups: Peer review fixes
* Fix coalesce on postgres.
* The edit icon's alt shows the HTML entities causing
* enrol/tests/behat/add_to_group.feature Contains a '@doit' tag which I assume is there from testing.
* group/classes/output/user_groups_editable.php
** Missing MOODLE_INTERNAL check.
** Unused variables context_system and moodle_exception.
** The PHPDocs for the constructors are wrong.
** export_for_template() returns an array, not stdClass (according to parent docs).
** Change moodle_exception to coding_exception at the beginning.
* group/lib.php
** Missing docs for core_group_inplace_editable().
* user/classes/participants_table.php
** The docs for the class variables $groups, $course and $context need a '\' beforehand as they are in a namespace.
** I would prefer $this->context = $context; and $this->groups = ... to be done at the end of the constructor with the other class variable assignments.
** You could get rid of the class variable courseid if we are setting course and use $this->course->id instead.
** The function col_groups has @param \stdclass $row but it should be $data
* lib/amd/src/form-autocomplete.js and lib/amd/src/inplace_editable.js
** Some issues here CiBot has pointed out.
* lib/classes/output/inplace_editable.php
** @see should be on a new line.
2017-07-12 10:09:09 +08:00

70 lines
2.2 KiB
Plaintext

{{!
This file is part of Moodle - http://moodle.org/
Moodle is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Moodle is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with Moodle. If not, see <http://www.gnu.org/licenses/>.
}}
{{!
@template core/inplace_editable
Displays the value that can be edited inline.
Classes required for JS:
* none
Data attributes required for JS:
* data-inplaceeditable
* data-inplaceeditablelink
* data-component
* data-itemtype
* data-itemid
* data-value
* data-editlabel
* data-type
* data-options
Context variables required for this template:
* none
Example context (json):
{
"displayvalue" : "<a href=\"#\">Moodle</a>",
"value" : "Moodle",
"itemid" : "1",
"component" : "core_unknown",
"itemtype" : "unknown",
"edithint" : "Edit this",
"editlabel" : "New name for this",
"type" : "text",
"options" : "",
"linkeverything": 0
}
}}
{{#component}}
<span class="inplaceeditable inplaceeditable-{{type}}" data-inplaceeditable="1" data-component="{{component}}" data-itemtype="{{itemtype}}" data-itemid="{{itemid}}"
data-value="{{value}}" data-editlabel="{{editlabel}}" data-type="{{type}}" data-options="{{options}}">
{{^ linkeverything }}{{{displayvalue}}}{{/ linkeverything }}
<a href="#" class="quickeditlink" data-inplaceeditablelink="1" title="{{edithint}}">
{{# linkeverything }}{{{displayvalue}}}{{/ linkeverything }}
<span class="quickediticon visibleifjs">{{#pix}}t/editstring,core,{{{edithint}}}{{/pix}}</span>
</a>
</span>
{{#js}}
require(['core/inplace_editable']);
{{/js}}
{{/component}}
{{^component}}
{{{displayvalue}}}
{{/component}}