Sha256: 4cbf972e4238c386c2174f3f3681f2bcd331676a3bcbe36398b3a2803da6c792

Contents?: true

Size: 1.04 KB

Versions: 100

Compression:

Stored size: 1.04 KB

Contents

module MinimumViableProduct
  module BootstrapHelper
    def col_groups_of(count, collection, opts={})
      return if collection.blank?

      html = []
      collection.in_groups_of(count).each do |groups|
        groups.compact.each do |obj|
          html << capture do
            content_tag :div, class: ["col-md-#{12/count.to_f.floor}", opts[:col_class]].compact.join(' ') do
              yield obj
            end
          end.html_safe
        end
      end
      concat html.join.html_safe
    end

    def row_groups_of(count, collection, opts={}, &block)
      return if collection.blank?

      html = []
      subsetsize = (collection.count/count.to_f)
      subsetsize.ceil.times do |i|
        subset = collection[count*i...((count*i)+count)]
        html << capture do
          content_tag :div, class: ["row",opts[:row_class]].compact.join(' ') do
            capture do
              col_groups_of(count, subset, opts, &block)
            end
          end
        end.html_safe
      end

      concat html.join.html_safe
    end
  end
end

Version data entries

100 entries across 99 versions & 3 rubygems

Version Path
mvpkit-1.1.2 app/helpers/minimum_viable_product/bootstrap_helper.rb
mvpkit-1.1.1 app/helpers/minimum_viable_product/bootstrap_helper.rb
mvpkit-1.1.0 app/helpers/minimum_viable_product/bootstrap_helper.rb
mvpkit-1.0.4 app/helpers/minimum_viable_product/bootstrap_helper.rb
mvpkit-1.0.3 app/helpers/minimum_viable_product/bootstrap_helper.rb
mvpkit-1.0.2 app/helpers/minimum_viable_product/bootstrap_helper.rb
mvpkit-1.0.1 app/helpers/minimum_viable_product/bootstrap_helper.rb
mvpkit-1.0.0 app/helpers/minimum_viable_product/bootstrap_helper.rb
mvpkit-0.8.1 app/helpers/minimum_viable_product/bootstrap_helper.rb
mvpkit-0.8.0 app/helpers/minimum_viable_product/bootstrap_helper.rb
minimum_viable_product-0.7.15 app/helpers/minimum_viable_product/bootstrap_helper.rb
minimum_viable_product-0.7.14 app/helpers/minimum_viable_product/bootstrap_helper.rb
minimum_viable_product-0.7.13 app/helpers/minimum_viable_product/bootstrap_helper.rb
minimum_viable_product-0.7.12 app/helpers/minimum_viable_product/bootstrap_helper.rb
minimum_viable_product-0.7.11 app/helpers/minimum_viable_product/bootstrap_helper.rb
minimum_viable_product-0.7.10 app/helpers/minimum_viable_product/bootstrap_helper.rb
minimum_viable_product-0.7.9 app/helpers/minimum_viable_product/bootstrap_helper.rb
minimum_viable_product-0.7.8 app/helpers/minimum_viable_product/bootstrap_helper.rb
minimum_viable_product-0.7.7 app/helpers/minimum_viable_product/bootstrap_helper.rb
minimum_viable_product-0.7.6 app/helpers/minimum_viable_product/bootstrap_helper.rb