1
0
mirror of https://github.com/moodle/moodle.git synced 2025-02-17 14:25:37 +01:00
moodle/mod/data/templates/template_editor.mustache
Laurent David 301c56ae1d MDL-77275 mod_data: Template reset button changes
* Remove the reset button in the sticky footer (template page)
* Add the reset button action in the Action menu
2023-03-13 07:35:44 +01:00

125 lines
4.0 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 mod_data/template_editor
Template editor in the database activity.
Example context (json):
{
"title": "Defines browsing interface for multiple entries",
"sesskey": "XXXXX",
"disableeditor": true,
"url": {},
"usehtmleditor": true,
"toolbar": {
"toolshelp": "Available tags help",
"hastools": true,
"tools": [
{
"name": "Fields",
"tags": [
{
"tag": "[[Checkme]]",
"tagname": "Checkme - [[Checkme]]"
},
{
"tag": "[[Description]]",
"tagname": "Description - [[Description]]"
},
{
"tag": "[[Name]]",
"tagname": "Name - [[Name]]"
}
]
}
]
},
"editors": [
{
"name": "Header",
"fieldname": "listtemplateheader",
"value": ""
},
{
"name": "Repeated entry",
"fieldname": "listtemplate",
"value": "Template content"
},
{
"name": "Footer",
"fieldname": "listtemplatefooter",
"value": ""
}
]
}
}}
<div>{{title}}</div>
<form id="edittemplateform" action="{{{url}}}" method="post">
<input name="sesskey" value="{{sesskey}}" type="hidden" />
<input name="defaultform" type="hidden" value=""/>
<input name="resetall" type="hidden" value=""/>
<div class="d-flex flex-row align-items-center">
{{#toolbar}}
{{> mod_data/template_editor_tools }}
{{/toolbar}}
<div class="d-flex flex-column">
{{#editors}}
<div class="m-1">
<div class="template_heading">
<label for="{{fieldname}}">{{name}}</label>
</div>
<div>
<textarea
id="{{fieldname}}"
name="{{fieldname}}"
class="form-control"
rows="15"
cols="80"
{{#usehtmleditor}}data-fieldtype="editor"{{/usehtmleditor}}
>{{value}}</textarea>
</div>
</div>
{{/editors}}
</div>
</div>
{{#disableeditor}}
<div class="container-fluid mt-4">
<div class="row">
<div class="ml-auto">
<input
type="checkbox"
name="useeditor"
id="useeditor"
value="1"
{{#usehtmleditor}}checked{{/usehtmleditor}}
/>
<label for="useeditor">{{#str}} editorenable, data {{/str}}</label>
</div>
</div>
</div>
{{/disableeditor}}
{{< core/sticky_footer }}
{{$ stickycontent }}
<div>
<input
class="btn btn-primary mx-1"
type="submit"
value="{{#str}} save {{/str}}"
/>
</div>
{{/ stickycontent }}
{{/ core/sticky_footer }}
</form>