Commit 6e1ee1fea6400c3621005f1b79e1b8dab43cd000
1 parent
f1126f49
Exists in
master
and in
4 other branches
made some ui enhancement for search page
Showing
4 changed files
with
43 additions
and
24 deletions
Show diff stats
app/controllers/search_controller.rb
@@ -6,7 +6,8 @@ class SearchController < ApplicationController | @@ -6,7 +6,8 @@ class SearchController < ApplicationController | ||
6 | project_ids = current_user.authorized_projects.map(&:id) | 6 | project_ids = current_user.authorized_projects.map(&:id) |
7 | 7 | ||
8 | if group_id.present? | 8 | if group_id.present? |
9 | - group_project_ids = Group.find(group_id).projects.map(&:id) | 9 | + @group = Group.find(group_id) |
10 | + group_project_ids = @group.projects.map(&:id) | ||
10 | project_ids.select! { |id| group_project_ids.include?(id)} | 11 | project_ids.select! { |id| group_project_ids.include?(id)} |
11 | elsif project_id.present? | 12 | elsif project_id.present? |
12 | project_ids.select! { |id| id == project_id.to_i} | 13 | project_ids.select! { |id| id == project_id.to_i} |
app/views/search/_filter.html.haml
1 | -%fieldset | ||
2 | - %legend Groups: | ||
3 | - .clearfix | ||
4 | - = select_tag 'group_id', options_from_collection_for_select(current_user.authorized_groups, :id, :name, params[:group_id]), prompt: 'All', include_blank: true, class: 'trigger-submit chosen' | ||
5 | - | ||
6 | - | ||
7 | -%fieldset | ||
8 | - %legend Teams: | ||
9 | - .clearfix | ||
10 | - = select_tag 'team_id', options_from_collection_for_select(current_user.authorized_teams, :id, :name, params[:team_id]), prompt: 'All', include_blank: true, class: 'trigger-submit chosen' | ||
11 | - | ||
12 | -%fieldset | ||
13 | - %legend Projects: | ||
14 | - .clearfix | ||
15 | - = select_tag 'project_id', options_from_collection_for_select(current_user.authorized_projects, :id, :name_with_namespace, params[:project_id]), prompt: 'All', include_blank: true, class: 'trigger-submit chosen' | 1 | +.dropdown.inline |
2 | + %a.dropdown-toggle.btn.btn-small{href: '#', "data-toggle" => "dropdown"} | ||
3 | + %i.icon-tags | ||
4 | + %span.light Group: | ||
5 | + - if @group.present? | ||
6 | + %strong= @group.name | ||
7 | + - else | ||
8 | + Any | ||
9 | + %b.caret | ||
10 | + %ul.dropdown-menu | ||
11 | + %li | ||
12 | + = link_to search_path(group_id: nil) do | ||
13 | + Any | ||
14 | + - current_user.authorized_groups.sort_by(&:name).each do |group| | ||
15 | + %li | ||
16 | + = link_to search_path(group_id: group.id, search: params[:search]) do | ||
17 | + = group.name | ||
16 | 18 | ||
19 | +.dropdown.inline.prepend-left-10 | ||
20 | + %a.dropdown-toggle.btn.btn-small{href: '#', "data-toggle" => "dropdown"} | ||
21 | + %i.icon-tags | ||
22 | + %span.light Project: | ||
23 | + - if @project.present? | ||
24 | + %strong= @project.name_with_namespace | ||
25 | + - else | ||
26 | + Any | ||
27 | + %b.caret | ||
28 | + %ul.dropdown-menu | ||
29 | + %li | ||
30 | + = link_to search_path(project_id: nil) do | ||
31 | + Any | ||
32 | + - current_user.authorized_projects.sort_by(&:name_with_namespace).each do |project| | ||
33 | + %li | ||
34 | + = link_to search_path(project_id: project.id, search: params[:search]) do | ||
35 | + = project.name_with_namespace |
app/views/search/show.html.haml
@@ -6,11 +6,9 @@ | @@ -6,11 +6,9 @@ | ||
6 | = search_field_tag :search, params[:search], placeholder: "issue 143", class: "input-xxlarge search-text-input", id: "dashboard_search" | 6 | = search_field_tag :search, params[:search], placeholder: "issue 143", class: "input-xxlarge search-text-input", id: "dashboard_search" |
7 | = hidden_field_tag :search_code, params[:search_code] | 7 | = hidden_field_tag :search_code, params[:search_code] |
8 | = submit_tag 'Search', class: "btn btn-primary wide" | 8 | = submit_tag 'Search', class: "btn btn-primary wide" |
9 | - .clearfix | ||
10 | - .row | ||
11 | - .span3 | ||
12 | - = render 'filter', f: f | ||
13 | - .span9 | ||
14 | - .results | ||
15 | - - if params[:search].present? | ||
16 | - = render 'search/result' | 9 | + .prepend-top-10 |
10 | + = render 'filter', f: f | ||
11 | + | ||
12 | + .results.prepend-top-10 | ||
13 | + - if params[:search].present? | ||
14 | + = render 'search/result' |
features/steps/project/project_search_code.rb
@@ -6,6 +6,7 @@ class ProjectSearchCode < Spinach::FeatureSteps | @@ -6,6 +6,7 @@ class ProjectSearchCode < Spinach::FeatureSteps | ||
6 | When 'I search for term "Welcome to Gitlab"' do | 6 | When 'I search for term "Welcome to Gitlab"' do |
7 | fill_in "search", with: "Welcome to Gitlab" | 7 | fill_in "search", with: "Welcome to Gitlab" |
8 | click_button "Go" | 8 | click_button "Go" |
9 | + click_link 'Repository Code' | ||
9 | end | 10 | end |
10 | 11 | ||
11 | Then 'I should see files from repository containing "Welcome to Gitlab"' do | 12 | Then 'I should see files from repository containing "Welcome to Gitlab"' do |