datagrid 1.3.9 → 1.4.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 6d1827360a3a33795e420d9c086607e2934ff3a8
4
- data.tar.gz: 34e08edcc7adcb354dfd7d6b24b19c8a34134c19
3
+ metadata.gz: cb6758027fb0dcc66c2d3a285466b5aed3d4c3f1
4
+ data.tar.gz: ea86794219dd8af94986c010c976809580680b55
5
5
  SHA512:
6
- metadata.gz: d1d458c0938739371e2cf3dd5d16e5c9601dea0f9a6c62b439c542aa8a14d6a84e90c76e7447b03306a51eec91eddb05d97fe454c1020dd25748c89b093cc8fa
7
- data.tar.gz: bd86f70ec51fcf427b33c1b3380b4c4eaf9d7c8e3070ce74606354dace36e973ca5befe383f3cc7c397ebe4e8418d8e568e2cea1621d9372195321295ed5b7f5
6
+ metadata.gz: f91876b2190e994ff3259106a296034ff000ea1f3da233af811491d0c881e7a0bb14519b4a419f048b0865d4a9bc02c275a95ea10b648e2184d36f8d0cd4c50c
7
+ data.tar.gz: a337280ece74f2b3e4b97e2749dde0d6a422405d71b051871222b0c5e2622bc8437e0bbbf40cff5cac04441b456c8640fcda82deb4f0a3399451ae16bb25dd94
data/Gemfile CHANGED
@@ -15,10 +15,11 @@ group :development do
15
15
  gem "nokogiri" # used to test html output
16
16
 
17
17
  gem "sqlite3"
18
+ gem "sequel"
18
19
 
19
20
  group :mongo do
20
21
  gem "mongoid", "3.1.6"
21
- gem "mongo_mapper", ">=0.11.0"
22
+ gem "mongo_mapper", "~> 0.11.0"
22
23
  gem "bson", "1.4.0"
23
24
  gem "bson_ext", "1.4.0"
24
25
  end
@@ -15,6 +15,7 @@ Ruby library that helps you to build and represent table-like data with:
15
15
  * ActiveRecord
16
16
  * Mongoid
17
17
  * MongoMapper
18
+ * Sequel
18
19
  * Array (slow but possible)
19
20
 
