Sha256: 04b36c507388ddaf480cc1a24daf7ac26f96c97f871470ffc4edb2839286d821

Contents?: true

Size: 667 Bytes

Versions: 3

Compression:

Stored size: 667 Bytes

Contents


def test_report(&block)
  klass = Class.new
  klass.class_eval do
    include Datagrid
  end
  klass.class_eval(&block)
  klass.new
end

class SimpleReport

  include Datagrid

  scope do
    ::Entry.includes(:group).order("entries.created_at")
  end

  filter(:group_id, :integer, :multiple => true)
  filter(:category, :enum, :select => ["first", "second"])
  filter(:disabled, :eboolean)
  filter(:confirmed, :boolean)

  filter(:name) do |value|
    self.scoped(:conditions => {:name => value})
  end

  column(:group, :order => "groups.name") do
    self.group.name
  end

  column(:name) do |user|
    user.name
  end

  def param_name
    :report
  end

end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
datagrid-0.2.0 spec/support/simple_report.rb
datagrid-0.1.2 spec/support/simple_report.rb
datagrid-0.1.1 spec/support/simple_report.rb