app/controllers/bookmarks_controller.rb in blacklight-3.4.2 vs app/controllers/bookmarks_controller.rb in blacklight-3.5.0
- old
+ new
@@ -22,13 +22,13 @@
success = bookmark.save
unless request.xhr?
if bookmark.save
- flash[:notice] = "Successfully added bookmark."
+ flash[:notice] = I18n.t('blacklight.bookmarks.add.success')
else
- flash[:error] = "Could not save bookmark."
+ flash[:error] = I18n.t('blacklight.bookmarks.add.failure')
end
redirect_to :back
else
#ajaxy request doesn't need a redirect and shouldn't have flash set
render :text => "", :status => (success ? "200" : "500" )
@@ -54,13 +54,13 @@
success = true
@bookmarks.each do |key, bookmark|
success = false unless current_user.bookmarks.create(bookmark)
end
if @bookmarks.length > 0 && success
- flash[:notice] = "Successfully added bookmarks."
+ flash[:notice] = I18n.t('blacklight.bookmarks.add.success', :count => @bookmarks.length)
elsif @bookmarks.length > 0
- flash[:error] = "There was a problem adding bookmarks"
+ flash[:error] = I18n.t('blacklight.bookmarks.add.failure', :count => @bookmarks.length)
end
redirect_to :back
end
@@ -71,30 +71,30 @@
success = (!bookmark) || current_user.bookmarks.delete(bookmark)
unless request.xhr?
if success
- flash[:notice] = "Successfully removed bookmark."
+ flash[:notice] = I18n.t('blacklight.bookmarks.remove.success')
else
- flash[:error] = "Sorry, there was a problem removing the bookmark."
+ flash[:error] = I18n.t('blacklight.bookmarks.remove.failure')
end
redirect_to :back
else
# ajaxy request needs no redirect and should not have flash set
render :text => "", :status => (success ? "200" : "500")
end
end
def clear
if current_user.bookmarks.clear
- flash[:notice] = "Cleared your bookmarks."
+ flash[:notice] = I18n.t('blacklight.bookmarks.clear.success')
else
- flash[:error] = "There was a problem clearing your bookmarks."
+ flash[:error] = I18n.t('blacklight.bookmarks.clear.failure')
end
redirect_to :action => "index"
end
protected
def verify_user
- flash[:notice] = "Please log in to manage and view your bookmarks." and raise Blacklight::Exceptions::AccessDenied unless current_user
+ flash[:notice] = I18n.t('blacklight.bookmarks.need_login') and raise Blacklight::Exceptions::AccessDenied unless current_user
end
end