some fixes

This commit is contained in:
John Bintz 2012-11-25 22:15:34 -05:00
parent 8a82530f96
commit 40b24799af
2 changed files with 7 additions and 3 deletions

View File

@ -16,11 +16,15 @@ module SemanticRailsViewHelpers
@context.capture(self, &@block)
end
def field(field, options = {})
def field(field, options = {}, &block)
if options[:value]
raw_value = options[:value]
else
raw_value = @object.send(field)
if block
raw_value = block.call(raw_value)
end
end
value = raw_value

View File

@ -41,8 +41,8 @@ module SemanticRailsViewHelpers
link_to label, polymorphic_url(route, :action => action), options.merge("data-action" => target_action)
end
def li_for(object, &block)
content_tag(:li, capture(&block), 'data-id' => object.id)
def li_for(object, options = {}, &block)
content_tag(:li, capture(&block), options.merge('data-id' => object.id))
end
end
end