summaryrefslogtreecommitdiff
path: root/app/helpers/search_helper.rb
diff options
context:
space:
mode:
authorClement Ho <clemmakesapps@gmail.com>2017-08-02 09:27:24 +0000
committerPhil Hughes <me@iamphill.com>2017-08-02 09:27:24 +0000
commit974a04026dd1043981c25e64c9827c3b8d15a927 (patch)
tree6911de2ce71ee949e224b593e5c8b693c4dd0eda /app/helpers/search_helper.rb
parent6f66b19b939560a94cd2e89d94f203948ca2f2fb (diff)
downloadgitlab-ce-974a04026dd1043981c25e64c9827c3b8d15a927.tar.gz
Add filtered search to group issue dashboard
Diffstat (limited to 'app/helpers/search_helper.rb')
-rw-r--r--app/helpers/search_helper.rb16
1 files changed, 12 insertions, 4 deletions
diff --git a/app/helpers/search_helper.rb b/app/helpers/search_helper.rb
index fd7ab59ce64..ae0e0aa3cf9 100644
--- a/app/helpers/search_helper.rb
+++ b/app/helpers/search_helper.rb
@@ -127,15 +127,23 @@ module SearchHelper
end
def search_filter_input_options(type)
- {
+ opts = {
id: "filtered-search-#{type}",
placeholder: 'Search or filter results...',
data: {
- 'project-id' => @project.id,
- 'username-params' => @users.to_json(only: [:id, :username]),
- 'base-endpoint' => project_path(@project)
+ 'username-params' => @users.to_json(only: [:id, :username])
}
}
+
+ if @project.present?
+ opts[:data]['project-id'] = @project.id
+ opts[:data]['base-endpoint'] = project_path(@project)
+ else
+ # Group context
+ opts[:data]['base-endpoint'] = group_canonical_path(@group)
+ end
+
+ opts
end
# Sanitize a HTML field for search display. Most tags are stripped out and the