mirror of
https://github.com/moodle/moodle.git
synced 2025-08-06 17:36:38 +02:00
MDL-55495 output: Make url_select a templatable
Part of MDL-55071
This commit is contained in:
parent
8a47abcd8a
commit
f1b34660ed
3 changed files with 209 additions and 1 deletions
|
@ -30,6 +30,7 @@ use action_menu;
|
|||
use help_icon;
|
||||
use single_select;
|
||||
use paging_bar;
|
||||
use url_select;
|
||||
|
||||
defined('MOODLE_INTERNAL') || die;
|
||||
|
||||
|
@ -297,4 +298,13 @@ class core_renderer extends \core_renderer {
|
|||
return $this->render_from_template('core/paging_bar', $pagingbar->export_for_template($this));
|
||||
}
|
||||
|
||||
/**
|
||||
* Renders a url select.
|
||||
*
|
||||
* @param url_select $select The object.
|
||||
* @return string HTML
|
||||
*/
|
||||
protected function render_url_select(url_select $select) {
|
||||
return $this->render_from_template('core/url_select', $select->export_for_template($this));
|
||||
}
|
||||
}
|
||||
|
|
49
theme/noname/templates/core/url_select.mustache
Normal file
49
theme/noname/templates/core/url_select.mustache
Normal file
|
@ -0,0 +1,49 @@
|
|||
<div class="{{classes}}">
|
||||
<form method="post" action="{{action}}" class="form-inline" id="{{formid}}">
|
||||
<input type="hidden" name="sesskey" value="{{sesskey}}">
|
||||
<div class="form-group">
|
||||
{{#label}}
|
||||
<label for="{{id}}" {{#labelattributes}}{{name}}="{{value}}" {{/labelattributes}}>
|
||||
{{label}}
|
||||
</label>
|
||||
{{/label}}
|
||||
{{#helpicon}}
|
||||
{{>core/help_icon}}
|
||||
{{/helpicon}}
|
||||
<select {{#attributes}}{{name}}="{{value}}" {{/attributes}} id="{{id}}" class="form-control {{classes}}" name="jump">
|
||||
{{#options}}
|
||||
{{#isgroup}}
|
||||
<optgroup label="{{name}}">
|
||||
{{#options}}
|
||||
<option value="{{value}}" {{#selected}}selected{{/selected}}>{{name}}</option>
|
||||
{{/options}}
|
||||
</optgroup>
|
||||
{{/isgroup}}
|
||||
{{^isgroup}}
|
||||
<option value="{{value}}" {{#selected}}selected{{/selected}}>{{name}}</option>
|
||||
{{/isgroup}}
|
||||
{{/options}}
|
||||
</select>
|
||||
</div>
|
||||
{{#showbutton}}
|
||||
<button type="submit" class="btn btn-secondary">{{showbutton}}</button>
|
||||
{{/showbutton}}
|
||||
{{^showbutton}}
|
||||
<noscript>
|
||||
<button type="submit" class="btn btn-secondary">{{#str}}go, core{{/str}}</button>
|
||||
</noscript>
|
||||
{{/showbutton}}
|
||||
</form>
|
||||
</div>
|
||||
{{^showbutton}}
|
||||
{{#js}}
|
||||
require(['core/yui'], function(Y) {
|
||||
Y.use('moodle-core-formautosubmit', function() {
|
||||
M.core.init_formautosubmit({
|
||||
selectid: '{{id}}',
|
||||
nothing: {{#hasnothing}}'{{nothingkey}}'{{/hasnothing}}{{^hasnothing}}false{{/hasnothing}}
|
||||
});
|
||||
});
|
||||
});
|
||||
{{/js}}
|
||||
{{/showbutton}}
|
Loading…
Add table
Add a link
Reference in a new issue