Skip to content

Commit

Permalink
allow range limit and advanced search to install without conflicts
Browse files Browse the repository at this point in the history
  • Loading branch information
tampakis committed Jul 5, 2017
1 parent 0e818da commit 723f147
Showing 1 changed file with 16 additions and 2 deletions.
18 changes: 16 additions & 2 deletions lib/generators/blacklight_advanced_search/install_generator.rb
Original file line number Diff line number Diff line change
Expand Up @@ -33,11 +33,25 @@ def configuration
end

def install_search_history_controller
copy_file "search_history_controller.rb", "app/controllers/search_history_controller.rb"
path = 'app/controllers/search_history_controller.rb'
if File.exist? path
inject_into_file path, after: /include Blacklight::SearchHistory.*$/ do
"\n helper BlacklightAdvancedSearch::RenderConstraintsOverride"
end
else
copy_file 'search_history_controller.rb', path
end
end

def install_saved_searches_controller
copy_file "saved_searches_controller.rb", "app/controllers/saved_searches_controller.rb"
path = 'app/controllers/saved_searches_controller.rb'
if File.exist? path
inject_into_file path, after: /include Blacklight::SavedSearches.*$/ do
"\n helper BlacklightAdvancedSearch::RenderConstraintsOverride"
end
else
copy_file 'saved_searches_controller.rb', path
end
end

def inject_routes
Expand Down

0 comments on commit 723f147

Please sign in to comment.