lib/generators/dry_crud/templates/app/helpers/standard_form_builder.rb
# Render a label for the given attribute with the passed field html section.
# The following parameters may be specified:
#   labeled(:attr) { #content }
#   labeled(:attr, content)
#   labeled(:attr, 'Caption') { #content }
#   labeled(:attr, 'Caption', content)
Render a label for the given attribute with the passed field html section.
Render a label for the given attribute with the passed field html section .
def labeled(attr, caption_or_content = nil, content = nil, &block)
    if block_given?
      content = capture(&block)
    elsif content.nil?
      content = caption_or_content
      caption_or_content = nil
    end
    caption_or_content ||= captionize(attr, @object.class)
    content_tag(:div, :class => "control-group#{' error' if @object.errors.has_key?(attr)}") do
      label(attr, caption_or_content, :class => 'control-label') +
      content_tag(:div, content, :class => 'controls')
    end
  end
def labeled ( attr , caption_or_content = nil , content = nil , & block ) if block_given? content = capture ( & block ) elsif content . nil? content = caption_or_content caption_or_content = nil end caption_or_content ||= captionize ( attr , @object . class ) content_tag ( :div , :class => "control-group#{' error' if @object.errors.has_key?(attr)}" ) do label ( attr , caption_or_content , :class => 'control-label' ) + content_tag ( :div , content , :class => 'controls' ) end end
Render a label for the given attribute with the passed field html section.
Render a label for the given attribute with the passed field html section .
attr
caption_or_content
content
block