From eb9935c90990c6ad32641abe73f83935ea0559f9 Mon Sep 17 00:00:00 2001 From: Bas Brands Date: Wed, 9 Sep 2020 12:04:31 +0200 Subject: [PATCH] MDL-69454 core_search: consistent backup search --- backup/util/ui/renderer.php | 52 ++++++++++------------------- lib/templates/search_input.mustache | 8 ++++- theme/boost/style/moodle.css | 4 +-- theme/classic/style/moodle.css | 4 +-- 4 files changed, 29 insertions(+), 39 deletions(-) diff --git a/backup/util/ui/renderer.php b/backup/util/ui/renderer.php index d5b44ce9189..4a1f187f921 100644 --- a/backup/util/ui/renderer.php +++ b/backup/util/ui/renderer.php @@ -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; diff --git a/lib/templates/search_input.mustache b/lib/templates/search_input.mustache index 5d47c5ee72d..f494a268856 100644 --- a/lib/templates/search_input.mustache +++ b/lib/templates/search_input.mustache @@ -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 @@ } }}
+ {{^inform}}
+ {{/inform}} {{#hiddenfields}} {{/hiddenfields}} @@ -61,9 +64,12 @@ {{{ searchstring }}}
+ {{#otherfields}}
{{{ otherfields }}}
{{/otherfields}} - +{{^inform}} + +{{/inform}} \ No newline at end of file diff --git a/theme/boost/style/moodle.css b/theme/boost/style/moodle.css index ffa370d0d78..b2da8cbc832 100644 --- a/theme/boost/style/moodle.css +++ b/theme/boost/style/moodle.css @@ -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); } diff --git a/theme/classic/style/moodle.css b/theme/classic/style/moodle.css index ff04b5e81af..b6108ccb431 100644 --- a/theme/classic/style/moodle.css +++ b/theme/classic/style/moodle.css @@ -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); } -- 2.43.0