datagrid 0.0.3 → 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
data/Readme.md CHANGED
@@ -1,9 +1,11 @@
1
- ## Datagrid
1
+ # Datagrid
2
2
 
3
3
  Ruby library that helps you to build and repsend table like data with:
4
4
 
5
- * Filtering
5
+ * Customizable filtering
6
+ * Columns
6
7
  * Sort order
8
+ * Localization
7
9
  * Exportort to CSV
8
10
 
9
11
 
@@ -16,6 +18,10 @@ In order to create a report You need to define:
16
18
  * columns that should be displayed and sortable(if possible)
17
19
 
18
20
 
21
+ ### Working grid example
22
+
23
+ In order to create a grid:
24
+
19
25
  ``` ruby
20
26
 
21
27
  class SimpleReport
@@ -30,27 +36,45 @@ class SimpleReport
30
36
  filter(:category, :enum, :select => ["first", "second"])
31
37
  filter(:disabled, :eboolean)
32
38
  filter(:confirmed, :boolean)
39
+ filter(:group_id, :multiple => true)
33
40
  integer_range_filter(:logins_count, :integer)
34
- filter(:group_name) do |value|
41
+ filter(:group_name, :header => "Group") do |value|
35
42
  self.joins(:group).where(:groups => {:name => value})
36
43
  end
37
44
 
38
- column(:group, :order => "groups.name") do |model|
39
- group.name
40
- end
41
45
 
42
46
  column(:name)
47
+ column(:group, :order => "groups.name") do |user|
48
+ user.name
49
+ end
50
+ column(:active, :header => "Activated") do |user|
51
+ !user.disabled
52
+ end
53
+
43
54
 
44
55
 
45
56
  end
46
57
 
47
58
 
48
- report = SimpleReport.new(:group_id => 5, :from_logins_count => 1, :category => "first")
49
- report.assets # => Array of User: SELECT * FROM users WHERE users.group_id = 5 AND users.logins_count >= 1 AND users.category = 'first'
50
- report.header
51
- report.rows
52
- report.data
59
+ ```
53
60
 
61
+ Basic grid api:
62
+
63
+ ``` ruby
64
+ report = SimpleReport.new(:order => "group", :reverse => true, :group_id => [1,2], :from_logins_count => 1, :category => "first")
65
+
66
+ report.assets # => Array of User instances:
67
+ # SELECT * FROM users WHERE users.group_id in (1,2) AND users.logins_count >= 1 AND users.category = 'first' ORDER BY groups.name DESC
68
+
69
+ report.header # => ["Group", "Name", "Disabled"]
70
+ report.rows # => [
71
+ # ["Steve", "Spammers", true],
72
+ # [ "John", "Spoilers", true],
73
+ # ["Berry", "Good people", false]
74
+ # ]
75
+ report.data # => [ header, *rows]
76
+
77
+ report.to_csv # => Yes, it is
54
78
  ```
55
79
 
56
80
  ### Scope
@@ -63,8 +87,8 @@ In common case it is `ActiveRecord::Base` subclass with some generic scopes like
63
87
  Each filter definition consists of:
64
88
 
65
89
  * name of the filter
66
- * type that will be used for value conversion
67
- * conditions block that cegerates `ActiveRecord` scope
90
+ * type that will be used for value typecast
91
+ * conditions block that applies to defined scope
68
92
  * additional options
69
93
 
70
94
  Datagrid supports different type of filters including:
@@ -82,7 +106,9 @@ Read more about filters here:
82
106
  ### Columns
83
107
 
84
108
  Each column is represented by name and code block to calculate the value.
85
- If no block given the value will be the result of column name method call on object defined in Scope.
109
+ Grids are sortable by it's columns. Ordering is controller by `#order` and `#reverse` attributes.
110
+
111
+ More information about columns here:
86
112
 
87
113
 
88
114
 
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.0.3
1
+ 0.1.0
@@ -5,16 +5,15 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{datagrid}
8
- s.version = "0.0.3"
8
+ s.version = "0.1.0"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Bogdan Gusiev"]
12
- s.date = %q{2011-06-02}
12
+ s.date = %q{2011-06-21}
13
13
  s.description = %q{This allows you to easily build datagrid aka data tables with sortable columns and filters}
