some fixes
This commit is contained in:
parent
8a82530f96
commit
40b24799af
|
@ -16,11 +16,15 @@ module SemanticRailsViewHelpers
|
||||||
@context.capture(self, &@block)
|
@context.capture(self, &@block)
|
||||||
end
|
end
|
||||||
|
|
||||||
def field(field, options = {})
|
def field(field, options = {}, &block)
|
||||||
if options[:value]
|
if options[:value]
|
||||||
raw_value = options[:value]
|
raw_value = options[:value]
|
||||||
else
|
else
|
||||||
raw_value = @object.send(field)
|
raw_value = @object.send(field)
|
||||||
|
|
||||||
|
if block
|
||||||
|
raw_value = block.call(raw_value)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
value = raw_value
|
value = raw_value
|
||||||
|
|
|
@ -41,8 +41,8 @@ module SemanticRailsViewHelpers
|
||||||
link_to label, 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, options = {}, &block)
|
||||||
content_tag(:li, capture(&block), 'data-id' => object.id)
|
content_tag(:li, capture(&block), options.merge('data-id' => object.id))
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in New Issue