20
21
  [Create an issue](https://github.com/bogdan/datagrid/issues/new) if you want more.
@@ -31,7 +32,7 @@ Ruby library that helps you to build and represent table-like data with:
31
32
  In order to create a grid:
32
33
 
33
34
  ``` ruby
34
- class SimpleReport
35
+ class UsersGrid
35
36
 
36
37
  include Datagrid
37
38
 
@@ -61,11 +62,12 @@ end
61
62
  Basic grid api:
62
63
 
63
64
  ``` ruby
64
- report = SimpleReport.new(
65
- :group_id => [1,2], :from_logins_count => 1,
66
- :category => "first",
67
- :order => :group,
68
- :descending => true
65
+ report = UsersGrid.new(
66
+ :group_id => [1,2],
67
+ :logins_count => [1, nil],
68
+ :category => "first",
69
+ :order => :group,
70
+ :descending => true
69
71
  )
70
72
 
71
73
  report.assets # => Array of User instances:
@@ -122,9 +124,9 @@ Datagrid supports different type of filters including:
122
124
  * datetime
123
125
  * boolean
124
126
  * xboolean - the select of "yes", "no" and any
125
- * enum
127
+ * enum - selection of the given values
126
128
  * string
127
- * dynamic
129
+ * dynamic - build dynamic SQL condition
128
130
 
129
131
  [More about filters](https://github.com/bogdan/datagrid/wiki/Filters)
130
132
 
data/VERSION CHANGED
@@ -1 +1 @@
1
- 1.3.9
1
+ 1.4.0
@@ -4,15 +4,19 @@ Local variables:
4
4
  * assets - Array of database Entities
5
5
  * options - passed options Hash
6
6
  %>
7
- <%= content_tag :table, options[:html] do %>
8
- <thead>
9
- <%= datagrid_header(grid, options) %>
10
- </thead>
11
- <tbody>
12
- <% if assets.any? %>
13
- <%= datagrid_rows(grid, assets, options) %>
14
- <% else %>
15
- <tr><td class="noresults" colspan="100%"><%= I18n.t('datagrid.no_results').html_safe %></td></tr>
16
- <% end %>
17
- </tbody>
7
+ <% if grid.html_columns(*options[:columns]).any? %>
8
+ <%= content_tag :table, options[:html] do %>
9
+ <thead>
10
+ <%= datagrid_header(grid, options) %>
11
+ </thead>
12
+ <tbody>
13
+ <% if assets.any? %>
14
+ <%= datagrid_rows(grid, assets, options) %>
15
+ <% else %>
16
+ <tr><td class="noresults" colspan="100%"><%= I18n.t('datagrid.no_results').html_safe %></td></tr>
17
+ <% end %>
18
+ </tbody>
19
+ <% end %>
20
+ <% else -%>
21
+ <%= I18n.t("datagrid.table.no_columns").html_safe %>
18
22
  <% end %>
@@ -2,16 +2,16 @@
2
2
  # DO NOT EDIT THIS FILE DIRECTLY
3
3
  # Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
4
4
  # -*- encoding: utf-8 -*-
5
- # stub: datagrid 1.3.9 ruby lib
5
+ # stub: datagrid 1.4.0 ruby lib
6
6
 
7
7
  Gem::Specification.new do |s|
8
8
  s.name = "datagrid"
9
- s.version = "1.3.9"
9
+ s.version = "1.4.0"
10
10
 
11
11
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
12
12
  s.require_paths = ["lib"]
13
13
  s.authors = ["Bogdan Gusiev"]
14
- s.date = "2015-05-11"
14
+ s.date = "2015-11-05"
15
15
  s.description = "This allows you to easily build datagrid aka data tables with sortable columns and filters"
16
16
  s.email = "agresso@gmail.com"
17
17
  s.extra_rdoc_files = [
@@ -49,6 +49,7 @@ Gem::Specification.new do |s|
49
49
  "lib/datagrid/drivers/array.rb",
50
50
  "lib/datagrid/drivers/mongo_mapper.rb",
51
51
  "lib/datagrid/drivers/mongoid.rb",
52
+ "lib/datagrid/drivers/sequel.rb",
52
53
  "lib/datagrid/engine.rb",
53
54
  "lib/datagrid/filters.rb",
54
55
  "lib/datagrid/filters/base_filter.rb",
@@ -83,6 +84,7 @@ Gem::Specification.new do |s|
83
84
  "spec/datagrid/drivers/array_spec.rb",
84
85
  "spec/datagrid/drivers/mongo_mapper_spec.rb",
85
86
  "spec/datagrid/drivers/mongoid_spec.rb",
87
+ "spec/datagrid/drivers/sequel_spec.rb",
86
88
  "spec/datagrid/filters/boolean_enum_filter_spec.rb",
87
89
  "spec/datagrid/filters/composite_filters_spec.rb",
88
90
  "spec/datagrid/filters/date_filter_spec.rb",
@@ -108,6 +110,7 @@ Gem::Specification.new do |s|
108
110
  "spec/support/matchers.rb",
109
111
  "spec/support/mongo_mapper.rb",
110
112
  "spec/support/mongoid.rb",
113
+ "spec/support/sequel.rb",
111
114
  "spec/support/simple_report.rb",
112
115
  "spec/support/test_partials/_actions.html.erb",
113
116
  "spec/support/test_partials/client/datagrid/_form.html.erb",
@@ -139,8 +142,9 @@ Gem::Specification.new do |s|
139
142
  s.add_development_dependency(%q<rspec>, [">= 3"])
140
143
  s.add_development_dependency(%q<nokogiri>, [">= 0"])
141
144
  s.add_development_dependency(%q<sqlite3>, [">= 0"])
145
+ s.add_development_dependency(%q<sequel>, [">= 0"])
142
146
  s.add_development_dependency(%q<mongoid>, ["= 3.1.6"])
143
- s.add_development_dependency(%q<mongo_mapper>, [">= 0.11.0"])
147
+ s.add_development_dependency(%q<mongo_mapper>, ["~> 0.11.0"])
144
148
  s.add_development_dependency(%q<bson>, ["= 1.4.0"])
145
149
  s.add_development_dependency(%q<bson_ext>, ["= 1.4.0"])
146
150
  else
@@ -152,8 +156,9 @@ Gem::Specification.new do |s|
152
156
  s.add_dependency(%q<rspec>, [">= 3"])
153
157
  s.add_dependency(%q<nokogiri>, [">= 0"])
154
158
  s.add_dependency(%q<sqlite3>, [">= 0"])
159
+ s.add_dependency(%q<sequel>, [">= 0"])
155
160
  s.add_dependency(%q<mongoid>, ["= 3.1.6"])
156
- s.add_dependency(%q<mongo_mapper>, [">= 0.11.0"])
161
+ s.add_dependency(%q<mongo_mapper>, ["~> 0.11.0"])
157
162
  s.add_dependency(%q<bson>, ["= 1.4.0"])
158
163
  s.add_dependency(%q<bson_ext>, ["= 1.4.0"])
159
164
  end
@@ -166,8 +171,9 @@ Gem::Specification.new do |s|
166
171
  s.add_dependency(%q<rspec>, [">= 3"])
167
172
  s.add_dependency(%q<nokogiri>, [">= 0"])
168
173
  s.add_dependency(%q<sqlite3>, [">= 0"])
174
+ s.add_dependency(%q<sequel>, [">= 0"])
169
175
  s.add_dependency(%q<mongoid>, ["= 3.1.6"])
170
- s.add_dependency(%q<mongo_mapper>, [">= 0.11.0"])
176
+ s.add_dependency(%q<mongo_mapper>, ["~> 0.11.0"])
171
177
  s.add_dependency(%q<bson>, ["= 1.4.0"])
172
178
  s.add_dependency(%q<bson_ext>, ["= 1.4.0"])
173
179
  end
@@ -184,10 +184,15 @@ module Datagrid
184
184
  # # ]
185
185
  def dynamic(&block)
186
186
  previous_block = dynamic_block
187
- self.dynamic_block = proc {
188
- instance_eval(&previous_block) if previous_block
189
- instance_eval(&block)
190
- }
187
+ self.dynamic_block =
188
+ if previous_block
189
+ proc {
190
+ instance_eval(&previous_block)
191
+ instance_eval(&block)
192
+ }
193
+ else
194
+ block
195
+ end
191
196
  end
192
197
 
193
198
  def inherited(child_class) #:nodoc:
@@ -319,7 +324,7 @@ module Datagrid
319
324
  def to_csv(*column_names)
320
325
  options = column_names.extract_options!
321
326
  csv_class.generate(
322
- {:headers => self.header(*column_names), :write_headers => true}.merge(options)
327
+ {:headers => self.header(*column_names), :write_headers => true}.merge!(options)
323
328
  ) do |csv|
324
329
  each_with_batches do |asset|
325
330
  csv << row_for(asset, *column_names)
@@ -3,6 +3,7 @@ require "datagrid/drivers/active_record"
3
3
  require "datagrid/drivers/array"
4
4
  require "datagrid/drivers/mongoid"
5
5
  require "datagrid/drivers/mongo_mapper"
6
+ require "datagrid/drivers/sequel"
6
7
 
7
8
 
8
9
  module Datagrid
@@ -94,6 +94,17 @@ module Datagrid
94
94
  raise NotImplementedError
95
95
  end
96
96
 
97
+ def where_by_timestamp_gotcha(scope, name, value)
98
+ value = Datagrid::Utils.format_date_as_timestamp(value)
99
+ if value.first
100
+ scope = greater_equal(scope, name, value.first)
101
+ end
102
+ if value.last
103
+ scope = less_equal(scope, name, value.last)
104
+ end
105
+ scope
106
+ end
107
+
97
108
  protected
98
109
  def timestamp_class?(klass)
99
110
  TIMESTAMP_CLASSES.include?(klass)
@@ -56,7 +56,7 @@ module Datagrid
56
56
  end
57
57
 
58
58
  def default_order(scope, column_name)
59
- has_column?(scope, column_name) ? [scope.table_name, column_name].join(".") : nil
59
+ has_column?(scope, column_name) ? prefix_table_name(scope, column_name) : nil
60
60
  end
61
61
 
62
62
  def greater_equal(scope, field, value)
@@ -127,3 +127,11 @@ module Datagrid
127
127
  end
128
128
  end
129
129
  end
130
+
131
+ if defined?(ActiveRecord::Base)
132
+ ActiveRecord::Base.class_eval do
133
+ def self.datagrid_where_by_timestamp(column, value)
134
+ Datagrid::Drivers::ActiveRecord.new.where_by_timestamp_gotcha(self, column, value)
135
+ end
136
+ end
137
+ end
@@ -97,3 +97,4 @@ module Datagrid
97
97
  end
98
98
  end
99
99
  end
100
+
@@ -0,0 +1,104 @@
1
+ module Datagrid
2
+ module Drivers
3
+ class Sequel < AbstractDriver #:nodoc:
4
+
5
+ def self.match?(scope)
6
+ return false unless defined?(::Sequel)
7
+ if scope.is_a?(Class)
8
+ scope.ancestors.include?(::Sequel::Model)
9
+ else
10
+ scope.is_a?(::Sequel::Dataset)
11
+ end
12
+ end
13
+
14
+ def to_scope(scope)
15
+ return scope if scope.is_a?(::Sequel::Dataset)
16
+ scope.where
17
+ end
18
+
19
+ def append_column_queries(assets, columns)
20
+ super
21
+ end
22
+
23
+ def where(scope, attribute, value)
24
+ scope.where(attribute => value)
25
+ end
26
+
27
+ def asc(scope, order)
28
+ scope.order(::Sequel.lit(order))
29
+ end
30
+
31
+ def desc(scope, order)
32
+ scope.order(::Sequel.desc(::Sequel.lit(order)))
33
+ end
34
+
35
+ def reverse_order(scope)
36
+ super
37
+ end
38
+
39
+ def default_order(scope, column_name)
40
+ has_column?(scope, column_name) ? ::Sequel.lit(prefix_table_name(scope, column_name)) : nil
41
+ end
42
+
43
+ def greater_equal(scope, field, value)
44
+ scope.where(["#{prefix_table_name(scope, field)} >= ?", value])
45
+ end
46
+
47
+ def less_equal(scope, field, value)
48
+ scope.where(["#{prefix_table_name(scope, field)} <= ?", value])
49
+ end
50
+
51
+ def has_column?(scope, column_name)
52
+ scope.columns.include?(column_name.to_sym)
53
+ end
54
+
55
+ def column_names(scope)
56
+ scope.columns
57
+ end
58
+
59
+ def is_timestamp?(scope, column_name)
60
+ column_type(scope, column_name) == :datetime
61
+ end
62
+
63
+ def contains(scope, field, value)
64
+ field = prefix_table_name(scope, field)
65
+ scope.where(Sequel.like(field, "%#{value}%"))
66
+ end
67
+
68
+ def normalized_column_type(scope, field)
69
+ type = column_type(scope, field)
70
+ return nil unless type
71
+ {
72
+ [:string, :blob, :time] => :string,
73
+ [:integer, :primary_key] => :integer,
74
+ [:float, :decimal] => :float,
75
+ [:date] => :date,
76
+ [:datetime] => :datetime,
77
+ [:boolean] => :boolean
78
+ }.each do |keys, value|
79
+ return value if keys.include?(type)
80
+ end
81
+ end
82
+
83
+ def default_cache_key(asset)
84
+ asset.id || raise(NotImplementedError)
85
+ end
86
+
87
+ def batch_each(scope, batch_size, &block)
88
+ scope.extension(:pagination).each_page(batch_size) do |page|
89
+ page.each(&block)
90
+ end
91
+ end
92
+
93
+ protected
94
+
95
+ def prefix_table_name(scope, field)
96
+ has_column?(scope, field) ? [to_scope(scope).row_proc.table_name, field].join(".") : field
97
+ end
98
+
99
+ def column_type(scope, field)
100
+ has_column?(scope, field) ? to_scope(scope).row_proc.db_schema[field.to_sym][:type] : nil
101
+ end
102
+ end
103
+ end
104
+ end
@@ -89,16 +89,6 @@ class Datagrid::Filters::BaseFilter #:nodoc:
89
89
  end
90
90
  end
91
91
 
92
- def default_filter(value, scope, grid)
93
- return nil if dummy?
94
- driver = grid.driver
95
- if !driver.has_column?(scope, name) && driver.to_scope(scope).respond_to?(name)
96
- driver.to_scope(scope).send(name, value)
97
- else
98
- default_filter_where(driver, scope, value)
99
- end
100
- end
101
-
102
92
  def supports_range?
103
93
  self.class.ancestors.include?(::Datagrid::Filters::RangedFilter)
104
94
  end
@@ -122,7 +112,7 @@ class Datagrid::Filters::BaseFilter #:nodoc:
122
112
 
123
113
  protected
124
114
 
125
- def default_filter_where(driver, scope, value)
115
+ def default_filter_where(scope, value)
126
116
  driver.where(scope, name, value)
127
117
  end
128
118
 
@@ -150,5 +140,18 @@ class Datagrid::Filters::BaseFilter #:nodoc:
150
140
  ','
151
141
  end
152
142
 
143
+ def driver
144
+ grid_class.driver
145
+ end
146
+
147
+ def default_filter(value, scope, grid)
148
+ return nil if dummy?
149
+ if !driver.has_column?(scope, name) && driver.to_scope(scope).respond_to?(name)
150
+ driver.to_scope(scope).send(name, value)
151
+ else
152
+ default_filter_where(scope, value)
153
+ end
154
+ end
155
+
153
156
  end
154
157
 
@@ -24,11 +24,11 @@ class Datagrid::Filters::DateFilter < Datagrid::Filters::BaseFilter
24
24
  end
25
25
  end
26
26
 
27
- def default_filter_where(driver, scope, value)
27
+ def default_filter_where(scope, value)
28
28
  if driver.is_timestamp?(scope, name)
29
29
  value = Datagrid::Utils.format_date_as_timestamp(value)
30
30
  end
31
- super(driver, scope, value)
31
+ super(scope, value)
32
32
  end
33
33
 
34
34
  protected
@@ -26,7 +26,7 @@ class Datagrid::Filters::DynamicFilter < Datagrid::Filters::BaseFilter
26
26
  super(value)
27
27
  end
28
28
 
29
- def default_filter_where(driver, scope, filter)
29
+ def default_filter_where(scope, filter)
30
30
  field, operation, value = filter
31
31
  date_conversion = value.is_a?(Date) && driver.is_timestamp?(scope, field)
32
32
 
@@ -36,7 +36,7 @@ module Datagrid::Filters::RangedFilter
36
36
  options[:range]
37
37
  end
38
38
 
39
- def default_filter_where(driver, scope, value)
39
+ def default_filter_where(scope, value)
40
40
  if range? && value.is_a?(Array)
41
41
  left, right = value
42
42
  if left
@@ -47,7 +47,7 @@ module Datagrid::Filters::RangedFilter
47
47
  end
48
48
  scope
49
49
  else
50
- super(driver, scope, value)
50
+ super(scope, value)
51
51
  end
52
52
  end
53
53
 
@@ -33,7 +33,7 @@ module Datagrid
33
33
  end
34
34
 
35
35
  def datagrid_boolean_filter(attribute_or_filter, options = {})
36
- check_box(datagrid_get_attribute(attribute_or_filter), options.reverse_merge(datagrid_extra_checkbox_options))
36
+ check_box(datagrid_get_attribute(attribute_or_filter), options)
37
37
  end
38
38
 
39
39
  def datagrid_date_filter(attribute_or_filter, options = {})
@@ -6,23 +6,11 @@ en:
6
6
  order:
7
7
  asc: "&uarr;"
8
8
  desc: "&darr;"
9
+ no_columns: "No columns selected"
9
10
  form:
10
11
  search: "Search"
11
12
  reset: "Reset"
12
13
  filters:
13
- #integer:
14
- #range_format:
15
- #"%{from_input}<span class=\"separator integer\"> - </span>%{to_input}"
16
- #date:
17
- #range_format:
18
- #"%{from_input}<span class=\"separator date\"> - </span>%{to_input}"
19
- #datetime:
20
- #range_format:
21
- #"%{from_input}<span class=\"separator datetime\"> - </span>%{to_input}"
22
- #float:
23
- #range_format:
24
- #"%{from_input}<span class=\"separator float\"> - </span>%{to_input}"
25
-
26
14
  xboolean:
27
15
  "yes": "Yes"
28
16
  "no": "No"
@@ -38,7 +38,7 @@ shared_examples_for "Datagrid" do
38
38
  "text"
39
39
  when :date
40
40
  1.day.ago
41
- when :eboolean
41
+ when :xboolean, :eboolean
42
42
  Datagrid::Filters::BooleanEnumFilter::YES
43
43
  when :boolean
44
44
  true
@@ -96,13 +96,13 @@ module Datagrid
96
96
  if value.is_a?(String)
97
97
  Array(Datagrid.configuration.datetime_formats).each do |format|
98
98
  begin
99
- return DateTime.strptime(value, format)
99
+ return Time.strptime(value, format)
100
100
  rescue ::ArgumentError
101
101
  end
102
102
  end
103
103
  end
104
- return DateTime.parse(value) if value.is_a?(String)
105
- return value.to_datetime if value.respond_to?(:to_datetime)
104
+ return Time.parse(value) if value.is_a?(String)
105
+ return value.to_time if value.respond_to?(:to_time)
106
106
  value
107
107
  rescue ::ArgumentError
108
108
  nil
@@ -39,6 +39,12 @@ describe Datagrid::ColumnNamesAttribute do
39
39
  expect(subject.row_for(entry)).to eq(["hello", "greeting"])
40
40
  end
41
41
 
42
+ it "should show mandatory columns even if they are unselected" do
43
+ subject.column_names = ["category"]
44
+ expect(subject.row_for(entry)).to eq(["hello", "greeting"])
45
+ expect(subject.data).to eq([["Name", "Category"], ["hello", "greeting"]])
46
+ end
47
+
42
48
  it "should find any column by name" do
43
49
  expect(subject.column_by_name(:id)).not_to be_nil
44
50
  expect(subject.column_by_name(:name)).not_to be_nil
@@ -20,4 +20,34 @@ describe Datagrid::Drivers::ActiveRecord do
20
20
  scope = subject.append_column_queries(Entry.where({}), [Datagrid::Columns::Column.new(test_report_class, :sum_group_id, 'sum(entries.group_id)')])
21
21
  expect(scope.to_sql.strip).to eq('SELECT "entries".*, sum(entries.group_id) AS sum_group_id FROM "entries"')
22
22
  end
23
+
24
+
25
+ describe "gotcha #datagrid_where_by_timestamp" do
26
+
27
+ subject do
28
+ test_report(created_at: 10.days.ago..5.days.ago) do
29
+ scope {Entry}
30
+
31
+ filter(:created_at, :date, range: true) do |value, scope, grid|
32
+ scope.joins(:group).datagrid_where_by_timestamp("groups.created_at", value)
33
+ end
34
+ end.assets
35
+ end
36
+ it "includes object created in proper range" do
37
+ expect(subject).to include(
38
+ Entry.create!(group: Group.create!(created_at: 7.days.ago)),
39
+ )
40
+ end
41
+
42
+ it "excludes object created before the range" do
43
+ expect(subject).to_not include(
44
+ Entry.create!(created_at: 7.days.ago, group: Group.create!(created_at: 11.days.ago)),
45
+ )
46
+ end
47
+ it "excludes object created after the range" do
48
+ expect(subject).to_not include(
49
+ Entry.create!(created_at: 7.days.ago, group: Group.create!(created_at: 4.days.ago)),
50
+ )
51
+ end
52
+ end
23
53
  end
@@ -0,0 +1,111 @@
1
+ require 'spec_helper'
2
+
3
+ describe Datagrid::Drivers::Sequel do
4
+
5
+ describe ".match?" do
6
+
7
+ subject { described_class }
8
+
9
+ it {should be_match(SequelEntry)}
10
+ it {should be_match(SequelEntry.where(:id => 1))}
11
+ it {should_not be_match(Entry.where(:id => 1))}
12
+
13
+ end
14
+ describe "api" do
15
+
16
+ subject do
17
+ SequelGrid.new(
18
+ defined?(_attributes) ? _attributes : {}
19
+ )
20
+ end
21
+
22
+ let!(:first) do
23
+ SequelEntry.create(
24
+ :group_id => 2,
25
+ :name => "Main First",
26
+ :disabled => false
27
+ )
28
+ end
29
+ let!(:second) do
30
+ SequelEntry.create(
31
+ :group_id => 3,
32
+ :name => "Main Second",
33
+ :disabled => true
34
+ )
35
+ end
36
+
37
+
38
+ describe '#assets' do
39
+ subject { super().assets }
40
+ it {should include(first, second)}
41
+ end
42
+
43
+ describe '#assets' do
44
+ subject { super().assets }
45
+ describe '#size' do
46
+ subject { super().count }
47
+ it {should == 2}
48
+ end
49
+ end
50
+
51
+ describe '#rows' do
52
+ subject { super().rows }
53
+ it {should == [["Main First", 2, false], ["Main Second", 3, true]]}
54
+ end
55
+
56
+ describe '#header' do
57
+ subject { super().header }
58
+ it {should ==[ "Name", "Group", "Disabled"]}
59
+ end
60
+
61
+ describe '#data' do
62
+ subject { super().data }
63
+ it {should == [[ "Name", "Group", "Disabled"], ["Main First", 2, false], ["Main Second", 3, true]]}
64
+ end
65
+
66
+
67
+ describe "when some filters specified" do
68
+ let(:_attributes) { {:from_group_id => 3} }
69
+
70
+ describe '#assets' do
71
+ subject { super().assets.map(&:id) }
72
+ it {should_not include(first.id)}
73
+ end
74
+
75
+ describe '#assets' do
76
+ subject { super().assets }
77
+ it {should include(second)}
78
+ end
79
+ end
80
+
81
+ describe "when reverse ordering is specified" do
82
+ let(:_attributes) { {:order => :name, :descending => true} }
83
+
84
+ describe '#rows' do
85
+ subject { super().rows }
86
+ it {should == [["Main Second", 3, true], ["Main First", 2, false]]}
87
+ end
88
+ end
89
+
90
+ it "should provide default order for non declared fields" do
91
+ expect {
92
+ test_report(:order => :test) do
93
+ scope { SequelEntry }
94
+ column(:test) do
95
+ 'test'
96
+ end
97
+ end.assets
98
+ }.to raise_error(Datagrid::OrderUnsupported)
99
+ end
100
+
101
+ it "should support batch_size" do
102
+ report = test_report do
103
+ scope { SequelEntry }
104
+ self.batch_size = 1
105
+ column(:name)
106
+ end
107
+
108
+ expect(report.data).to eq([["Name"], ["Main First"], ["Main Second"]])
109
+ end
110
+ end
111
+ end
@@ -15,7 +15,7 @@ describe Datagrid::Filters::DateFilter do
15
15
  expect(report.assets).not_to include(e3)
16
16
  end
17
17
 
18
- {:active_record => Entry, :mongoid => MongoidEntry}.each do |orm, klass|
18
+ {:active_record => Entry, :mongoid => MongoidEntry, :sequel => SequelEntry}.each do |orm, klass|
19
19
  describe "with orm #{orm}", orm => true do
20
20
  describe "date to timestamp conversion" do
21
21
  let(:klass) { klass }
@@ -127,7 +127,7 @@ describe Datagrid::Filters::DateFilter do
127
127
  end
128
128
  end
129
129
  expect(report.assets).not_to include(Entry.create!(:created_at => 1.day.ago))
130
- expect(report.assets).to include(Entry.create!(:created_at => DateTime.now))
130
+ expect(report.assets).to include(Entry.create!(:created_at => Time.now))
131
131
  end
132
132
 
133
133
 
@@ -22,17 +22,17 @@ describe Datagrid::Filters::DateTimeFilter do
22
22
  end
23
23
 
24
24
  context "when single datetime paramter given" do
25
- let(:_created_at) { DateTime.now }
26
- it { should include(entry_dated(_created_at))}
25
+ let(:_created_at) { Time.now.change(sec: 0) }
26
+ it { should include(entry_dated(_created_at)) }
27
27
  it { should_not include(entry_dated(_created_at - 1.second))}
28
28
  it { should_not include(entry_dated(_created_at + 1.second))}
29
29
  end
30
30
 
31
31
  context "when range datetime range given" do
32
- let(:_created_at) { [DateTime.now.beginning_of_day, DateTime.now.end_of_day] }
32
+ let(:_created_at) { [Time.now.beginning_of_day, Time.now.end_of_day] }
33
33
  it { should include(entry_dated(1.second.ago))}
34
- it { should include(entry_dated(Date.today.to_datetime))}
35
- it { should include(entry_dated(DateTime.now.end_of_day.to_datetime))}
34
+ it { should include(entry_dated(Date.today.to_time))}
35
+ it { should include(entry_dated(Time.now.end_of_day.to_time))}
36
36
  it { should_not include(entry_dated(Date.yesterday.end_of_day))}
37
37
  it { should_not include(entry_dated(Date.tomorrow.beginning_of_day))}
38
38
  end
@@ -42,10 +42,10 @@ describe Datagrid::Filters::DateTimeFilter do
42
42
  end
43
43
 
44
44
  it "should support datetime range given as array argument" do
45
- e1 = Entry.create!(:created_at => DateTime.new(2013, 1, 1, 1, 0))
46
- e2 = Entry.create!(:created_at => DateTime.new(2013, 1, 1, 2, 0))
47
- e3 = Entry.create!(:created_at => DateTime.new(2013, 1, 1, 3, 0))
48
- report = test_report(:created_at => [DateTime.new(2013, 1, 1, 1, 30).to_s, DateTime.new(2013, 1, 1, 2, 30).to_s]) do
45
+ e1 = Entry.create!(:created_at => Time.new(2013, 1, 1, 1, 0))
46
+ e2 = Entry.create!(:created_at => Time.new(2013, 1, 1, 2, 0))
47
+ e3 = Entry.create!(:created_at => Time.new(2013, 1, 1, 3, 0))
48
+ report = test_report(:created_at => [Time.new(2013, 1, 1, 1, 30).to_s, Time.new(2013, 1, 1, 2, 30).to_s]) do
49
49
  scope { Entry }
50
50
  filter(:created_at, :datetime, :range => true)
51
51
  end
@@ -55,10 +55,10 @@ describe Datagrid::Filters::DateTimeFilter do
55
55
  end
56
56
 
57
57
  it "should support minimum datetime argument" do
58
- e1 = Entry.create!(:created_at => DateTime.new(2013, 1, 1, 1, 0))
59
- e2 = Entry.create!(:created_at => DateTime.new(2013, 1, 1, 2, 0))
60
- e3 = Entry.create!(:created_at => DateTime.new(2013, 1, 1, 3, 0))
61
- report = test_report(:created_at => [DateTime.new(2013, 1, 1, 1, 30).to_s, nil]) do
58
+ e1 = Entry.create!(:created_at => Time.new(2013, 1, 1, 1, 0))
59
+ e2 = Entry.create!(:created_at => Time.new(2013, 1, 1, 2, 0))
60
+ e3 = Entry.create!(:created_at => Time.new(2013, 1, 1, 3, 0))
61
+ report = test_report(:created_at => [Time.new(2013, 1, 1, 1, 30).to_s, nil]) do
62
62
  scope { Entry }
63
63
  filter(:created_at, :datetime, :range => true)
64
64
  end
@@ -68,10 +68,10 @@ describe Datagrid::Filters::DateTimeFilter do
68
68
  end
69
69
 
70
70
  it "should support maximum datetime argument" do
71
- e1 = Entry.create!(:created_at => DateTime.new(2013, 1, 1, 1, 0))
72
- e2 = Entry.create!(:created_at => DateTime.new(2013, 1, 1, 2, 0))
73
- e3 = Entry.create!(:created_at => DateTime.new(2013, 1, 1, 3, 0))
74
- report = test_report(:created_at => [nil, DateTime.new(2013, 1, 1, 2, 30).to_s]) do
71
+ e1 = Entry.create!(:created_at => Time.new(2013, 1, 1, 1, 0))
72
+ e2 = Entry.create!(:created_at => Time.new(2013, 1, 1, 2, 0))
73
+ e3 = Entry.create!(:created_at => Time.new(2013, 1, 1, 3, 0))
74
+ report = test_report(:created_at => [nil, Time.new(2013, 1, 1, 2, 30).to_s]) do
75
75
  scope { Entry }
76
76
  filter(:created_at, :datetime, :range => true)
77
77
  end
@@ -82,10 +82,10 @@ describe Datagrid::Filters::DateTimeFilter do
82
82
 
83
83
  it "should find something in one second interval" do
84
84
 
85
- e1 = Entry.create!(:created_at => DateTime.new(2013, 1, 1, 1, 0))
86
- e2 = Entry.create!(:created_at => DateTime.new(2013, 1, 1, 2, 0))
87
- e3 = Entry.create!(:created_at => DateTime.new(2013, 1, 1, 3, 0))
88
- report = test_report(:created_at => (DateTime.new(2013, 1, 1, 2, 0)..DateTime.new(2013, 1, 1, 2, 0))) do
85
+ e1 = Entry.create!(:created_at => Time.new(2013, 1, 1, 1, 0))
86
+ e2 = Entry.create!(:created_at => Time.new(2013, 1, 1, 2, 0))
87
+ e3 = Entry.create!(:created_at => Time.new(2013, 1, 1, 3, 0))
88
+ report = test_report(:created_at => (Time.new(2013, 1, 1, 2, 0)..Time.new(2013, 1, 1, 2, 0))) do
89
89
  scope { Entry }
90
90
  filter(:created_at, :datetime, :range => true)
91
91
  end
@@ -95,10 +95,10 @@ describe Datagrid::Filters::DateTimeFilter do
95
95
  end
96
96
  it "should support invalid range" do
97
97
 
98
- e1 = Entry.create!(:created_at => DateTime.new(2013, 1, 1, 1, 0))
99
- e2 = Entry.create!(:created_at => DateTime.new(2013, 1, 1, 2, 0))
100
- e3 = Entry.create!(:created_at => DateTime.new(2013, 1, 1, 3, 0))
101
- report = test_report(:created_at => (DateTime.new(2013, 1, 1, 3, 0)..DateTime.new(2013, 1, 1, 1, 0))) do
98
+ e1 = Entry.create!(:created_at => Time.new(2013, 1, 1, 1, 0))
99
+ e2 = Entry.create!(:created_at => Time.new(2013, 1, 1, 2, 0))
100
+ e3 = Entry.create!(:created_at => Time.new(2013, 1, 1, 3, 0))
101
+ report = test_report(:created_at => (Time.new(2013, 1, 1, 3, 0)..Time.new(2013, 1, 1, 1, 0))) do
102
102
  scope { Entry }
103
103
  filter(:created_at, :datetime, :range => true)
104
104
  end
@@ -109,14 +109,14 @@ describe Datagrid::Filters::DateTimeFilter do
109
109
 
110
110
 
111
111
  it "should support block" do
112
- report = test_report(:created_at => DateTime.now) do
112
+ report = test_report(:created_at => Time.now) do
113
113
  scope { Entry }
114
114
  filter(:created_at, :datetime, :range => true) do |value|
115
115
  where("created_at >= ?", value)
116
116
  end
117
117
  end
118
118
  expect(report.assets).not_to include(Entry.create!(:created_at => 1.day.ago))
119
- expect(report.assets).to include(Entry.create!(:created_at => DateTime.tomorrow))
119
+ expect(report.assets).to include(Entry.create!(:created_at => Time.now+1.day))
120
120
  end
121
121
 
122
122
 
@@ -132,15 +132,15 @@ describe Datagrid::Filters::DateTimeFilter do
132
132
  scope {Entry}
133
133
  filter(:created_at, :datetime)
134
134
  end
135
- expect(report.created_at).to eq(DateTime.new(2013,10,01,1,0))
135
+ expect(report.created_at).to eq(Time.new(2013,10,01,1,0))
136
136
  end
137
137
 
138
138
  it "should support default explicit datetime" do
139
- report = test_report(:created_at => DateTime.parse("2013-10-01 01:00")) do
139
+ report = test_report(:created_at => Time.parse("2013-10-01 01:00")) do
140
140
  scope {Entry}
141
141
  filter(:created_at, :datetime)
142
142
  end
143
- expect(report.created_at).to eq(DateTime.new(2013,10,01,1,0))
143
+ expect(report.created_at).to eq(Time.new(2013,10,01,1,0))
144
144
  end
145
145
  end
146
146
 
@@ -150,6 +150,6 @@ describe Datagrid::Filters::DateTimeFilter do
150
150
  scope {Entry}
151
151
  filter(:created_at, :datetime, :range => true)
152
152
  end
153
- expect(report.created_at).to eq([DateTime.new(2012, 01, 01, 1, 0), DateTime.new(2013, 01, 01, 1, 0)])
153
+ expect(report.created_at).to eq([Time.new(2012, 01, 01, 1, 0), Time.new(2013, 01, 01, 1, 0)])
154
154
  end
155
155
  end
@@ -77,33 +77,33 @@ describe Datagrid::Filters::DynamicFilter do
77
77
  it "should support date comparation operation by timestamp column" do
78
78
  report.condition = [:created_at, "<=", '1986-08-05']
79
79
  expect(report.condition).to eq([:created_at, "<=", Date.parse('1986-08-05')])
80
- expect(report.assets).to include(Entry.create!(:created_at => DateTime.parse('1986-08-04 01:01:01')))
81
- expect(report.assets).to include(Entry.create!(:created_at => DateTime.parse('1986-08-05 23:59:59')))
82
- expect(report.assets).to include(Entry.create!(:created_at => DateTime.parse('1986-08-05 00:00:00')))
83
- expect(report.assets).not_to include(Entry.create!(:created_at => DateTime.parse('1986-08-06 00:00:00')))
84
- expect(report.assets).not_to include(Entry.create!(:created_at => DateTime.parse('1986-08-06 23:59:59')))
80
+ expect(report.assets).to include(Entry.create!(:created_at => Time.parse('1986-08-04 01:01:01')))
81
+ expect(report.assets).to include(Entry.create!(:created_at => Time.parse('1986-08-05 23:59:59')))
82
+ expect(report.assets).to include(Entry.create!(:created_at => Time.parse('1986-08-05 00:00:00')))
83
+ expect(report.assets).not_to include(Entry.create!(:created_at => Time.parse('1986-08-06 00:00:00')))
84
+ expect(report.assets).not_to include(Entry.create!(:created_at => Time.parse('1986-08-06 23:59:59')))
85
85
  end
86
86
 
87
87
  it "should support date = operation by timestamp column" do
88
88
  report.condition = [:created_at, "=", '1986-08-05']
89
89
  expect(report.condition).to eq([:created_at, "=", Date.parse('1986-08-05')])
90
- expect(report.assets).not_to include(Entry.create!(:created_at => DateTime.parse('1986-08-04 23:59:59')))
91
- expect(report.assets).to include(Entry.create!(:created_at => DateTime.parse('1986-08-05 23:59:59')))
92
- expect(report.assets).to include(Entry.create!(:created_at => DateTime.parse('1986-08-05 00:00:01')))
90
+ expect(report.assets).not_to include(Entry.create!(:created_at => Time.parse('1986-08-04 23:59:59')))
91
+ expect(report.assets).to include(Entry.create!(:created_at => Time.parse('1986-08-05 23:59:59')))
92
+ expect(report.assets).to include(Entry.create!(:created_at => Time.parse('1986-08-05 00:00:01')))
93
93
  #TODO: investigate SQLite issue and uncomment this line
94
- #report.assets.should include(Entry.create!(:created_at => DateTime.parse('1986-08-05 00:00:00')))
95
- expect(report.assets).not_to include(Entry.create!(:created_at => DateTime.parse('1986-08-06 23:59:59')))
94
+ #report.assets.should include(Entry.create!(:created_at => Time.parse('1986-08-05 00:00:00')))
95
+ expect(report.assets).not_to include(Entry.create!(:created_at => Time.parse('1986-08-06 23:59:59')))
96
96
  end
97
97
 
98
98
  it "should support date =~ operation by timestamp column" do
99
99
  report.condition = [:created_at, "=~", '1986-08-05']
100
100
  expect(report.condition).to eq([:created_at, "=~", Date.parse('1986-08-05')])
101
- expect(report.assets).not_to include(Entry.create!(:created_at => DateTime.parse('1986-08-04 23:59:59')))
102
- expect(report.assets).to include(Entry.create!(:created_at => DateTime.parse('1986-08-05 23:59:59')))
103
- expect(report.assets).to include(Entry.create!(:created_at => DateTime.parse('1986-08-05 00:00:01')))
101
+ expect(report.assets).not_to include(Entry.create!(:created_at => Time.parse('1986-08-04 23:59:59')))
102
+ expect(report.assets).to include(Entry.create!(:created_at => Time.parse('1986-08-05 23:59:59')))
103
+ expect(report.assets).to include(Entry.create!(:created_at => Time.parse('1986-08-05 00:00:01')))
104
104
  #TODO: investigate SQLite issue and uncomment this line
105
- #report.assets.should include(Entry.create!(:created_at => DateTime.parse('1986-08-05 00:00:00')))
106
- expect(report.assets).not_to include(Entry.create!(:created_at => DateTime.parse('1986-08-06 23:59:59')))
105
+ #report.assets.should include(Entry.create!(:created_at => Time.parse('1986-08-05 00:00:00')))
106
+ expect(report.assets).not_to include(Entry.create!(:created_at => Time.parse('1986-08-06 23:59:59')))
107
107
  end
108
108
 
109
109
  it "should support operations for invalid date" do
@@ -346,16 +346,29 @@ describe Datagrid::FormBuilder do
346
346
  end
347
347
  end
348
348
 
349
- context "with eboolean filter type" do
349
+ context "with boolean filter type" do
350
350
  let(:_filter) { :disabled }
351
351
  let(:_grid) do
352
352
  test_report do
353
353
  scope {Entry}
354
- filter(:disabled, :eboolean)
354
+ filter(:disabled, :boolean, default: true)
355
355
  end
356
356
  end
357
357
  it { should equal_to_dom(
358
- '<select class="disabled boolean_enum_filter" id="report_disabled" name="report[disabled]"><option value=""></option>
358
+ # hidden is important when default is set to true
359
+ '<input name="report[disabled]" type="hidden" value="0"><input checked class="disabled boolean_filter" id="report_disabled" name="report[disabled]" type="checkbox" value="1">'
360
+ )}
361
+ end
362
+ context "with xboolean filter type" do
363
+ let(:_filter) { :disabled }
364
+ let(:_grid) do
365
+ test_report do
366
+ scope {Entry}
367
+ filter(:disabled, :xboolean)
368
+ end
369
+ end
370
+ it { should equal_to_dom(
371
+ '<select class="disabled extended_boolean_filter" id="report_disabled" name="report[disabled]"><option value=""></option>
359
372
  <option value="YES">Yes</option>
360
373
  <option value="NO">No</option></select>'
361
374
  )}
@@ -31,6 +31,7 @@ describe Datagrid::Helper do
31
31
  let(:grid) do
32
32
  test_report do
33
33
  scope { Entry.where("1 != 1") }
34
+ column(:id)
34
35
  end
35
36
  end
36
37
 
@@ -55,6 +56,7 @@ describe Datagrid::Helper do
55
56
  class TestGrid
56
57
  include Datagrid
57
58
  scope { Entry }
59
+ column(:id)
58
60
  end
59
61
  end
60
62
  expect(subject.datagrid_table(::Ns23::TestGrid.new)).to match_css_pattern(
@@ -128,6 +130,18 @@ describe Datagrid::Helper do
128
130
  end
129
131
  end
130
132
 
133
+ context "when grid has no columns" do
134
+ let(:grid) do
135
+ test_report do
136
+ scope {Entry}
137
+ end
138
+ end
139
+
140
+ it "should render no_columns message" do
141
+ expect(subject.datagrid_table(grid, [entry])).to equal_to_dom("No columns selected")
142
+ end
143
+ end
144
+
131
145
  context 'with partials attribute' do
132
146
  let(:grid) do
133
147
  test_report do
@@ -75,6 +75,7 @@ RSpec.configure do |config|
75
75
  #TODO better database truncation
76
76
  Group.delete_all
77
77
  Entry.delete_all
78
+ SequelEntry.where.delete
78
79
  unless NO_MONGO
79
80
  MongoidEntry.delete_all
80
81
  MongoMapperEntry.delete_all
@@ -99,6 +100,4 @@ end
99
100
  # Requires supporting files with custom matchers and macros, etc,
100
101
  # in ./support/ and its subdirectories.
101
102
  Dir["#{File.dirname(__FILE__)}/support/schema.rb"].each {|f| require f}
102
- Dir["#{File.dirname(__FILE__)}/support/mongoid.rb"].each {|f| require f}
103
- Dir["#{File.dirname(__FILE__)}/support/mongo_mapper.rb"].each {|f| require f}
104
103
  Dir["#{File.dirname(__FILE__)}/support/**/*.rb"].each {|f| require f}
@@ -8,7 +8,7 @@ class MongoMapperEntry
8
8
  key :category, String
9
9
  key :disabled, Boolean, :default => false
10
10
  key :confirmed, Boolean, :default => false
11
- key :shipping_date, DateTime
11
+ key :shipping_date, Time
12
12
  timestamps!
13
13
 
14
14
  end
@@ -22,7 +22,7 @@ class MongoMapperGrid
22
22
 
23
23
  filter :name
24
24
  integer_range_filters(:group_id, {:default => 0}, {:default => 100})
25
- filter :disabled, :eboolean
25
+ filter :disabled, :xboolean
26
26
 
27
27
  column :name
28
28
  column :group_id
@@ -13,7 +13,7 @@ class MongoidEntry
13
13
  field :category, :type => String
14
14
  field :disabled, :default => false, :type => Boolean
15
15
  field :confirmed, :default => false, :type => Boolean
16
- field :shipping_date, :type => DateTime
16
+ field :shipping_date, :type => Time
17
17
 
18
18
  end
19
19
 
@@ -26,7 +26,7 @@ class MongoidGrid
26
26
 
27
27
  filter :name
28
28
  integer_range_filters(:group_id, {:default => 0}, {:default => 100})
29
- filter :disabled, :eboolean
29
+ filter :disabled, :xboolean
30
30
 
31
31
  column :name
32
32
  column :group_id
@@ -0,0 +1,39 @@
1
+ require "sequel"
2
+
3
+
4
+ DB = Sequel.sqlite # memory database
5
+
6
+ DB.create_table :sequel_entries do
7
+ primary_key :id
8
+
9
+ Integer :group_id
10
+ String :name
11
+ String :category
12
+ Boolean :disabled
13
+ Boolean :confirmed
14
+ Time :shipping_date
15
+ Time :created_at
16
+ end
17
+
18
+ class SequelEntry < Sequel::Model
19
+
20
+ end
21
+
22
+
23
+ class SequelGrid
24
+ include ::Datagrid
25
+
26
+ scope do
27
+ SequelEntry
28
+ end
29
+
30
+ filter :name
31
+ integer_range_filters(:group_id, {:default => 0}, {:default => 100})
32
+ filter :disabled, :xboolean
33
+
34
+ column :name
35
+ column :group_id
36
+ column :disabled
37
+
38
+ end
39
+
@@ -29,7 +29,7 @@ class SimpleReport
29
29
 
30
30
  filter(:group_id, :integer, :multiple => true)
31
31
  filter(:category, :enum, :select => ["first", "second"])
32
- filter(:disabled, :eboolean)
32
+ filter(:disabled, :xboolean)
33
33
  filter(:confirmed, :boolean)
34
34
 
35
35
  filter(:name) do |value|
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: datagrid
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.3.9
4
+ version: 1.4.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Bogdan Gusiev
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-05-11 00:00:00.000000000 Z
11
+ date: 2015-11-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -122,6 +122,20 @@ dependencies:
122
122
  - - ">="
123
123
  - !ruby/object:Gem::Version
124
124
  version: '0'
125
+ - !ruby/object:Gem::Dependency
126
+ name: sequel
127
+ requirement: !ruby/object:Gem::Requirement
128
+ requirements:
129
+ - - ">="
130
+ - !ruby/object:Gem::Version
131
+ version: '0'
132
+ type: :development
133
+ prerelease: false
134
+ version_requirements: !ruby/object:Gem::Requirement
135
+ requirements:
136
+ - - ">="
137
+ - !ruby/object:Gem::Version
138
+ version: '0'
125
139
  - !ruby/object:Gem::Dependency
126
140
  name: mongoid
127
141
  requirement: !ruby/object:Gem::Requirement
@@ -140,14 +154,14 @@ dependencies:
140
154
  name: mongo_mapper
141
155
  requirement: !ruby/object:Gem::Requirement
142
156
  requirements:
143
- - - ">="
157
+ - - "~>"
144
158
  - !ruby/object:Gem::Version
145
159
  version: 0.11.0
146
160
  type: :development
147
161
  prerelease: false
148
162
  version_requirements: !ruby/object:Gem::Requirement
149
163
  requirements:
150
- - - ">="
164
+ - - "~>"
151
165
  - !ruby/object:Gem::Version
152
166
  version: 0.11.0
153
167
  - !ruby/object:Gem::Dependency
@@ -217,6 +231,7 @@ files:
217
231
  - lib/datagrid/drivers/array.rb
218
232
  - lib/datagrid/drivers/mongo_mapper.rb
219
233
  - lib/datagrid/drivers/mongoid.rb
234
+ - lib/datagrid/drivers/sequel.rb
220
235
  - lib/datagrid/engine.rb
221
236
  - lib/datagrid/filters.rb
222
237
  - lib/datagrid/filters/base_filter.rb
@@ -251,6 +266,7 @@ files:
251
266
  - spec/datagrid/drivers/array_spec.rb
252
267
  - spec/datagrid/drivers/mongo_mapper_spec.rb
253
268
  - spec/datagrid/drivers/mongoid_spec.rb
269
+ - spec/datagrid/drivers/sequel_spec.rb
254
270
  - spec/datagrid/filters/boolean_enum_filter_spec.rb
255
271
  - spec/datagrid/filters/composite_filters_spec.rb
256
272
  - spec/datagrid/filters/date_filter_spec.rb
@@ -276,6 +292,7 @@ files:
276
292
  - spec/support/matchers.rb
277
293
  - spec/support/mongo_mapper.rb
278
294
  - spec/support/mongoid.rb
295
+ - spec/support/sequel.rb
279
296
  - spec/support/simple_report.rb
280
297
  - spec/support/test_partials/_actions.html.erb
281
298
  - spec/support/test_partials/client/datagrid/_form.html.erb