Commit c85ac81b authored by Aaron Wells's avatar Aaron Wells Committed by Robert Lyon
Browse files

Styling the "Find friends" search filter better

Bug 1560730: In 15.10, where there are combined text
field & filter-dropdown fields, we use Bootstrap
magic to combine them into one succinct little thing

Change-Id: I8c9756194a60d4505ebb2840718e6b114dd8aaa5
behatnotneeded: Covered by existing tests
(cherry picked from commit b6c6044b)
parent fe8acae4
......@@ -66,25 +66,13 @@ $searchform = array(
),
);
if ($USER->get('institutions')) {
$searchform['elements']['filter'] = array(
'type' => 'select',
'defaultvalue' => $filter,
'title' => get_string('filter'),
'hiddenlabel' => true,
'options' => array(
'all' => get_string('Everyone', 'group'),
'myinstitutions' => get_string('myinstitutions', 'group'),
),
);
}
$searchform['elements']['inputgroup']['elements']['query'] = array(
'type' => 'text',
'title' => get_string('search'),
'hiddenlabel' => true,
'defaultvalue' => $query,
);
$searchform['elements']['inputgroup']['elements']['submit'] = array(
'type' => 'button',
'usebuttontag' => true,
......@@ -92,6 +80,38 @@ $searchform['elements']['inputgroup']['elements']['submit'] = array(
'value' => get_string('search'),
);
// Add institution filter, and combine the search query field and the
// institution filter into one combined element via CSS
if ($USER->get('institutions')) {
unset($searchform['elements']['inputgroup']['title']);
$searchform['elements']['inputgroup']['class'] = 'dropdown-group js-dropdown-group';
$searchform['elements']['inputgroup']['elements']['query']['title'] .= ': ';
$searchform['elements']['inputgroup']['elements']['query']['hiddenlabel'] = false;
$searchform['elements']['inputgroup']['elements']['query']['class'] = 'with-dropdown js-with-dropdown';
// Move the submit button outside the inputgroup
unset($searchform['elements']['inputgroup']['elements']['submit']);
$searchform['elements']['submit'] = array(
'type' => 'submit',
'class' => 'btn-primary no-label',
'value' => get_string('search')
);
// Insert the filter into the inputgroup, after the query element
$searchform['elements']['inputgroup']['elements']['filter'] = array(
'title' => get_string('filter') . ': ',
'hiddenlabel' => false,
'type' => 'select',
'class' => 'dropdown-connect js-dropdown-connect',
'options' => array(
'all' => get_string('Everyone', 'group'),
'myinstitutions' => get_string('myinstitutions', 'group'),
),
'defaultvalue' => $filter,
);
}
$searchform = pieform($searchform);
$js = <<< EOF
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment