Sha256: 2e67ac4a6cce95c432add0a5a212240364fc5d65901f5893dcf17b9943d0e571

Contents?: true

Size: 724 Bytes

Versions: 18

Compression:

Stored size: 724 Bytes

Contents

# Class TableHelper provides methods for creating a table.
class TableHelper
  def initialize(*property)
    @prop = property
    @bm = BootstrapMarkup.new
  end

  def headers(*labels)
    css_style = ''
    css_style += ' table-condensed' if @prop.include? :normal
    css_style += ' table-bordered' if @prop.include? :bordered
    @bm.table_begin(css_style)
    @bm.headers_begin
    labels.each do |h|
      @bm.header_begin
      @bm.header_content(h)
      @bm.header_end
    end
    @bm.headers_end
  end

  def row(*cells)
    @bm.row_begin
    cells.each do |c|
      @bm.cell_begin
      @bm.cell_content(c)
      @bm.cell_end
    end
    @bm.row_end
  end

  def render
    @bm.table_end
    @bm.render
  end
end

Version data entries

18 entries across 18 versions & 1 rubygems

Version Path
coursegen-0.9.19 lib/coursegen/course/helpers/table_helpers.rb
coursegen-0.9.18 lib/coursegen/course/helpers/table_helpers.rb
coursegen-0.9.17 lib/coursegen/course/helpers/table_helpers.rb
coursegen-0.9.16 lib/coursegen/course/helpers/table_helpers.rb
coursegen-0.9.15 lib/coursegen/course/helpers/table_helpers.rb
coursegen-0.9.14 lib/coursegen/course/helpers/table_helpers.rb
coursegen-0.9.13 lib/coursegen/course/helpers/table_helpers.rb
coursegen-0.9.12 lib/coursegen/course/helpers/table_helpers.rb
coursegen-0.9.11 lib/coursegen/course/helpers/table_helpers.rb
coursegen-0.9.10 lib/coursegen/course/helpers/table_helpers.rb
coursegen-0.9.9 lib/coursegen/course/helpers/table_helpers.rb
coursegen-0.9.8 lib/coursegen/course/helpers/table_helpers.rb
coursegen-0.9.7 lib/coursegen/course/helpers/table_helpers.rb
coursegen-0.9.6 lib/coursegen/course/helpers/table_helpers.rb
coursegen-0.9.4 lib/coursegen/course/helpers/table_helpers.rb
coursegen-0.9.3 lib/coursegen/course/helpers/table_helpers.rb
coursegen-0.9.2 lib/coursegen/course/helpers/table_helpers.rb
coursegen-0.9.1 lib/coursegen/course/helpers/table_helpers.rb