Sha256: 30f48c58d1cc619a6c7c75a0a2146cede84bddf107c1d5d4076876845827c874
Contents?: true
Size: 1.51 KB
Versions: 8
Compression:
Stored size: 1.51 KB
Contents
require 'bh/helpers/form/base_helper' module Bh module Form module StaticControlHelper include BaseHelper def static_control(text_or_options_with_block = nil, options = {}, &block) text, options = if block_given? [@template.capture(&block), text_or_options_with_block] else [text_or_options_with_block, options] end static_control_string text, options || {} end private def static_control_string(text, options = {}) content_tag :div, class: 'form-group' do if inline_form? label = content_tag :label, options[:label], class: 'sr-only' if options[:label] field = content_tag :p, text, class: 'form-control-static' safe_join [label, field].compact elsif horizontal_form? label = content_tag :label, options[:label], class: 'col-sm-3 control-label' if options[:label] field = content_tag :p, text, class: 'form-control-static' if options[:label] field = content_tag :div, field, class: 'col-sm-9' else field = content_tag :div, field, class: 'col-sm-9 col-sm-offset-3' end safe_join [label, field].compact else label = content_tag :label, options[:label] if options[:label] field = content_tag :p, text, class: 'form-control-static' safe_join [label, field].compact end end end end end end
Version data entries
8 entries across 8 versions & 1 rubygems