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 {
.search-holder {
@include media-breakpoint-up(sm) {
display: flex;
align-items: flex-end;
}
.search-field-holder,
......
......@@ -3,9 +3,10 @@
- if params[:project_id].present?
= hidden_field_tag :project_id, params[:project_id]
.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
= _("Group:")
- if @group.present?
= @group.name
- else
......@@ -18,9 +19,10 @@
= dropdown_loading
.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
= _("Project:")
- if @project.present?
= @project.full_name
- else
......
......@@ -3,7 +3,10 @@
= hidden_field_tag :scope, params[:scope]
.search-holder
.search-field-holder
.search-field-holder.form-group
%label{ for: "dashboard_search" }
= _("What are you searching for?")
.position-relative
= 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
= icon("search", class: "search-icon")
%button.search-clear.js-search-clear{ class: ("hidden" if !params[:search].present?), type: "button", tabindex: "-1" }
......@@ -12,5 +15,6 @@
= _("Clear search")
- unless params[:snippets].eql? 'true'
= render 'filter'
= button_tag _("Search"), class: "btn btn-success btn-search"
.d-flex-center.flex-column.flex-lg-row
= button_tag _("Search"), class: "btn btn-success btn-search form-control"
= render_if_exists 'search/form_elasticsearch'
......@@ -5260,9 +5260,6 @@ msgstr ""
msgid "Group was successfully updated."
msgstr ""
msgid "Group:"
msgstr ""
msgid "Group: %{group_name}"
msgstr ""
......@@ -8486,9 +8483,6 @@ msgstr ""
msgid "Project visibility level will be changed to match namespace rules when transferring to a group."
msgstr ""
msgid "Project:"
msgstr ""
msgid "ProjectActivityRSS|Subscribe"
msgstr ""
......@@ -12437,6 +12431,9 @@ msgstr ""
msgid "Welcome to your Issue Board!"
msgstr ""
msgid "What are you searching for?"
msgstr ""
msgid "When a runner is locked, it cannot be assigned to other projects"
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