From 974a04026dd1043981c25e64c9827c3b8d15a927 Mon Sep 17 00:00:00 2001 From: Clement Ho Date: Wed, 2 Aug 2017 09:27:24 +0000 Subject: Add filtered search to group issue dashboard --- app/helpers/search_helper.rb | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) (limited to 'app/helpers/search_helper.rb') 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 -- cgit v1.2.1