Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Pluralized flash notices for successful and unsuccessful bulk deletions.

  • Loading branch information...
commit 54af8b4305f10194176071a5c507cf202fdef326 1 parent b0d91ba
Amerson Lin & Mike Mazur authored
View
8 app/controllers/rails_admin/main_controller.rb
@@ -1,6 +1,8 @@
module RailsAdmin
class MainController < RailsAdmin::ApplicationController
+ include ActionView::Helpers::TextHelper
+
layout "rails_admin/main"
before_filter :get_model, :except => [:index]
@@ -246,14 +248,14 @@ def bulk_destroy
end
unless destroyed.empty?
- flash[:notice] = t("admin.delete.flash_confirmation", :name => @model_config.label)
+ flash[:notice] = t("admin.flash.successful", :name => pluralize(destroyed.count(), @model_config.label), :action => t("admin.actions.deleted"))
end
unless not_destroyed.empty?
- flash[:error] = t("admin.flash.error", :name => @model_config.label, :action => t("admin.actions.deleted"))
+ flash[:error] = t("admin.flash.error", :name => pluralize(not_destroyed.count(), @model_config.label), :action => t("admin.actions.deleted"))
end
- redirect_to rails_admin_list_path, :notice => t("admin.flash.successful", :name => @model_config.label, :action => t("admin.actions.deleted"))
+ redirect_to rails_admin_list_path
end
def handle_error(e)
View
2  config/locales/rails_admin.en.yml
@@ -73,7 +73,7 @@ en:
col_sep: "Column separator"
col_sep_help: "Leave blank for default ('%{value}')" # value is default_col_sep
flash:
- successful: "%{name} was successfully %{action}"
+ successful: "%{name} successfully %{action}"
error: "%{name} failed to be %{action}"
noaction: "No actions were taken"
actions:
Please sign in to comment.
Something went wrong with that request. Please try again.