Sha256: 3749bc9594f43139b55e0a39298e145108d3e0d9c9401406d402997da145125e

Contents?: true

Size: 831 Bytes

Versions: 16

Compression:

Stored size: 831 Bytes

Contents

module Qbrick
  class TwoColumnBrick < ColumnBrick
    before_create :add_columns

    #
    # Childs should only contain ColumnBricks, therefore we
    # don't want the user to mess with it
    #
    def user_can_add_childs?
      false
    end

    def user_can_delete?
      true
    end

    def user_can_save?
      true
    end

    #
    # Use own rendering implementation to show columns side by side
    #
    def renders_own_childs?
      true
    end

    def partitioning
      super || 0
    end

    def self.partitionings
      [Partition.new('70/30', 0), Partition.new('50/50', 1), Partition.new('30/70', 2)]
    end

    def to_style_class
      [super, 'row-fluid'].join(' ')
    end

    private

    def add_columns
      bricks << 2.times.map { |p| Qbrick::ColumnBrick.new(position: p + 1) }
    end
  end
end

Version data entries

16 entries across 16 versions & 1 rubygems

Version Path
qbrick-2.7.1 app/models/qbrick/two_column_brick.rb
qbrick-2.7 app/models/qbrick/two_column_brick.rb
qbrick-2.6.10 app/models/qbrick/two_column_brick.rb
qbrick-2.6.9 app/models/qbrick/two_column_brick.rb
qbrick-2.6.8 app/models/qbrick/two_column_brick.rb
qbrick-2.6.7 app/models/qbrick/two_column_brick.rb
qbrick-2.6.6 app/models/qbrick/two_column_brick.rb
qbrick-2.6.5 app/models/qbrick/two_column_brick.rb
qbrick-2.6.4 app/models/qbrick/two_column_brick.rb
qbrick-2.6.3 app/models/qbrick/two_column_brick.rb
qbrick-2.6.2 app/models/qbrick/two_column_brick.rb
qbrick-2.6.1 app/models/qbrick/two_column_brick.rb
qbrick-2.6.0 app/models/qbrick/two_column_brick.rb
qbrick-2.5.2 app/models/qbrick/two_column_brick.rb
qbrick-2.5.1 app/models/qbrick/two_column_brick.rb
qbrick-2.5.0 app/models/qbrick/two_column_brick.rb