Skip to content

Commit

Permalink
Removed keyword slug from search via title.
Browse files Browse the repository at this point in the history
  • Loading branch information
farahTW committed Oct 19, 2023
1 parent 615cd02 commit a4f6429
Show file tree
Hide file tree
Showing 5 changed files with 6 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,10 @@ def search
flash.now[:alert] = "Please select a search option"
render :search_options
end
redirect_to(action: :search_title_slug, document_collection_id: @collection, group_id: @group) if params[:search_option] == "title-or-slug"
redirect_to(action: :search_by_title, document_collection_id: @collection, group_id: @group) if params[:search_option] == "title"
end

def search_title_slug
def search_by_title
flash.now[:alert] = "Please enter a search query" if params[:title] && params[:title].empty?
@editions = filter.editions if params[:title].present?
end
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
text: "Search via URL",
},
{
value: "title-or-slug",
value: "title",
text: "Search via title",
},
]
Expand Down
2 changes: 1 addition & 1 deletion config/routes.rb
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ def redirect(path, options = { prefix: Whitehall.router_prefix })
resources :document_collection_groups, as: :groups, path: "groups" do
get :search_options, to: "document_collection_group_document_search#search_options"
post :search_options, to: "document_collection_group_document_search#search"
get :search_title_slug, to: "document_collection_group_document_search#search_title_slug"
get :search_by_title, to: "document_collection_group_document_search#search_by_title"
member { get :confirm_destroy }
resource :document_collection_group_membership,
as: :members,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@ class Admin::LegacyDocumentCollectionGroupDocumentSearchControllerTest < ActionC
assert_template :forbidden
end

test "GET #search_title_slug blocks out users with no permissions" do
get :search_title_slug, params: @request_params
test "GET #search__by_title blocks out users with no permissions" do
get :search_by_title, params: @request_params
assert_template :forbidden
end
end

0 comments on commit a4f6429

Please sign in to comment.