Sha256: 0e9dcd0ea9a35dc9b7e18225aa17420b0d68da40c2dd1d767d4639d936c1b804
Contents?: true
Size: 1.53 KB
Versions: 2
Compression:
Stored size: 1.53 KB
Contents
require 'railsstrap/core_ext/rails/form/base_helper' module Railsstrap 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
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
railsstrap-4.0.0.beta3 | lib/railsstrap/core_ext/rails/form/static_control_helper.rb |
railsstrap-4.0.0.beta2 | lib/railsstrap/core_ext/rails/form/static_control_helper.rb |