From 8a82530f966d4927fc085e3a9f0d18d68561bb9f Mon Sep 17 00:00:00 2001 From: John Bintz Date: Sun, 25 Nov 2012 09:29:35 -0500 Subject: [PATCH] better labels --- lib/semantic_rails_view_helpers/view_helpers.rb | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/semantic_rails_view_helpers/view_helpers.rb b/lib/semantic_rails_view_helpers/view_helpers.rb index aa0855a..c887fc4 100644 --- a/lib/semantic_rails_view_helpers/view_helpers.rb +++ b/lib/semantic_rails_view_helpers/view_helpers.rb @@ -26,6 +26,8 @@ module SemanticRailsViewHelpers def link_to_model_action(model, action = :show, options = {}) target_action = action + label = options.delete(:label) || t(".#{action}") + if action == :destroy options = options.merge(:method => :delete, 'data-skip-pjax' => 'true') action = nil @@ -36,7 +38,7 @@ module SemanticRailsViewHelpers route = model route = route.to_route if route.respond_to?(:to_route) - link_to t(".#{action}"), polymorphic_url(route, :action => action), options.merge("data-action" => target_action) + link_to label, polymorphic_url(route, :action => action), options.merge("data-action" => target_action) end def li_for(object, &block)