Module: BootyboxGridHelper
- Defined in:
- app/helpers/bootybox_grid_helper.rb
Instance Method Summary collapse
- #col(w = {:lg => 4}, title = "col", options = {}, &block) ⇒ Object
- #column_classes(w = {:lg => 4}, mode = nil, framework = nil) ⇒ Object
Instance Method Details
#col(w = {:lg => 4}, title = "col", options = {}, &block) ⇒ Object
3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 |
# File 'app/helpers/bootybox_grid_helper.rb', line 3 def col(w={:lg => 4}, title ="col", = {}, &block) # fallback for old syntax if title.is_a?(Hash) = title title = [:title] end col_css = [column_classes(w, [:mode], [:framework]).strip, [:class].try(:strip), 'is-bootybox-col'].compact.join(" ") if [:header] != true content_tag(:div, :class => col_css) do capture(&block) end else [:color] ||= "dark-blue" content = [:inner_content] == true ? content_tag(:div, raw(capture(&block)), :class => "inner-content-body") : capture(&block) html_content = content_tag(:header, content_tag(:h3, title), :class => [:color]) html_content += content_tag(:div, raw(content), :class => "content-body") content_tag(:div, :class => col_css) do content_tag(:section, :class => "content-box") do raw(html_content) end end end end |
#column_classes(w = {:lg => 4}, mode = nil, framework = nil) ⇒ Object
32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 |
# File 'app/helpers/bootybox_grid_helper.rb', line 32 def column_classes(w ={:lg => 4}, mode = nil, framework = nil ) default = case (framework || Bootybox.configuration.css_framework.to_sym) when :bootstrap :lg when :foundation :large end # auto-determine settings if no framework given if framework.nil? settings = convert_col_settings!(w, framework) else settings = w end column_key_values.each do |v| if !settings[v.to_sym] settings[v.to_sym] = settings[default] end end col_css = case (framework || Bootybox.configuration.css_framework.to_sym) when :bootstrap [""] when :foundation ["columns"] end settings.each do |c,s| c = "col-#{c}" if (framework == :bootstrap || Bootybox.configuration.css_framework.to_sym == :bootstrap) col_css << [c, mode, s].compact.join("-") end return col_css.join(" ") end |