lib/active_admin/comments.rb in activeadmin-0.4.1 vs lib/active_admin/comments.rb in activeadmin-0.4.2
- old
+ new
@@ -18,11 +18,11 @@
# Generate a Comment resource when namespaces are registered
ActiveAdmin::Event.subscribe ActiveAdmin::Application::LoadEvent do |app|
app.namespaces.values.each do |namespace|
if namespace.comments?
- namespace.register ActiveAdmin::Comment, :as => 'Comment' do
+ namespace.register ActiveAdmin::Comment, :as => "Comment" do
actions :index, :show, :create
# Don't display in the menu
menu false
@@ -58,21 +58,21 @@
controller do
def create
create! do |success, failure|
failure.html do
resource_config = active_admin_config.namespace.resource_for(@comment.resource.class)
- flash[:error] = "Comment wasn't saved, text was empty."
+ flash[:error] = I18n.t('active_admin.comments.errors.empty_text')
redirect_to send(resource_config.route_instance_path, @comment.resource)
end
end
end
end
# Display as a table
index do
- column("Resource"){|comment| auto_link(comment.resource) }
- column("Author"){|comment| auto_link(comment.author) }
- column :body
+ column(I18n.t('active_admin.comments.resource')){|comment| auto_link(comment.resource) }
+ column(I18n.t('active_admin.comments.author')){|comment| auto_link(comment.author) }
+ column(I18n.t('active_admin.comments.body')){|comment| comment.body }
end
end
end
end
end