mirror of
https://github.com/moodle/moodle.git
synced 2025-08-05 00:46:50 +02:00
MDL-69454 core_search: consistent mod searches
This commit is contained in:
parent
411cf64738
commit
4c71e1d0d0
6 changed files with 103 additions and 58 deletions
|
@ -63,11 +63,16 @@ class quick_search_form implements renderable, templatable {
|
|||
}
|
||||
|
||||
public function export_for_template(renderer_base $output) {
|
||||
$hiddenfields = [
|
||||
(object) ['name' => 'id', 'value' => $this->courseid],
|
||||
];
|
||||
$data = [
|
||||
'actionurl' => $this->actionurl->out(false),
|
||||
'courseid' => $this->courseid,
|
||||
'action' => $this->actionurl->out(false),
|
||||
'hiddenfields' => $hiddenfields,
|
||||
'query' => $this->query,
|
||||
'helpicon' => $this->helpicon->export_for_template($output),
|
||||
'inputname' => 'search',
|
||||
'searchstring' => get_string('searchforums', 'mod_forum')
|
||||
];
|
||||
return $data;
|
||||
}
|
||||
|
|
|
@ -21,27 +21,14 @@
|
|||
|
||||
Example context (json):
|
||||
{
|
||||
"actionurl": "https://domain.example/mod/forum/search.php",
|
||||
"courseid": "2",
|
||||
"action": "https://domain.example/mod/forum/search.php",
|
||||
"helpicon": "<a class='btn'><i class='icon fa fa-question-circle'></i></a>",
|
||||
"query": "find this post"
|
||||
"query": "find this post",
|
||||
"inputname": "search"
|
||||
}
|
||||
}}
|
||||
<div class="forumsearch">
|
||||
<form action="{{actionurl}}" class="form-inline">
|
||||
<input type="hidden" name="id" value="{{courseid}}">
|
||||
<div class="input-group">
|
||||
<div class="input-group-prepend">
|
||||
{{#helpicon}}
|
||||
{{>core/help_icon}}
|
||||
{{/helpicon}}
|
||||
</div>
|
||||
<label class="sr-only" for="search">{{#str}}search, forum{{/str}}</label>
|
||||
<input id="search" name="search" type="text" class="form-control" value="{{query}}">
|
||||
<div class="input-group-append">
|
||||
<button class="btn btn-secondary" id="searchforums" type="submit">{{#str}}searchforums, mod_forum{{/str}}</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</form>
|
||||
</div>
|
||||
{{#helpicon}}
|
||||
{{>core/help_icon}}
|
||||
{{/helpicon}}
|
||||
{{< core/search_input }}
|
||||
{{/ core/search_input }}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue