MDL-69454 core_search: consistent backup search

This commit is contained in:
Bas Brands 2020-09-09 12:04:31 +02:00
parent 702d1ed5f8
commit eb9935c909
4 changed files with 29 additions and 39 deletions

View File

@ -720,7 +720,7 @@ class core_backup_renderer extends plugin_renderer_base {
public function render_restore_course_search(restore_course_search $component) {
$url = $component->get_url();
$output = html_writer::start_tag('div', array('class' => 'restore-course-search form-inline mb-1'));
$output = html_writer::start_tag('div', array('class' => 'restore-course-search mb-1'));
$output .= html_writer::start_tag('div', array('class' => 'rcs-results table-sm w-75'));
$table = new html_table();
@ -759,22 +759,14 @@ class core_backup_renderer extends plugin_renderer_base {
$output .= html_writer::table($table);
$output .= html_writer::end_tag('div');
$output .= html_writer::start_tag('div', array('class' => 'rcs-search'));
$attrs = array(
'type' => 'text',
'name' => restore_course_search::$VAR_SEARCH,
'value' => $component->get_search(),
'class' => 'form-control'
);
$output .= html_writer::empty_tag('input', $attrs);
$attrs = array(
'type' => 'submit',
'name' => 'searchcourses',
'value' => get_string('search'),
'class' => 'btn btn-secondary'
);
$output .= html_writer::empty_tag('input', $attrs);
$output .= html_writer::end_tag('div');
$data = [
'inform' => true,
'extraclasses' => 'rcs-search mb-3 w-25',
'inputname' => restore_course_search::$VAR_SEARCH,
'searchstring' => get_string('searchcourses'),
'query' => $component->get_search(),
];
$output .= $this->output->render_from_template('core/search_input', $data);
$output .= html_writer::end_tag('div');
return $output;
@ -880,7 +872,7 @@ class core_backup_renderer extends plugin_renderer_base {
public function render_restore_category_search(restore_category_search $component) {
$url = $component->get_url();
$output = html_writer::start_tag('div', array('class' => 'restore-course-search form-inline mb-1'));
$output = html_writer::start_tag('div', array('class' => 'restore-course-search mb-1'));
$output .= html_writer::start_tag('div', array('class' => 'rcs-results table-sm w-75'));
$table = new html_table();
@ -922,22 +914,14 @@ class core_backup_renderer extends plugin_renderer_base {
$output .= html_writer::table($table);
$output .= html_writer::end_tag('div');
$output .= html_writer::start_tag('div', array('class' => 'rcs-search'));
$attrs = array(
'type' => 'text',
'name' => restore_category_search::$VAR_SEARCH,
'value' => $component->get_search(),
'class' => 'form-control'
);
$output .= html_writer::empty_tag('input', $attrs);
$attrs = array(
'type' => 'submit',
'name' => 'searchcourses',
'value' => get_string('search'),
'class' => 'btn btn-secondary'
);
$output .= html_writer::empty_tag('input', $attrs);
$output .= html_writer::end_tag('div');
$data = [
'inform' => true,
'extraclasses' => 'rcs-search mb-3 w-25',
'inputname' => restore_category_search::$VAR_SEARCH,
'searchstring' => get_string('search'),
'query' => $component->get_search(),
];
$output .= $this->output->render_from_template('core/search_input', $data);
$output .= html_writer::end_tag('div');
return $output;

View File

@ -24,6 +24,7 @@
"action": "https://moodle.local/admin/search.php",
"extraclasses": "my-2",
"inputname": "search",
"inform": false,
"searchstring": "Search settings",
"value": "policy",
"btnclass": "primary",
@ -37,7 +38,9 @@
}
}}
<div class="simplesearchform {{{ extraclasses }}}">
{{^inform}}
<form autocomplete="off" action="{{{ action }}}" method="get" accept-charset="utf-8" class="mform form-inline simplesearchform">
{{/inform}}
{{#hiddenfields}}
<input type="hidden" name="{{ name }}" value="{{ value }}">
{{/hiddenfields}}
@ -61,9 +64,12 @@
<span class="sr-only">{{{ searchstring }}}</span>
</button>
</div>
</div>
{{#otherfields}}
<div class="ml-2">{{{ otherfields }}}</div>
{{/otherfields}}
</form>
{{^inform}}
</form>
{{/inform}}
</div>

View File

@ -16202,7 +16202,7 @@ body.path-question-type .mform fieldset.hidden {
margin: 0; }
.simplesearchform .btn-submit {
border-color: #ced4da;
border-color: #8f959e;
color: #6c757d; }
.simplesearchform .btn-close,
@ -16249,7 +16249,7 @@ body.path-question-type .mform fieldset.hidden {
margin-right: auto; } }
.navbar.navbar-light .simplesearchform .btn-open {
color: rgba(0, 0, 0, 0.5); }
color: rgba(0, 0, 0, 0.6); }
.navbar.navbar-light .simplesearchform .btn-open:hover {
color: rgba(0, 0, 0, 0.9); }

View File

@ -16427,7 +16427,7 @@ body.path-question-type .mform fieldset.hidden {
margin: 0; }
.simplesearchform .btn-submit {
border-color: #ced4da;
border-color: #8f959e;
color: #6c757d; }
.simplesearchform .btn-close,
@ -16474,7 +16474,7 @@ body.path-question-type .mform fieldset.hidden {
margin-right: auto; } }
.navbar.navbar-light .simplesearchform .btn-open {
color: rgba(0, 0, 0, 0.5); }
color: rgba(0, 0, 0, 0.6); }
.navbar.navbar-light .simplesearchform .btn-open:hover {
color: rgba(0, 0, 0, 0.9); }