Sha256: 6404f5b106e0148c6bb73aa94eb97bd47ced0b87a4e8f3a6cf622114596fba83

Contents?: true

Size: 1.02 KB

Versions: 29

Compression:

Stored size: 1.02 KB

Contents

format :html do
  # a formgroup has a label, an editor and help text
  def formgroup title, opts={}, &block
    wrap_with :div, formgroup_div_args(opts[:class]) do
      formgroup_body title, opts, &block
    end
  end

  def formgroup_body title, opts, &block
    label = formgroup_label opts[:editor], title
    editor_body = editor_wrap opts[:editor], &block
    help_text = formgroup_help_text opts[:help]
    "#{label}<div>#{help_text} #{editor_body}</div>"
  end

  def formgroup_label editor_type, title
    return if voo && voo.hide?(:title)
    label_type = editor_type || :content
    form.label label_type, title
  end

  def formgroup_div_args html_class
    div_args = { class: ["form-group", html_class].compact.join(" ") }
    div_args[:card_id] = card.id if card.real?
    div_args[:card_name] = h card.name if card.name.present?
    div_args
  end

  def formgroup_help_text text=nil
    return "" if text == false
    class_up "help-text", "help-block"
    voo.help = text if voo && text.to_s != "true"
    _render_help
  end
end

Version data entries

29 entries across 29 versions & 1 rubygems

Version Path
card-1.96.8 mod/standard/set/all/rich_html/formgroup.rb
card-1.96.7 mod/standard/set/all/rich_html/formgroup.rb
card-1.96.6 mod/standard/set/all/rich_html/formgroup.rb
card-1.96.5 mod/standard/set/all/rich_html/formgroup.rb
card-1.96.4 mod/standard/set/all/rich_html/formgroup.rb
card-1.96.3 mod/standard/set/all/rich_html/formgroup.rb
card-1.96.2 mod/standard/set/all/rich_html/formgroup.rb
card-1.96.1 mod/standard/set/all/rich_html/formgroup.rb
card-1.96.0 mod/standard/set/all/rich_html/formgroup.rb
card-1.95.3 mod/standard/set/all/rich_html/formgroup.rb
card-1.95.2 mod/standard/set/all/rich_html/formgroup.rb
card-1.95.1 mod/standard/set/all/rich_html/formgroup.rb
card-1.95.0 mod/standard/set/all/rich_html/formgroup.rb
card-1.94.1 mod/standard/set/all/rich_html/formgroup.rb
card-1.94.0 mod/standard/set/all/rich_html/formgroup.rb
card-1.93.13 mod/standard/set/all/rich_html/formgroup.rb
card-1.93.12 mod/standard/set/all/rich_html/formgroup.rb
card-1.93.11 mod/standard/set/all/rich_html/formgroup.rb
card-1.93.10 mod/standard/set/all/rich_html/formgroup.rb
card-1.93.9 mod/standard/set/all/rich_html/formgroup.rb