small cleanup
This commit is contained in:
parent
4dffc6c84f
commit
9959b2f016
|
@ -17,9 +17,9 @@ module SemanticRailsViewHelpers
|
||||||
end
|
end
|
||||||
|
|
||||||
def field(field, options = {}, &block)
|
def field(field, options = {}, &block)
|
||||||
if options[:value]
|
raw_value = options.delete(:value)
|
||||||
raw_value = options[:value]
|
|
||||||
else
|
if !raw_value
|
||||||
raw_value = @object.send(field)
|
raw_value = @object.send(field)
|
||||||
|
|
||||||
if block
|
if block
|
||||||
|
@ -30,12 +30,12 @@ module SemanticRailsViewHelpers
|
||||||
value = raw_value
|
value = raw_value
|
||||||
value = value.to_label if value.respond_to?(:to_label)
|
value = value.to_label if value.respond_to?(:to_label)
|
||||||
|
|
||||||
if options[:raw]
|
if options.delete(:raw)
|
||||||
value = (value || '').html_safe
|
value = (value || '').html_safe
|
||||||
end
|
end
|
||||||
|
|
||||||
if SemanticRailsViewHelpers.semantic_data?
|
if SemanticRailsViewHelpers.semantic_data?
|
||||||
value = @context.content_tag(:data, value, 'data-field' => field)
|
value = @context.content_tag(:data, value, options.merge('data-field' => field))
|
||||||
end
|
end
|
||||||
|
|
||||||
if options[:as]
|
if options[:as]
|
||||||
|
|
Loading…
Reference in New Issue