Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

allow range limit and advanced search to install without conflicts #80

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion .rubocop_todo.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,6 @@ Layout/AlignParameters:
# Cop supports --auto-correct.
Layout/EmptyLineAfterMagicComment:
Exclude:
- 'lib/generators/blacklight_advanced_search/templates/saved_searches_controller.rb'
- 'lib/generators/blacklight_advanced_search/templates/search_history_controller.rb'

# Offense count: 1
Expand Down
15 changes: 11 additions & 4 deletions lib/generators/blacklight_advanced_search/install_generator.rb
Original file line number Diff line number Diff line change
Expand Up @@ -32,12 +32,19 @@ def configuration
end
end

# Adds advanced search behavior to search history controller
def install_search_history_controller
copy_file "search_history_controller.rb", "app/controllers/search_history_controller.rb"
end
path = 'app/controllers/search_history_controller.rb'

def install_saved_searches_controller
copy_file "saved_searches_controller.rb", "app/controllers/saved_searches_controller.rb"
# If local copy of search history controller exists, add override
if File.exist? path
inject_into_file path, after: /include Blacklight::SearchHistory.*$/ do
"\n helper BlacklightAdvancedSearch::RenderConstraintsOverride"
end
# Otherwise copies search history controller to application
else
copy_file 'search_history_controller.rb', path
end
end

def inject_routes
Expand Down

This file was deleted.