Permalink
Browse files

Pluralized flash notices for successful and unsuccessful bulk deletions.

  • Loading branch information...
1 parent b0d91ba commit 54af8b4305f10194176071a5c507cf202fdef326 Amerson Lin & Mike Mazur committed Jul 5, 2011
Showing with 6 additions and 4 deletions.
  1. +5 −3 app/controllers/rails_admin/main_controller.rb
  2. +1 −1 config/locales/rails_admin.en.yml
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:

0 comments on commit 54af8b4

Please sign in to comment.