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

Drop support for rails 5.0 #1978

Merged
merged 1 commit into from
Oct 10, 2018
Merged
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
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,9 @@ rails generate blacklight:install

## Dependencies

* Ruby 2.1+
* Ruby 2.2+
* Bundler
* Rails 5.0+
* Rails 5.1+

## Configuring Apache Solr
You'll also want some information about how Blacklight expects [Apache Solr](http://lucene.apache.org/solr ) to run, which you can find in [README_SOLR](https://github.com/projectblacklight/blacklight/wiki/README_SOLR)
Expand Down
12 changes: 2 additions & 10 deletions app/controllers/concerns/blacklight/bookmarks.rb
Original file line number Diff line number Diff line change
Expand Up @@ -90,12 +90,7 @@ def create
flash[:error] = I18n.t('blacklight.bookmarks.add.failure', count: @bookmarks.length)
end

if respond_to? :redirect_back
redirect_back fallback_location: bookmarks_path
else
# Deprecated in Rails 5.0
redirect_to :back
end
redirect_back fallback_location: bookmarks_path
end
end

Expand All @@ -117,11 +112,8 @@ def destroy
if success
if request.xhr?
render(json: { bookmarks: { count: current_or_guest_user.bookmarks.count } })
elsif respond_to? :redirect_back
redirect_back fallback_location: bookmarks_path, notice: I18n.t('blacklight.bookmarks.remove.success')
else
# Deprecated in Rails 5.0
redirect_to :back, notice: I18n.t('blacklight.bookmarks.remove.success')
redirect_back fallback_location: bookmarks_path, notice: I18n.t('blacklight.bookmarks.remove.success')
end
elsif request.xhr?
head 500 # ajaxy request needs no redirect and should not have flash set
Expand Down
7 changes: 1 addition & 6 deletions app/controllers/concerns/blacklight/search_history.rb
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,7 @@ def clear
flash[:error] = I18n.t('blacklight.search_history.clear.failure')
end

if respond_to? :redirect_back
redirect_back fallback_location: blacklight.search_history_path
else
# Deprecated in Rails 5.0
redirect_to :back
end
redirect_back fallback_location: blacklight.search_history_path
end
end
end
2 changes: 1 addition & 1 deletion blacklight.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ Gem::Specification.new do |s|

s.required_ruby_version = '~> 2.1'

s.add_dependency "rails", "~> 5.0"
s.add_dependency "rails", "~> 5.1"
s.add_dependency "globalid"
s.add_dependency "jbuilder", '~> 2.7'
s.add_dependency "nokogiri", "~>1.6" # XML Parser
Expand Down
12 changes: 3 additions & 9 deletions lib/generators/blacklight/assets_generator.rb
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ def assets
return if has_blacklight_assets?

contents = "\n//\n// Required by Blacklight\n"
contents += "//= require jquery\n" if needs_jquery?
contents += "//= require jquery\n"
contents += "//= require popper\n"
contents += "// Twitter Typeahead for autocomplete\n"
contents += "//= require twitter/typeahead\n"
Expand All @@ -26,10 +26,8 @@ def assets

marker = if turbolinks?
'//= require turbolinks'
elsif needs_jquery?
'//= require rails-ujs'
else
'//= require jquery_ujs'
'//= require rails-ujs'
end

insert_into_file "app/assets/javascripts/application.js", after: marker do
Expand All @@ -39,15 +37,11 @@ def assets

# This is not a default in Rails 5.1+
def add_jquery
gem 'jquery-rails' if needs_jquery?
gem 'jquery-rails'
end

private

def needs_jquery?
Rails.version >= '5.1'
end

def turbolinks?
@turbolinks ||= IO.read("app/assets/javascripts/application.js").include?('turbolinks')
end
Expand Down