Skip to content

Commit

Permalink
MDL-65901 forum: Style advanced search form properly.
Browse files Browse the repository at this point in the history
  • Loading branch information
lucaboesch committed Jun 27, 2019
1 parent 7ec1804 commit 242dad0
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 30 deletions.
2 changes: 1 addition & 1 deletion lib/templates/select_time.mustache
Expand Up @@ -31,7 +31,7 @@
}
}}
<label for="{{id}}" class="sr-only">{{label}}</label>
<select name="{{name}}" id="{{id}}"{{#attributes}} {{name}}="{{value}}"{{/attributes}} class="form-control">
<select name="{{name}}" id="{{id}}"{{#attributes}} {{name}}="{{value}}"{{/attributes}} class="form-control custom-select">
{{#options}}
<option value="{{value}}" {{#selected}}selected{{/selected}}>{{name}}</option>
{{/options}}
Expand Down
24 changes: 13 additions & 11 deletions mod/forum/classes/output/big_search_form.php
Expand Up @@ -214,17 +214,19 @@ public function export_for_template(renderer_base $output) {
$dateto = time() + HOURSECS;
}

$data->datefromfields = html_writer::select_time('days', 'fromday', $datefrom)
. html_writer::select_time('months', 'frommonth', $datefrom)
. html_writer::select_time('years', 'fromyear', $datefrom)
. html_writer::select_time('hours', 'fromhour', $datefrom)
. html_writer::select_time('minutes', 'fromminute', $datefrom);

$data->datetofields = html_writer::select_time('days', 'today', $dateto)
. html_writer::select_time('months', 'tomonth', $dateto)
. html_writer::select_time('years', 'toyear', $dateto)
. html_writer::select_time('hours', 'tohour', $dateto)
. html_writer::select_time('minutes', 'tominute', $dateto);
$data->datefromfields = html_writer::div(html_writer::select_time('days', 'fromday', $datefrom), 'form-group fitem ml-2')
. html_writer::div(html_writer::select_time('months', 'frommonth', $datefrom),
'form-group fitem ml-2')
. html_writer::div(html_writer::select_time('years', 'fromyear', $datefrom), 'form-group fitem ml-2')
. html_writer::div(html_writer::select_time('hours', 'fromhour', $datefrom), 'form-group fitem ml-2')
. html_writer::div(html_writer::select_time('minutes', 'fromminute', $datefrom),
'form-group fitem ml-2');

$data->datetofields = html_writer::div(html_writer::select_time('days', 'today', $dateto), 'form-group fitem ml-2')
. html_writer::div(html_writer::select_time('months', 'tomonth', $dateto), 'form-group fitem ml-2')
. html_writer::div(html_writer::select_time('years', 'toyear', $dateto), 'form-group fitem ml-2')
. html_writer::div(html_writer::select_time('hours', 'tohour', $dateto), 'form-group fitem ml-2')
. html_writer::div(html_writer::select_time('minutes', 'tominute', $dateto), 'form-group fitem ml-2');

if ($this->forumid && !empty($this->forumoptions)) {
foreach ($this->forumoptions as $index => $option) {
Expand Down
40 changes: 22 additions & 18 deletions mod/forum/templates/big_search_form.mustache
Expand Up @@ -51,10 +51,10 @@
{{#str}}searchforumintro, forum{{/str}}
</div>
<div class="box generalbox boxaligncenter">
<form id="searchform" action="{{actionurl}}" method="get">
<form id="searchform" class="mform" action="{{actionurl}}" method="get">
<table class="searchbox table table-striped" id="form">
<tr>
<td class="c0 text-xs-right">
<td class="c0 text-xs-right align-bottom">
<label for="words">{{#str}}searchwords, forum{{/str}}</label>
<input type="hidden" value="{{courseid}}" name="id">
</td>
Expand All @@ -63,15 +63,15 @@
</td>
</tr>
<tr>
<td class="c0 text-xs-right">
<td class="c0 text-xs-right align-bottom">
<label for="phrase">{{#str}}searchphrase, forum{{/str}}</label>
</td>
<td class="c1">
<input type="text" class="form-control" name="phrase" id="phrase" value="{{phrase}}">
</td>
</tr>
<tr>
<td class="c0 text-xs-right">
<td class="c0 text-xs-right align-bottom">
<label for="notwords">{{#str}}searchnotwords, forum{{/str}}</label>
</td>
<td class="c1">
Expand All @@ -80,7 +80,7 @@
</tr>
{{#showfullwords}}
<tr>
<td class="c0 text-xs-right">
<td class="c0 text-xs-right align-bottom">
<label for="fullwords">{{#str}}searchfullwords, forum{{/str}}</label>
</td>
<td class="c1">
Expand All @@ -89,12 +89,14 @@
</tr>
{{/showfullwords}}
<tr>
<td class="c0 text-xs-right">
{{#str}}searchdatefrom, forum{{/str}}
<td class="c0 text-xs-right align-bottom">
<label for="timefromrestrict">{{#str}}searchdatefrom, forum{{/str}}</label>
</td>
<td class="c1 text-nowrap form-inline">
<input type="checkbox" name="timefromrestrict" value="1" {{#datefromchecked}}checked{{/datefromchecked}}>
{{{datefromfields}}}
<div class="fdate_time_selector d-flex flex-wrap align-items-center">
<input type="checkbox" name="timefromrestrict" value="1" {{#datefromchecked}}checked{{/datefromchecked}}>
{{{datefromfields}}}
</div>
<input type="hidden" name="hfromday" value="0">
<input type="hidden" name="hfrommonth" value="0">
<input type="hidden" name="hfromyear" value="0">
Expand All @@ -103,12 +105,14 @@
</td>
</tr>
<tr>
<td class="c0 text-xs-right">
{{#str}}searchdateto, forum{{/str}}
<td class="c0 text-xs-right align-bottom">
<label for="timetorestrict">{{#str}}searchdateto, forum{{/str}}</label>
</td>
<td class="c1 text-nowrap form-inline">
<input type="checkbox" name="timetorestrict" value="1" {{#datetochecked}}checked{{/datetochecked}}>
{{{datetofields}}}
<div class="fdate_time_selector d-flex flex-wrap align-items-center">
<input type="checkbox" name="timetorestrict" value="1" {{#datetochecked}}checked{{/datetochecked}}>
{{{datetofields}}}
</div>
<input type="hidden" name="htoday" value="0">
<input type="hidden" name="htomonth" value="0">
<input type="hidden" name="htoyear" value="0">
Expand All @@ -117,27 +121,27 @@
</td>
</tr>
<tr>
<td class="c0 text-xs-right">
<td class="c0 text-xs-right align-bottom">
<label for="menuforumid">{{#str}}searchwhichforums, forum{{/str}}</label>
</td>
<td class="c1">
<select name="forumid" id="menuforumid" class="form-control">
<select name="forumid" id="menuforumid" class="form-control custom-select">
{{#forumoptions}}
<option value="{{value}}" {{#selected}}selected{{/selected}}>{{name}}</option>
{{/forumoptions}}
</select>
</td>
</tr>
<tr>
<td class="c0 text-xs-right">
<td class="c0 text-xs-right align-bottom">
<label for="subject">{{#str}}searchsubject, forum{{/str}}</label>
</td>
<td class="c1">
<input type="text" class="form-control" name="subject" id="subject" value="{{subject}}">
</td>
</tr>
<tr>
<td class="c0 text-xs-right">
<td class="c0 text-xs-right align-bottom">
<label for="user">{{#str}}searchuser, forum{{/str}}</label>
</td>
<td class="c1">
Expand All @@ -147,7 +151,7 @@
{{#tagsenabled}}
<tr>
<td class="c0">
<label for="tags">{{#str}}searchtags, forum{{/str}}</label>
<label for="tags" class="mt-1">{{#str}}searchtags, forum{{/str}}</label>
</td>
<td class="c1">
<select class="custom-select" name="tags[]"
Expand Down

0 comments on commit 242dad0

Please sign in to comment.