14
14
  s.email = %q{agresso@gmail.com}
15
15
  s.extra_rdoc_files = [
16
- "LICENSE.txt",
17
- "README.rdoc"
16
+ "LICENSE.txt"
18
17
  ]
19
18
  s.files = [
20
19
  ".document",
@@ -22,8 +21,8 @@ Gem::Specification.new do |s|
22
21
  "Gemfile",
23
22
  "Gemfile.lock",
24
23
  "LICENSE.txt",
25
- "README.rdoc",
26
24
  "Rakefile",
25
+ "Readme.md",
27
26
  "VERSION",
28
27
  "datagrid.gemspec",
29
28
  "lib/datagrid.rb",
@@ -43,10 +42,14 @@ Gem::Specification.new do |s|
43
42
  "lib/datagrid/form_builder.rb",
44
43
  "lib/datagrid/helper.rb",
45
44
  "lib/datagrid/rspec.rb",
45
+ "spec/datagrid/columns_spec.rb",
46
+ "spec/datagrid/form_builder_spec.rb",
47
+ "spec/datagrid/helper_spec.rb",
46
48
  "spec/datagrid_spec.rb",
47
- "spec/simple_report_spec.rb",
48
49
  "spec/spec_helper.rb",
49
- "tags"
50
+ "spec/support/equal_to_dom.rb",
51
+ "spec/support/schema.rb",
52
+ "spec/support/simple_report.rb"
50
53
  ]
