Sha256: 073afe1a648212057eb19236c26f244b8d4cbfc2dce72fd8dee5474b347ff4b6

Contents?: true

Size: 1 KB

Versions: 3

Compression:

Stored size: 1 KB

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

    def datagrid_form_for(grid, options = {})
      datagrid_renderer.form_for(grid, options)
    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, column.options[:class]].compact.join(" ")
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
datagrid-0.8.4 lib/datagrid/helper.rb
datagrid-0.8.3 lib/datagrid/helper.rb
datagrid-0.8.2 lib/datagrid/helper.rb