Commit 5b5fc580 authored by Denys Mishunov's avatar Denys Mishunov

Properly labelling fields on Search page

Adding proper <label>s while removing labels from the fields themselves.
This gives more space for the field's content
parent 4bb8a4e3
...@@ -189,6 +189,7 @@ input[type='checkbox']:hover { ...@@ -189,6 +189,7 @@ input[type='checkbox']:hover {
.search-holder { .search-holder {
@include media-breakpoint-up(sm) { @include media-breakpoint-up(sm) {
display: flex; display: flex;
align-items: flex-end;
} }
.search-field-holder, .search-field-holder,
......
...@@ -3,9 +3,10 @@ ...@@ -3,9 +3,10 @@
- if params[:project_id].present? - if params[:project_id].present?
= hidden_field_tag :project_id, params[:project_id] = hidden_field_tag :project_id, params[:project_id]
.dropdown .dropdown
%button.dropdown-menu-toggle.js-search-group-dropdown{ type: "button", data: { toggle: "dropdown", default_label: _('Group:'), group_id: params[:group_id] } } %label{ for: "dashboard_search_group" }
= _("Group")
%button.form-control.dropdown-menu-toggle.js-search-group-dropdown{ type: "button", id: "dashboard_search_group", data: { toggle: "dropdown", group_id: params[:group_id] } }
%span.dropdown-toggle-text %span.dropdown-toggle-text
= _("Group:")
- if @group.present? - if @group.present?
= @group.name = @group.name
- else - else
...@@ -18,9 +19,10 @@ ...@@ -18,9 +19,10 @@
= dropdown_loading = dropdown_loading
.dropdown.project-filter .dropdown.project-filter
%button.dropdown-menu-toggle.js-search-project-dropdown{ type: "button", data: { toggle: "dropdown", default_label: _('Project:') } } %label{ for: "dashboard_search_project" }
= _("Project")
%button.form-control.dropdown-menu-toggle.js-search-project-dropdown{ type: "button", id: "dashboard_search_project", data: { toggle: "dropdown"} }
%span.dropdown-toggle-text %span.dropdown-toggle-text
= _("Project:")
- if @project.present? - if @project.present?
= @project.full_name = @project.full_name
- else - else
......
...@@ -3,14 +3,18 @@ ...@@ -3,14 +3,18 @@
= hidden_field_tag :scope, params[:scope] = hidden_field_tag :scope, params[:scope]
.search-holder .search-holder
.search-field-holder .search-field-holder.form-group
= search_field_tag :search, params[:search], placeholder: _("Search for projects, issues, etc."), class: "form-control search-text-input js-search-input", id: "dashboard_search", autofocus: true, spellcheck: false %label{ for: "dashboard_search" }
= icon("search", class: "search-icon") = _("What are you searching for?")
%button.search-clear.js-search-clear{ class: ("hidden" if !params[:search].present?), type: "button", tabindex: "-1" } .position-relative
= icon("times-circle") = search_field_tag :search, params[:search], placeholder: _("Search for projects, issues, etc."), class: "form-control search-text-input js-search-input", id: "dashboard_search", autofocus: true, spellcheck: false
%span.sr-only = icon("search", class: "search-icon")
= _("Clear search") %button.search-clear.js-search-clear{ class: ("hidden" if !params[:search].present?), type: "button", tabindex: "-1" }
= icon("times-circle")
%span.sr-only
= _("Clear search")
- unless params[:snippets].eql? 'true' - unless params[:snippets].eql? 'true'
= render 'filter' = render 'filter'
= button_tag _("Search"), class: "btn btn-success btn-search" .d-flex-center.flex-column.flex-lg-row
= render_if_exists 'search/form_elasticsearch' = button_tag _("Search"), class: "btn btn-success btn-search form-control"
= render_if_exists 'search/form_elasticsearch'
...@@ -5260,9 +5260,6 @@ msgstr "" ...@@ -5260,9 +5260,6 @@ msgstr ""
msgid "Group was successfully updated." msgid "Group was successfully updated."
msgstr "" msgstr ""
msgid "Group:"
msgstr ""
msgid "Group: %{group_name}" msgid "Group: %{group_name}"
msgstr "" msgstr ""
...@@ -8486,9 +8483,6 @@ msgstr "" ...@@ -8486,9 +8483,6 @@ msgstr ""
msgid "Project visibility level will be changed to match namespace rules when transferring to a group." msgid "Project visibility level will be changed to match namespace rules when transferring to a group."
msgstr "" msgstr ""
msgid "Project:"
msgstr ""
msgid "ProjectActivityRSS|Subscribe" msgid "ProjectActivityRSS|Subscribe"
msgstr "" msgstr ""
...@@ -12437,6 +12431,9 @@ msgstr "" ...@@ -12437,6 +12431,9 @@ msgstr ""
msgid "Welcome to your Issue Board!" msgid "Welcome to your Issue Board!"
msgstr "" msgstr ""
msgid "What are you searching for?"
msgstr ""
msgid "When a runner is locked, it cannot be assigned to other projects" msgid "When a runner is locked, it cannot be assigned to other projects"
msgstr "" msgstr ""
......
# frozen_string_literal: true
require 'spec_helper'
describe 'search/_filter' do
context 'when the search page is opened' do
it 'displays the correct elements' do
render
expect(rendered).to have_selector('label[for="dashboard_search_group"]')
expect(rendered).to have_selector('button#dashboard_search_group')
expect(rendered).to have_selector('label[for="dashboard_search_project"]')
expect(rendered).to have_selector('button#dashboard_search_project')
end
end
end
# frozen_string_literal: true
require 'spec_helper'
describe 'search/_form' do
context 'when the search page is opened' do
it 'displays the correct elements' do
render
expect(rendered).to have_selector('.search-field-holder.form-group')
expect(rendered).to have_selector('label[for="dashboard_search"]')
end
end
end
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