51
54
  s.homepage = %q{http://github.com/bogdan/datagrid}
52
55
  s.licenses = ["MIT"]
@@ -62,7 +65,6 @@ Gem::Specification.new do |s|
62
65
  s.add_runtime_dependency(%q<rails>, [">= 0"])
63
66
  s.add_development_dependency(%q<rake>, ["= 0.8.7"])
64
67
  s.add_development_dependency(%q<mocha>, [">= 0"])
65
- s.add_development_dependency(%q<rspec-rails>, ["= 2.6.0"])
66
68
  s.add_development_dependency(%q<rspec>, ["= 2.6.0"])
67
69
  s.add_development_dependency(%q<bundler>, ["~> 1.0.0"])
68
70
  s.add_development_dependency(%q<jeweler>, ["~> 1.6.0"])
@@ -76,7 +78,6 @@ Gem::Specification.new do |s|
76
78
  s.add_dependency(%q<rails>, [">= 0"])
77
79
  s.add_dependency(%q<rake>, ["= 0.8.7"])
78
80
  s.add_dependency(%q<mocha>, [">= 0"])
79
- s.add_dependency(%q<rspec-rails>, ["= 2.6.0"])
80
81
  s.add_dependency(%q<rspec>, ["= 2.6.0"])
81
82
  s.add_dependency(%q<bundler>, ["~> 1.0.0"])
82
83
  s.add_dependency(%q<jeweler>, ["~> 1.6.0"])
@@ -91,7 +92,6 @@ Gem::Specification.new do |s|
91
92
  s.add_dependency(%q<rails>, [">= 0"])
92
93
  s.add_dependency(%q<rake>, ["= 0.8.7"])
93
94
  s.add_dependency(%q<mocha>, [">= 0"])
94
- s.add_dependency(%q<rspec-rails>, ["= 2.6.0"])
95
95
  s.add_dependency(%q<rspec>, ["= 2.6.0"])
96
96
  s.add_dependency(%q<bundler>, ["~> 1.0.0"])
97
97
  s.add_dependency(%q<jeweler>, ["~> 1.6.0"])
@@ -26,9 +26,67 @@ module Datagrid
26
26
  @columns ||= []
27
27
  end
28
28
 
29
+ # Defines column that will be used to display data.
30
+ #
31
+ # Example:
32
+ #
33
+ # class UserGrid
34
+ # include Datagrid
35
+ #
36
+ # scope do
37
+ # User.order("users.created_at desc").includes(:group)
38
+ # end
39
+ #
40
+ # column(:name)
41
+ # column(:group, :order => "groups.name")
42
+ # self.group.name
43
+ # end
44
+ # column(:active, :header => "Activated") do |user|
45
+ # !user.disabled
46
+ # end
47
+ #
48
+ # end
49
+ #
50
+ # Each column will be used to generate data.
51
+ # In order to create grid that display all users:
52
+ #
53
+ # grid = UserGrid.new
54
+ # grid.rows
55
+ # grid.header # => ["Group", "Name", "Disabled"]
56
+ # grid.rows # => [
57
+ # # ["Steve", "Spammers", true],
58
+ # # [ "John", "Spoilers", true],
59
+ # # ["Berry", "Good people", false]
60
+ # # ]
61
+ # grid.data # => Header & Rows
62
+ #
63
+ # = Column value
64
+ #
65
+ # Column value can be defined by passing a block to <tt>#column</tt> method.
66
+ # If no block given column is generated automatically by sending column name method to model.
67
+ # The block could have zero arguments(<tt>instance_eval</tt>) or one argument that is model object.
68
+ #
69
+ # = Columns order
70
+ #
71
+ # Each column supports <tt>:order</tt> option that is used to specify SQL to sort data by the given column.
72
+ # In order to specify order for the given grid the following attributes are used:
73
+ #
74
+ # * <tt>:order</tt> - column name to use order. Default: nil.
75
+ # * <tt>:reverse</tt> - if true descending suffix is added to specified order. Default: false.
76
+ #
77
+ #
78
+ # Example:
79
+ #
80
+ # grid = UserGrid.new(:order => :group, :reverse => true)
81
+ # grid.assets # => Return assets ordered by :group column descending
82
+ #
83
+ # = Options
84
+ #
85
+ # TODO
29
86
  def column(name, options = {}, &block)
30
- block ||= lambda do
31
- self.send(name)
87
+ check_scope_defined!("Scope should be defined before columns")
88
+ block ||= lambda do |model|
89
+ model.send(name)
32
90
  end
33
91
  self.columns << Datagrid::Columns::Column.new(self, name, options, &block)
34
92
  end
@@ -56,12 +114,16 @@ module Datagrid
56
114
  result
57
115
  end
58
116
 
59
- def data
117
+ def rows
60
118
  self.assets.map do |asset|
61
119
  self.row_for(asset)
62
120
  end
63
121
  end
64
122
 
123
+ def data
124
+ self.rows.unshift(self.header)
125
+ end
126
+
65
127
  def data_hash
66
128
  self.assets.map do |asset|
67
129
  hash_for(asset)
@@ -73,7 +135,7 @@ module Datagrid
73
135
  if self.order
74
136
  column = column_by_name(self.order)
75
137
  raise Datagrid::OrderUnsupported, "Can not sort #{self.inspect} by #{name.inspect}" unless column
76
- result = result.order(self.reverse ? column.order : column.desc_order)
138
+ result = result.order(self.reverse ? column.desc_order : column.order)
77
139
  end
78
140
  result
79
141
  end
@@ -83,7 +145,7 @@ module Datagrid
83
145
  FasterCSV.generate(
84
146
  {:headers => self.header, :write_headers => true}.merge(options)
85
147
  ) do |csv|
86
- self.data.each do |row|
148
+ self.rows.each do |row|
87
149
  csv << row
88
150
  end
89
151
  end
@@ -15,7 +15,11 @@ class Datagrid::Columns::Column
15
15
  end
16
16
 
17
17
  def value_for(object)
18
- object.instance_eval(&self.block)
18
+ if self.block.arity == 1
19
+ self.block.call(object)
20
+ else
21
+ object.instance_eval(&self.block)
22
+ end
19
23
  end
20
24
 
21
25
  def format
@@ -40,7 +44,7 @@ class Datagrid::Columns::Column
40
44
  end
41
45
 
42
46
  def desc_order
43
- order ? order.to_s + " DESC" : nil
47
+ self.options[:desc_order] || (order ? order.to_s + " DESC" : nil)
44
48
  end
45
49
 
46
50
  end
@@ -35,7 +35,7 @@ module Datagrid
35
35
  if block
36
36
  @scope = block
37
37
  else
38
- raise(Datagrid::ConfigurationError, "Scope not defined") unless @scope
38
+ check_scope_defined!
39
39
  @scope.call
40
40
  end
41
41
  end
@@ -44,6 +44,11 @@ module Datagrid
44
44
  self.to_s.underscore.split('/').last
45
45
  end
46
46
 
47
+ protected
48
+ def check_scope_defined!(message = "Scope not defined")
49
+ raise(Datagrid::ConfigurationError, message) unless @scope
50
+ end
51
+
47
52
  end # ClassMethods
48
53
 
49
54
  module InstanceMethods
@@ -90,10 +95,17 @@ module Datagrid
90
95
  self.class.scope
91
96
  end
92
97
 
98
+
93
99
  def param_name
94
100
  self.class.param_name
95
101
  end
96
102
 
103
+ protected
104
+
105
+ def check_scope_defined!(message)
106
+ self.class.check_scope_defined!(message)
107
+ end
108
+
97
109
  end # InstanceMethods
98
110
  end
99
111
  end
@@ -53,17 +53,18 @@ module Datagrid
53
53
  # class UserGrid
54
54
  # include Datagrid
55
55
  #
56
+ # scope do
57
+ # User.order("users.created_at desc")
58
+ # end
59
+ #
56
60
  # filter(:name)
57
61
  # filter(:posts_count, :integer) do |value|
58
62
  # self.where(["posts_count >= ?", value])
59
63
  # end
60
64
  #
61
- # scope do
62
- # User.order("users.created_at desc")
63
- # end
64
65
  # end
65
66
  #
66
- # Each filter becomes grid atttribute.
67
+ # Each filter becomes grid attribute.
67
68
  # In order to create grid that display all users with name 'John' that have more than zero posts:
68
69
  #
69
70
  # grid = UserGrid.new(:posts_count => 1, :name => "John")
@@ -81,14 +82,23 @@ module Datagrid
81
82
  # Filter does types conversion automatically.
82
83
  # The following filter types are supported:
83
84
  #
84
- # * <tt>:string</tt> (default) - converts value to string
85
+ # * <tt>:default</tt> (default) - leave value as is
85
86
  # * <tt>:date</tt> - converts value to date using date parser
86
87
  # * <tt>:enum</tt> - designed to be collection select. Additional options for easy form generation:
87
- # * <tt>:select</tt> (required) - collection of values to match agains.
88
- # * <tt>:multiple</tt> - if true multiple values can be assigned to this filter. Default: false.
89
- # * <tt>:eboolean</tt> - subtype of enum filter that provides select of "Yes", "No" and "Any". Could be useful.
88
+ # * <tt>:select</tt> (required) - collection of values to match against.
89
+ # * <tt>:boolean</tt> - converts value to true or false depending on whether it looks truly or not
90
90
  # * <tt>:integer</tt> - converts given value to integer.
91
+ # * <tt>:eboolean</tt> - subtype of enum filter that provides select of "Yes", "No" and "Any". Could be useful.
91
92
  #
93
+ # = Default filter options
94
+ #
95
+ # Options that could be passed to any filter type:
96
+ #
97
+ # * <tt>:header</tt> - human readable name of the filter. Default: generated from the filter name.
98
+ # * <tt>:default</tt> - default value of the filter. Default: nil.
99
+ # * <tt>:multiple</tt> - if true multiple values can be assigned to this filter. Default: false.
100
+ # * <tt>:allow_nil</tt> - determines if filter should be called if filter value is nil. Default: false.
101
+ # * <tt>:allow_blank</tt> - determines if filter should be called if filter value is #blank?. Default: false.
92
102
  #
93
103
  def filter(attribute, type = :string, options = {}, &block)
94
104
 
@@ -101,13 +111,14 @@ module Datagrid
101
111
  self.filters << filter
102
112
 
103
113
  datagrid_attribute(attribute) do |value|
104
- filter.format(value)
114
+ filter.format_values(value)
105
115
  end
106
116
 
107
117
  end
108
118
 
109
119
  protected
110
120
  def default_filter(attribute)
121
+ check_scope_defined!("Scope should be defined before filters")
111
122
  if self.scope.column_names.include?(attribute.to_s)
112
123
  lambda do |value|
113
124
  self.scoped(:conditions => {attribute => value})
@@ -11,23 +11,35 @@ class Datagrid::Filters::BaseFilter
11
11
  self.block = block
12
12
  end
13
13
 
14
+ def format(value)
15
+ raise NotImplementedError, "#format(value) suppose to be overwritten"
16
+ end
17
+
14
18
  def apply(scope, value)
15
19
  return scope if value.nil? && !options[:allow_nil]
16
20
  return scope if value.blank? && !options[:allow_blank]
17
21
  ::Datagrid::Filters::FilterEval.new(self, scope, value).run
18
22
  end
19
23
 
20
- def format(value)
21
- raise NotImplementedError, "#format(value) suppose to be overwritten"
24
+ def format_values(value)
25
+ values = Array(value)
26
+ values.map! do |value|
27
+ self.format(value)
28
+ end
29
+ self.multiple ? values : values.first
22
30
  end
23
31
 
24
32
  def header
25
- I18n.translate(self.name, :scope => "datagrid.#{grid.class.to_s.underscore.split("/").last}.filters", :default => self.name.to_s.humanize)
33
+ options[:header] ||
34
+ I18n.translate(self.name, :scope => "datagrid.#{grid.class.to_s.underscore.split("/").last}.filters", :default => self.name.to_s.humanize)
26
35
  end
27
36
 
28
37
  def default
29
38
  self.options[:default]
30
39
  end
31
40
 
41
+ def multiple
42
+ self.options[:multiple]
43
+ end
32
44
  end
33
45
 
@@ -1,8 +1,10 @@
1
1
  class Datagrid::Filters::DateFilter < Datagrid::Filters::BaseFilter
2
2
  #TODO: more smart date normalizer
3
3
  def format(value)
4
+ return nil if value.blank?
5
+ return value.to_date if value.respond_to?(:to_date)
4
6
  return value unless value.is_a?(String)
5
- value.blank? ? nil : Date.parse(value)
7
+ Date.parse(value)
6
8
  rescue ArgumentError
7
9
  nil
8
10
  end
@@ -4,13 +4,10 @@ class Datagrid::Filters::EnumFilter < Datagrid::Filters::BaseFilter
4
4
  super(*args)
5
5
  raise Datagrid::ConfigurationError, ":select option not specified" unless select
6
6
  end
7
+
7
8
  def format(value)
8
- values = Array.new([*value])
9
- values.reject do |value|
10
- #TODO: really impelement #strict option
11
- self.strict && !select.include?(value)
12
- end
13
- self.multiple ? values : values.first
9
+ return nil if self.strict && !select.include?(value)
10
+ value
14
11
  end
15
12
 
16
13
  def select
@@ -26,7 +23,4 @@ class Datagrid::Filters::EnumFilter < Datagrid::Filters::BaseFilter
26
23
  self.options[:strict]
27
24
  end
28
25
 
29
- def multiple
30
- self.options[:multiple]
31
- end
32
26
  end
@@ -1,3 +1,5 @@
1
+ require "datagrid"
2
+
1
3
  shared_examples_for "Datagrid" do
2
4
  describe "as Datagrid" do
3
5
 
@@ -0,0 +1,30 @@
1
+ require 'spec_helper'
2
+
3
+ describe Datagrid::Columns do
4
+
5
+ let(:group) { Group.create!(:name => "Pop") }
6
+ let!(:entry) { Entry.create!(
7
+ :group => group, :name => "Star", :disabled => false, :confirmed => false, :category => "first"
8
+ ) }
9
+
10
+ subject do
11
+ SimpleReport.new
12
+ end
13
+ it "should build rows of data" do
14
+ subject.rows.should == [["Pop", "Star"]]
15
+ end
16
+ it "should generate header" do
17
+ subject.header.should == ["Group", "Name"]
18
+ end
19
+
20
+ it "should generate data" do
21
+ subject.data.should == [
22
+ subject.header,
23
+ subject.row_for(entry)
24
+ ]
25
+ end
26
+
27
+ it "should support csv export" do
28
+ subject.to_csv.should == "Group,Name\nPop,Star\n"
29
+ end
30
+ end
@@ -30,7 +30,7 @@ describe Datagrid::FormBuilder do
30
30
  context "with integer filter type" do
31
31
  let(:_filter) { :group_id }
32
32
  it { should equal_to_dom(
33
- '<input class="group_id integer_filter" id="report_group_id" name="report[group_id]" size="30" type="text"/>'
33
+ '<input class="group_id integer_filter" id="report_group_id" name="report[group_id]" size="30" type="text" value=""/>'
34
34
  )}
35
35
  end
36
36
  context "with enum filter type" do
@@ -1,9 +1,10 @@
1
1
  require 'spec_helper'
2
+ require "datagrid/rspec"
2
3
 
3
4
 
4
- describe SimpleReport do
5
+ describe Datagrid do
5
6
 
6
- it_should_behave_like 'Datagrid'
7
+ #it_should_behave_like 'Datagrid'
7
8
 
8
9
  let(:group) { Group.create!(:name => "Pop") }
9
10
 
@@ -40,17 +41,23 @@ describe SimpleReport do
40
41
 
41
42
  context "when not defined on class level" do
42
43
  before(:each) do
44
+ @scope = SimpleReport.instance_variable_get("@scope")
43
45
  SimpleReport.instance_variable_set("@scope", nil)
44
46
  end
45
47
 
48
+ after(:each) do
49
+ SimpleReport.instance_variable_set("@scope", @scope)
50
+ end
51
+
46
52
  it "should raise ConfigurationError" do
47
53
  lambda {
48
54
  subject.scope
49
55
  }.should raise_error(Datagrid::ConfigurationError)
50
56
 
51
57
  end
52
-
53
58
  end
54
59
  end
55
60
 
61
+
62
+
56
63
  end
@@ -14,7 +14,6 @@ require 'rspec'
14
14
  require "active_record"
15
15
  require "will_paginate"
16
16
  require 'datagrid'
17
- require "datagrid/rspec"
18
17
  require 'ruby-debug'
19
18
 
20
19
 
@@ -19,10 +19,12 @@ ActiveRecord::Schema.define(:version => 1) do
19
19
  t.string :category
20
20
  t.boolean :disabled, :null => false, :default => nil
21
21
  t.boolean :confirmed, :null => false, :default => nil
22
+ t.timestamps
22
23
  end
23
24
 
24
25
  create_table :groups do |t|
25
26
  t.string :name
27
+ t.timestamps
26
28
  end
27
29
 
28
30
  class ::Entry < ActiveRecord::Base
@@ -4,10 +4,10 @@ class SimpleReport
4
4
 
5
5
 
6
6
  scope do
7
- ::Entry.includes(:group)
7
+ ::Entry.includes(:group).order("entries.created_at")
8
8
  end
9
9
 
10
- filter(:group_id, :integer)
10
+ filter(:group_id, :integer, :multiple => true)
11
11
  filter(:category, :enum, :select => ["first", "second"])
12
12
  filter(:disabled, :eboolean)
13
13
  filter(:confirmed, :boolean)
@@ -15,11 +15,13 @@ class SimpleReport
15
15
  self.scoped(:conditions => {:name => value})
16
16
  end
17
17
 
18
- column(:group, :order => "groups.name") do |model|
19
- group.name
18
+ column(:group, :order => "groups.name") do
19
+ self.group.name
20
20
  end
21
21
 
22
- column(:name)
22
+ column(:name) do |user|
23
+ user.name
24
+ end
23
25
 
24
26
  def param_name
25
27
  :report
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: datagrid
3
3
  version: !ruby/object:Gem::Version
4
- hash: 25
4
+ hash: 27
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
+ - 1
8
9
  - 0
9
- - 3
10
- version: 0.0.3
10
+ version: 0.1.0
11
11
  platform: ruby
12
12
  authors:
13
13
  - Bogdan Gusiev
@@ -15,14 +15,12 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2011-06-10 00:00:00 +03:00
18
+ date: 2011-06-21 00:00:00 +03:00
19
19
  default_executable:
20
20
  dependencies:
21
21
  - !ruby/object:Gem::Dependency
22
22
  name: rails
23
- type: :runtime
24
- prerelease: false
25
- version_requirements: &id001 !ruby/object:Gem::Requirement
23
+ requirement: &id001 !ruby/object:Gem::Requirement
26
24
  none: false
27
25
  requirements:
28
26
  - - ">="
@@ -31,12 +29,12 @@ dependencies:
31
29
  segments:
32
30
  - 0
33
31
  version: "0"
34
- requirement: *id001
32
+ prerelease: false
33
+ type: :runtime
34
+ version_requirements: *id001
35
35
  - !ruby/object:Gem::Dependency
36
36
  name: rake
37
- type: :development
38
- prerelease: false
39
- version_requirements: &id002 !ruby/object:Gem::Requirement
37
+ requirement: &id002 !ruby/object:Gem::Requirement
40
38
  none: false
41
39
  requirements:
42
40
  - - "="
@@ -47,12 +45,12 @@ dependencies:
47
45
  - 8
48
46
  - 7
49
47
  version: 0.8.7
50
- requirement: *id002
48
+ prerelease: false
49
+ type: :development
50
+ version_requirements: *id002
51
51
  - !ruby/object:Gem::Dependency
52
52
  name: mocha
53
- type: :development
54
- prerelease: false
55
- version_requirements: &id003 !ruby/object:Gem::Requirement
53
+ requirement: &id003 !ruby/object:Gem::Requirement
56
54
  none: false
57
55
  requirements:
58
56
  - - ">="
@@ -61,12 +59,12 @@ dependencies:
61
59
  segments:
62
60
  - 0
63
61
  version: "0"
64
- requirement: *id003
62
+ prerelease: false
63
+ type: :development
64
+ version_requirements: *id003
65
65
  - !ruby/object:Gem::Dependency
66
66
  name: rspec
67
- type: :development
68
- prerelease: false
69
- version_requirements: &id004 !ruby/object:Gem::Requirement
67
+ requirement: &id004 !ruby/object:Gem::Requirement
70
68
  none: false
71
69
  requirements:
72
70
  - - "="
@@ -77,12 +75,12 @@ dependencies:
77
75
  - 6
78
76
  - 0
79
77
  version: 2.6.0
80
- requirement: *id004
78
+ prerelease: false
79
+ type: :development
80
+ version_requirements: *id004
81
81
  - !ruby/object:Gem::Dependency
82
82
  name: bundler
83
- type: :development
84
- prerelease: false
85
- version_requirements: &id005 !ruby/object:Gem::Requirement
83
+ requirement: &id005 !ruby/object:Gem::Requirement
86
84
  none: false
87
85
  requirements:
88
86
  - - ~>
@@ -93,12 +91,12 @@ dependencies:
93
91
  - 0
94
92
  - 0
95
93
  version: 1.0.0
96
- requirement: *id005
94
+ prerelease: false
95
+ type: :development
96
+ version_requirements: *id005
97
97
  - !ruby/object:Gem::Dependency
98
98
  name: jeweler
99
- type: :development
100
- prerelease: false
101
- version_requirements: &id006 !ruby/object:Gem::Requirement
99
+ requirement: &id006 !ruby/object:Gem::Requirement
102
100
  none: false
103
101
  requirements:
104
102
  - - ~>
@@ -109,12 +107,12 @@ dependencies:
109
107
  - 6
110
108
  - 0
111
109
  version: 1.6.0
112
- requirement: *id006
110
+ prerelease: false
111
+ type: :development
112
+ version_requirements: *id006
113
113
  - !ruby/object:Gem::Dependency
114
114
  name: rcov
115
- type: :development
116
- prerelease: false
117
- version_requirements: &id007 !ruby/object:Gem::Requirement
115
+ requirement: &id007 !ruby/object:Gem::Requirement
118
116
  none: false
119
117
  requirements:
120
118
  - - ">="
@@ -123,12 +121,12 @@ dependencies:
123
121
  segments:
124
122
  - 0
125
123
  version: "0"
126
- requirement: *id007
124
+ prerelease: false
125
+ type: :development
126
+ version_requirements: *id007
127
127
  - !ruby/object:Gem::Dependency
128
128
  name: ruby-debug
129
- type: :development
130
- prerelease: false
131
- version_requirements: &id008 !ruby/object:Gem::Requirement
129
+ requirement: &id008 !ruby/object:Gem::Requirement
132
130
  none: false
133
131
  requirements:
134
132
  - - ">="
@@ -137,12 +135,12 @@ dependencies:
137
135
  segments:
138
136
  - 0
139
137
  version: "0"
140
- requirement: *id008
138
+ prerelease: false
139
+ type: :development
140
+ version_requirements: *id008
141
141
  - !ruby/object:Gem::Dependency
142
142
  name: sqlite3-ruby
143
- type: :development
144
- prerelease: false
145
- version_requirements: &id009 !ruby/object:Gem::Requirement
143
+ requirement: &id009 !ruby/object:Gem::Requirement
146
144
  none: false
147
145
  requirements:
148
146
  - - ">="
@@ -151,12 +149,12 @@ dependencies:
151
149
  segments:
152
150
  - 0
153
151
  version: "0"
154
- requirement: *id009
152
+ prerelease: false
153
+ type: :development
154
+ version_requirements: *id009
155
155
  - !ruby/object:Gem::Dependency
156
156
  name: fastercsv
157
- type: :development
158
- prerelease: false
159
- version_requirements: &id010 !ruby/object:Gem::Requirement
157
+ requirement: &id010 !ruby/object:Gem::Requirement
160
158
  none: false
161
159
  requirements:
162
160
  - - ">="
@@ -165,12 +163,12 @@ dependencies:
165
163
  segments:
166
164
  - 0
167
165
  version: "0"
168
- requirement: *id010
166
+ prerelease: false
167
+ type: :development
168
+ version_requirements: *id010
169
169
  - !ruby/object:Gem::Dependency
170
170
  name: nokogiri
171
- type: :development
172
- prerelease: false
173
- version_requirements: &id011 !ruby/object:Gem::Requirement
171
+ requirement: &id011 !ruby/object:Gem::Requirement
174
172
  none: false
175
173
  requirements:
176
174
  - - ">="
@@ -179,12 +177,12 @@ dependencies:
179
177
  segments:
180
178
  - 0
181
179
  version: "0"
182
- requirement: *id011
180
+ prerelease: false
181
+ type: :development
182
+ version_requirements: *id011
183
183
  - !ruby/object:Gem::Dependency
184
184
  name: will_paginate
185
- type: :development
186
- prerelease: false
187
- version_requirements: &id012 !ruby/object:Gem::Requirement
185
+ requirement: &id012 !ruby/object:Gem::Requirement
188
186
  none: false
189
187
  requirements:
190
188
  - - "="
@@ -195,7 +193,9 @@ dependencies:
195
193
  - 3
196
194
  - 15
197
195
  version: 2.3.15
198
- requirement: *id012
196
+ prerelease: false
197
+ type: :development
198
+ version_requirements: *id012
199
199
  description: This allows you to easily build datagrid aka data tables with sortable columns and filters
200
200
  email: agresso@gmail.com
201
201
  executables: []
@@ -204,14 +204,12 @@ extensions: []
204
204
 
205
205
  extra_rdoc_files:
206
206
  - LICENSE.txt
207
- - README.rdoc
208
207
  files:
209
208
  - .document
210
209
  - .rspec
211
210
  - Gemfile
212
211
  - Gemfile.lock
213
212
  - LICENSE.txt
214
- - README.rdoc
215
213
  - Rakefile
216
214
  - Readme.md
217
215
  - VERSION
@@ -233,6 +231,7 @@ files:
233
231
  - lib/datagrid/form_builder.rb
234
232
  - lib/datagrid/helper.rb
235
233
  - lib/datagrid/rspec.rb
234
+ - spec/datagrid/columns_spec.rb
236
235
  - spec/datagrid/form_builder_spec.rb
237
236
  - spec/datagrid/helper_spec.rb
238
237
  - spec/datagrid_spec.rb
@@ -1,19 +0,0 @@
1
- = datagrid
2
-
3
- Description goes here.
4
-
5
- == Contributing to datagrid
6
-
7
- * Check out the latest master to make sure the feature hasn't been implemented or the bug hasn't been fixed yet
8
- * Check out the issue tracker to make sure someone already hasn't requested it and/or contributed it
9
- * Fork the project
10
- * Start a feature/bugfix branch
11
- * Commit and push until you are happy with your contribution
12
- * Make sure to add tests for it. This is important so I don't break it in a future version unintentionally.
13
- * Please try not to mess with the Rakefile, version, or history. If you want to have your own version, or is otherwise necessary, that is fine, but please isolate to its own commit so I can cherry-pick around it.
14
-
15
- == Copyright
16
-
17
- Copyright (c) 2011 Bogdan Gusiev. See LICENSE.txt for
18
- further details.
19
-