Sha256: c1b9ada5cfeff74d07cbb38742889955099aa60afe3fac5df65cf69162cacb7e

Contents?: true

Size: 761 Bytes

Versions: 10

Compression:

Stored size: 761 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(options, &block)
      end

      def selectable_column(options={})
        table.columns << SelectColumn.new(options)
      end

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

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

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

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
trestle-0.10.1 lib/trestle/table/builder.rb
trestle-0.10.0 lib/trestle/table/builder.rb
trestle-0.10.0.pre2 lib/trestle/table/builder.rb
trestle-0.10.0.pre lib/trestle/table/builder.rb
trestle-0.9.8 lib/trestle/table/builder.rb
trestle-0.9.7 lib/trestle/table/builder.rb
trestle-0.9.6 lib/trestle/table/builder.rb
trestle-0.9.5 lib/trestle/table/builder.rb
trestle-0.9.4 lib/trestle/table/builder.rb
trestle-0.9.3 lib/trestle/table/builder.rb