Commit 97c1a1ef authored by Phil Hughes's avatar Phil Hughes

Updated based on feedback

Changed some variable names
Fixed CHANGELOG entry
parent 7ee5de19
...@@ -4,6 +4,7 @@ v 8.8.0 (unreleased) ...@@ -4,6 +4,7 @@ v 8.8.0 (unreleased)
- Remove future dates from contribution calendar graph. - Remove future dates from contribution calendar graph.
- Fix error when visiting commit builds page before build was updated - Fix error when visiting commit builds page before build was updated
- Add 'l' shortcut to open Label dropdown on issuables and 'i' to create new issue on a project - Add 'l' shortcut to open Label dropdown on issuables and 'i' to create new issue on a project
- Updated search UI
v 8.7.1 (unreleased) v 8.7.1 (unreleased)
- Fix .gitlab-ci.yml parsing issue when hidde job is a template without script definition. !3849 - Fix .gitlab-ci.yml parsing issue when hidde job is a template without script definition. !3849
...@@ -133,7 +134,6 @@ v 8.6.7 ...@@ -133,7 +134,6 @@ v 8.6.7
- Fix persistent XSS vulnerability in `commit_person_link` helper - Fix persistent XSS vulnerability in `commit_person_link` helper
- Fix persistent XSS vulnerability in Label and Milestone dropdowns - Fix persistent XSS vulnerability in Label and Milestone dropdowns
- Fix vulnerability that made it possible to enumerate private projects belonging to group - Fix vulnerability that made it possible to enumerate private projects belonging to group
- Updated search UI
v 8.6.6 v 8.6.6
- Expire the exists cache before deletion to ensure project dir actually exists (Stan Hu). !3413 - Expire the exists cache before deletion to ensure project dir actually exists (Stan Hu). !3413
......
...@@ -6,6 +6,8 @@ class SearchController < ApplicationController ...@@ -6,6 +6,8 @@ class SearchController < ApplicationController
layout 'search' layout 'search'
def show def show
return if params[:search].nil? || params[:search].blank?
if params[:project_id].present? if params[:project_id].present?
@project = Project.find_by(id: params[:project_id]) @project = Project.find_by(id: params[:project_id])
@project = nil unless can?(current_user, :download_code, @project) @project = nil unless can?(current_user, :download_code, @project)
...@@ -16,7 +18,6 @@ class SearchController < ApplicationController ...@@ -16,7 +18,6 @@ class SearchController < ApplicationController
@group = nil unless can?(current_user, :read_group, @group) @group = nil unless can?(current_user, :read_group, @group)
end end
return if params[:search].nil? || params[:search].blank?
@search_term = params[:search] @search_term = params[:search]
@scope = params[:scope] @scope = params[:scope]
...@@ -43,7 +44,7 @@ class SearchController < ApplicationController ...@@ -43,7 +44,7 @@ class SearchController < ApplicationController
Search::GlobalService.new(current_user, params).execute Search::GlobalService.new(current_user, params).execute
end end
@objects = @search_results.objects(@scope, params[:page]) @search_objects = @search_results.objects(@scope, params[:page])
end end
def autocomplete def autocomplete
......
...@@ -20,14 +20,14 @@ module SearchHelper ...@@ -20,14 +20,14 @@ module SearchHelper
end end
def search_entries_info(collection, scope, term) def search_entries_info(collection, scope, term)
if collection.count > 0 return unless collection.count > 0
from = collection.offset_value + 1 from = collection.offset_value + 1
to = collection.offset_value + collection.length to = collection.offset_value + collection.length
count = collection.total_count count = collection.total_count
"Showing #{from} - #{to} of #{count} #{scope.humanize(capitalize: false)} for \"#{term}\"" "Showing #{from} - #{to} of #{count} #{scope.humanize(capitalize: false)} for \"#{term}\""
end end
end
private private
......
- if @objects.empty? - if @search_objects.empty?
= render partial: "search/results/empty" = render partial: "search/results/empty"
- else - else
.gray-content-block .gray-content-block
= search_entries_info @objects, @scope, @search_term = search_entries_info(@search_objects, @scope, @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]}
...@@ -13,9 +13,9 @@ ...@@ -13,9 +13,9 @@
.search-results .search-results
- if @scope == 'projects' - if @scope == 'projects'
.term .term
= render 'shared/projects/list', projects: @objects = render 'shared/projects/list', projects: @search_objects
- else - else
= render partial: "search/results/#{@scope.singularize}", collection: @objects = render partial: "search/results/#{@scope.singularize}", collection: @search_objects
- if @scope != 'projects' - if @scope != 'projects'
= paginate @objects, theme: 'gitlab' = paginate(@search_objects, theme: 'gitlab')
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