Commit b3af3930 authored by Phil Hughes's avatar Phil Hughes

Started updating search UI

parent 6ff740ff
...@@ -108,6 +108,8 @@ class Dispatcher ...@@ -108,6 +108,8 @@ class Dispatcher
new BuildArtifacts() new BuildArtifacts()
when 'projects:group_links:index' when 'projects:group_links:index'
new GroupsSelect() new GroupsSelect()
when 'search:show'
new SearchDropdowns()
switch path.first() switch path.first()
when 'admin' when 'admin'
......
class @SearchDropdowns
constructor: ->
$('.js-search-group-dropdown').glDropdown(
selectable: true
filterable: true
)
...@@ -11,6 +11,7 @@ ...@@ -11,6 +11,7 @@
.prepend-top-10 { margin-top: 10px } .prepend-top-10 { margin-top: 10px }
.prepend-top-default { margin-top: $gl-padding !important; } .prepend-top-default { margin-top: $gl-padding !important; }
.prepend-top-20 { margin-top: 20px } .prepend-top-20 { margin-top: 20px }
.prepend-left-5 { margin-left: 5px }
.prepend-left-10 { margin-left: 10px } .prepend-left-10 { margin-left: 10px }
.prepend-left-default { margin-left: $gl-padding; } .prepend-left-default { margin-left: $gl-padding; }
.prepend-left-20 { margin-left: 20px } .prepend-left-20 { margin-left: 20px }
......
...@@ -10,17 +10,6 @@ ...@@ -10,17 +10,6 @@
} }
} }
.search-holder {
max-width: 600px;
margin: 0 auto;
margin-bottom: 20px;
input {
border-color: #bbb;
font-weight: bold;
}
}
.search { .search {
margin-right: 10px; margin-right: 10px;
margin-left: 10px; margin-left: 10px;
...@@ -163,3 +152,18 @@ ...@@ -163,3 +152,18 @@
} }
} }
} }
.search-holder {
display: -webkit-flex;
display: flex;
.search-field-holder {
position: relative;
width: 100%;
}
.dropdown-toggle {
width: 160px;
text-align: left;
}
}
...@@ -19,6 +19,16 @@ module SearchHelper ...@@ -19,6 +19,16 @@ module SearchHelper
end end
end end
def search_entries_info(collection)
if collection.count > 0
from = collection.offset_value + 1
to = collection.offset_value + collection.length
count = collection.count
"Showing #{from} - #{to} of #{count} results for All projects: \"#{@search_term}\""
end
end
private private
# Autocomplete results for various settings pages # Autocomplete results for various settings pages
......
.dropdown.inline .dropdown.append-right-5.prepend-left-5
%button.dropdown-toggle.btn.btn-sm{type: 'button', 'data-toggle' => 'dropdown'} %button.dropdown-toggle.btn.js-search-group-dropdown{ type: "button", data: { toggle: "dropdown" } }
%span.light Group: Group:
- if @group.present? - if @group.present?
%strong= @group.name %strong= @group.name
- else - else
Any Any
%b.caret %b.caret
.dropdown-menu.dropdown-select.dropdown-menu-selectable .dropdown-menu.dropdown-select.dropdown-menu-selectable.dropdown-menu-align-right
.dropdown-title .dropdown-title
%span Filter results by group %span Filter results by group
%button.dropdown-title-button.dropdown-menu-close{aria: {label: "Close"}} %button.dropdown-title-button.dropdown-menu-close{ aria: { label: "Close" } }
= icon('times') = icon('times')
= dropdown_filter("Search groups")
.dropdown-content .dropdown-content
%ul %ul
%li %li
...@@ -22,19 +23,20 @@ ...@@ -22,19 +23,20 @@
= link_to search_filter_path(group_id: group.id, project_id: nil), class: ("is-active" if params[:group_id] == group.id.to_s) do = link_to search_filter_path(group_id: group.id, project_id: nil), class: ("is-active" if params[:group_id] == group.id.to_s) do
= group.name = group.name
.dropdown.inline.prepend-left-10.project-filter .dropdown.project-filter.append-right-5.prepend-left-5
%button.dropdown-toggle.btn.btn-sm{type: 'button', 'data-toggle' => 'dropdown'} %button.dropdown-toggle.btn{ type: "button", data: { toggle: "dropdown" } }
%span.light Project: Project:
- if @project.present? - if @project.present?
%strong= @project.name_with_namespace %strong= @project.name_with_namespace
- else - else
Any Any
%b.caret %b.caret
.dropdown-menu.dropdown-select.dropdown-menu-selectable .dropdown-menu.dropdown-select.dropdown-menu-selectable.dropdown-menu-align-right
.dropdown-title .dropdown-title
%span Filter results by project %span Filter results by project
%button.dropdown-title-button.dropdown-menu-close{aria: {label: "Close"}} %button.dropdown-title-button.dropdown-menu-close{aria: {label: "Close"}}
= icon('times') = icon('times')
= dropdown_filter("Search projects")
.dropdown-content .dropdown-content
%ul %ul
%li %li
......
...@@ -4,11 +4,9 @@ ...@@ -4,11 +4,9 @@
= hidden_field_tag :snippets, params[:snippets] = hidden_field_tag :snippets, params[:snippets]
= hidden_field_tag :scope, params[:scope] = hidden_field_tag :scope, params[:scope]
.search-holder.clearfix .search-holder
.input-group .search-field-holder.append-right-5
= search_field_tag :search, params[:search], placeholder: "Search for projects, issues etc", class: "form-control search-text-input", id: "dashboard_search", autofocus: true, spellcheck: false = search_field_tag :search, params[:search], placeholder: "Search for projects, issues etc", class: "form-control search-text-input", id: "dashboard_search", autofocus: true, spellcheck: false
%span.input-group-btn
= button_tag 'Search', class: "btn btn-primary"
- unless params[:snippets].eql? 'true' - unless params[:snippets].eql? 'true'
%br
= render 'filter' if current_user = render 'filter' if current_user
= button_tag 'Search', class: "btn btn-success btn-search prepend-left-5"
...@@ -2,9 +2,7 @@ ...@@ -2,9 +2,7 @@
= render partial: "search/results/empty" = render partial: "search/results/empty"
- else - else
.gray-content-block .gray-content-block
Search results for = search_entries_info @objects
%code
= @search_term
- unless @show_snippets - unless @show_snippets
- if @project - if @project
in project #{link_to @project.name_with_namespace, [@project.namespace.becomes(Namespace), @project]} in project #{link_to @project.name_with_namespace, [@project.namespace.becomes(Namespace), @project]}
...@@ -21,6 +19,3 @@ ...@@ -21,6 +19,3 @@
- if @scope != 'projects' - if @scope != 'projects'
= paginate @objects, theme: 'gitlab' = paginate @objects, theme: 'gitlab'
:javascript
$(".search-results .term").highlight("#{escape_javascript(params[:search])}");
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