Sha256: 2c5f4a7e8b94696bc2e80681c80bff4544c412c7cf51e37b7d4837d97c6846fc

Contents?: true

Size: 901 Bytes

Versions: 4

Compression:

Stored size: 901 Bytes

Contents

require "datagrid/engine"
require "action_view"

module Datagrid
  module Helper

    def datagrid_format_value(report, column, asset)
      datagrid_renderer.format_value(report, column, asset)
    end

    def datagrid_table(report, *args)
      datagrid_renderer.table(report, *args)
    end

    def datagrid_header(grid, options = {})
      datagrid_renderer.header(grid, options)
    end

    def datagrid_rows(report, assets, options = {})
      datagrid_renderer.rows(report, assets, options)
    end

    def datagrid_order_for(grid, column)
      datagrid_renderer.order_for(grid, column)
    end

    protected

    def datagrid_renderer
      Renderer.for(self)
    end

    def datagrid_column_classes(grid, column)
        order_class = grid.order == column.name ? ["ordered", grid.descending ? "desc" : "asc"] : nil
      [column.name, order_class].compact.join(" ")
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
datagrid-0.6.4 lib/datagrid/helper.rb
datagrid-0.6.3 lib/datagrid/helper.rb
datagrid-0.6.2 lib/datagrid/helper.rb
datagrid-0.6.0 lib/datagrid/helper.rb