better labels
This commit is contained in:
parent
be3127b265
commit
8a82530f96
|
@ -26,6 +26,8 @@ module SemanticRailsViewHelpers
|
||||||
def link_to_model_action(model, action = :show, options = {})
|
def link_to_model_action(model, action = :show, options = {})
|
||||||
target_action = action
|
target_action = action
|
||||||
|
|
||||||
|
label = options.delete(:label) || t(".#{action}")
|
||||||
|
|
||||||
if action == :destroy
|
if action == :destroy
|
||||||
options = options.merge(:method => :delete, 'data-skip-pjax' => 'true')
|
options = options.merge(:method => :delete, 'data-skip-pjax' => 'true')
|
||||||
action = nil
|
action = nil
|
||||||
|
@ -36,7 +38,7 @@ module SemanticRailsViewHelpers
|
||||||
route = model
|
route = model
|
||||||
route = route.to_route if route.respond_to?(:to_route)
|
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
|
end
|
||||||
|
|
||||||
def li_for(object, &block)
|
def li_for(object, &block)
|
||||||
|
|
Loading…
Reference in New Issue