Sha256: f5b7c6624c4c00a3e1fdcf601a3e3f819b311ebb3f3e0d02a09f3af80a7c2a48

Contents?: true

Size: 768 Bytes

Versions: 8

Compression:

Stored size: 768 Bytes

Contents

module Trestle
  class Table
    class Builder < Trestle::Builder
      target :table

      def initialize(options={})
        @table = Table.new(options)
        @output_buffer = ActionView::OutputBuffer.new
      end

      def row(options={}, &block)
        table.row = Row.new(table, options, &block)
      end

      def selectable_column
        table.columns << SelectColumn.new(table)
      end

      def column(field, proc=nil, options={}, &block)
        if proc.is_a?(Hash)
          options = proc
          proc = nil
        end

        table.columns << Column.new(table, field, options, &(proc || block))
      end

      def actions(options={}, &block)
        table.columns << ActionsColumn.new(table, options, &block)
      end
    end
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
trestle-0.8.12 lib/trestle/table/builder.rb
trestle-0.8.11 lib/trestle/table/builder.rb
trestle-0.8.10 lib/trestle/table/builder.rb
trestle-0.8.9 lib/trestle/table/builder.rb
trestle-0.8.8 lib/trestle/table/builder.rb
trestle-0.8.7 lib/trestle/table/builder.rb
trestle-0.8.6 lib/trestle/table/builder.rb
trestle-0.8.5 lib/trestle/table/builder.rb