datagrid 1.5.2 → 1.5.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/VERSION +1 -1
- data/datagrid.gemspec +47 -47
- data/lib/datagrid/filters.rb +1 -1
- data/spec/datagrid/filters_spec.rb +28 -0
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 73197170df7e4ea6b273acbf39a305d2fda2e43f
|
4
|
+
data.tar.gz: d5b443380915e544d250a887eed816f87872eaf3
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 20eab0fc5d58eadb673fc1f0a4c0a3a844bf04b0a3511e9f20365f9b73462b343a58e393492819705910571782a57802e36108fae67486a443bdd7e314cfe37d
|
7
|
+
data.tar.gz: 90de90dc86bbbed3887c637b6d8d4c1da92a6467da19ab8248c84ec9280311c510750ccf8c38e7b5bf90dbc0d244b840164e155477f94ad6d008634d50bcc116
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
1.5.
|
1
|
+
1.5.3
|
data/datagrid.gemspec
CHANGED
@@ -2,18 +2,18 @@
|
|
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.5.
|
5
|
+
# stub: datagrid 1.5.3 ruby lib
|
6
6
|
|
7
7
|
Gem::Specification.new do |s|
|
8
|
-
s.name = "datagrid"
|
9
|
-
s.version = "1.5.
|
8
|
+
s.name = "datagrid".freeze
|
9
|
+
s.version = "1.5.3"
|
10
10
|
|
11
|
-
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
12
|
-
s.require_paths = ["lib"]
|
13
|
-
s.authors = ["Bogdan Gusiev"]
|
14
|
-
s.date = "2017-
|
15
|
-
s.description = "This allows you to easily build datagrid aka data tables with sortable columns and filters"
|
16
|
-
s.email = "agresso@gmail.com"
|
11
|
+
s.required_rubygems_version = Gem::Requirement.new(">= 0".freeze) if s.respond_to? :required_rubygems_version=
|
12
|
+
s.require_paths = ["lib".freeze]
|
13
|
+
s.authors = ["Bogdan Gusiev".freeze]
|
14
|
+
s.date = "2017-03-06"
|
15
|
+
s.description = "This allows you to easily build datagrid aka data tables with sortable columns and filters".freeze
|
16
|
+
s.email = "agresso@gmail.com".freeze
|
17
17
|
s.extra_rdoc_files = [
|
18
18
|
"LICENSE.txt"
|
19
19
|
]
|
@@ -126,52 +126,52 @@ Gem::Specification.new do |s|
|
|
126
126
|
"templates/grid.rb.erb",
|
127
127
|
"templates/index.html.erb"
|
128
128
|
]
|
129
|
-
s.homepage = "http://github.com/bogdan/datagrid"
|
130
|
-
s.licenses = ["MIT"]
|
131
|
-
s.required_ruby_version = Gem::Requirement.new(">= 2.0")
|
132
|
-
s.rubygems_version = "2.
|
133
|
-
s.summary = "Ruby gem to create datagrids"
|
129
|
+
s.homepage = "http://github.com/bogdan/datagrid".freeze
|
130
|
+
s.licenses = ["MIT".freeze]
|
131
|
+
s.required_ruby_version = Gem::Requirement.new(">= 2.0".freeze)
|
132
|
+
s.rubygems_version = "2.6.7".freeze
|
133
|
+
s.summary = "Ruby gem to create datagrids".freeze
|
134
134
|
|
135
135
|
if s.respond_to? :specification_version then
|
136
136
|
s.specification_version = 4
|
137
137
|
|
138
138
|
if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
|
139
|
-
s.add_runtime_dependency(%q<rails
|
140
|
-
s.add_development_dependency(%q<bundler
|
141
|
-
s.add_development_dependency(%q<jeweler
|
142
|
-
s.add_development_dependency(%q<pry-byebug
|
143
|
-
s.add_development_dependency(%q<rspec
|
144
|
-
s.add_development_dependency(%q<nokogiri
|
145
|
-
s.add_development_dependency(%q<sqlite3
|
146
|
-
s.add_development_dependency(%q<sequel
|
147
|
-
s.add_development_dependency(%q<mongoid
|
148
|
-
s.add_development_dependency(%q<bson
|
149
|
-
s.add_development_dependency(%q<bson_ext
|
139
|
+
s.add_runtime_dependency(%q<rails>.freeze, [">= 4.0"])
|
140
|
+
s.add_development_dependency(%q<bundler>.freeze, [">= 0"])
|
141
|
+
s.add_development_dependency(%q<jeweler>.freeze, [">= 2.1.2"])
|
142
|
+
s.add_development_dependency(%q<pry-byebug>.freeze, [">= 0"])
|
143
|
+
s.add_development_dependency(%q<rspec>.freeze, [">= 3"])
|
144
|
+
s.add_development_dependency(%q<nokogiri>.freeze, [">= 0"])
|
145
|
+
s.add_development_dependency(%q<sqlite3>.freeze, [">= 0"])
|
146
|
+
s.add_development_dependency(%q<sequel>.freeze, [">= 0"])
|
147
|
+
s.add_development_dependency(%q<mongoid>.freeze, [">= 0"])
|
148
|
+
s.add_development_dependency(%q<bson>.freeze, [">= 0"])
|
149
|
+
s.add_development_dependency(%q<bson_ext>.freeze, [">= 0"])
|
150
150
|
else
|
151
|
-
s.add_dependency(%q<rails
|
152
|
-
s.add_dependency(%q<bundler
|
153
|
-
s.add_dependency(%q<jeweler
|
154
|
-
s.add_dependency(%q<pry-byebug
|
155
|
-
s.add_dependency(%q<rspec
|
156
|
-
s.add_dependency(%q<nokogiri
|
157
|
-
s.add_dependency(%q<sqlite3
|
158
|
-
s.add_dependency(%q<sequel
|
159
|
-
s.add_dependency(%q<mongoid
|
160
|
-
s.add_dependency(%q<bson
|
161
|
-
s.add_dependency(%q<bson_ext
|
151
|
+
s.add_dependency(%q<rails>.freeze, [">= 4.0"])
|
152
|
+
s.add_dependency(%q<bundler>.freeze, [">= 0"])
|
153
|
+
s.add_dependency(%q<jeweler>.freeze, [">= 2.1.2"])
|
154
|
+
s.add_dependency(%q<pry-byebug>.freeze, [">= 0"])
|
155
|
+
s.add_dependency(%q<rspec>.freeze, [">= 3"])
|
156
|
+
s.add_dependency(%q<nokogiri>.freeze, [">= 0"])
|
157
|
+
s.add_dependency(%q<sqlite3>.freeze, [">= 0"])
|
158
|
+
s.add_dependency(%q<sequel>.freeze, [">= 0"])
|
159
|
+
s.add_dependency(%q<mongoid>.freeze, [">= 0"])
|
160
|
+
s.add_dependency(%q<bson>.freeze, [">= 0"])
|
161
|
+
s.add_dependency(%q<bson_ext>.freeze, [">= 0"])
|
162
162
|
end
|
163
163
|
else
|
164
|
-
s.add_dependency(%q<rails
|
165
|
-
s.add_dependency(%q<bundler
|
166
|
-
s.add_dependency(%q<jeweler
|
167
|
-
s.add_dependency(%q<pry-byebug
|
168
|
-
s.add_dependency(%q<rspec
|
169
|
-
s.add_dependency(%q<nokogiri
|
170
|
-
s.add_dependency(%q<sqlite3
|
171
|
-
s.add_dependency(%q<sequel
|
172
|
-
s.add_dependency(%q<mongoid
|
173
|
-
s.add_dependency(%q<bson
|
174
|
-
s.add_dependency(%q<bson_ext
|
164
|
+
s.add_dependency(%q<rails>.freeze, [">= 4.0"])
|
165
|
+
s.add_dependency(%q<bundler>.freeze, [">= 0"])
|
166
|
+
s.add_dependency(%q<jeweler>.freeze, [">= 2.1.2"])
|
167
|
+
s.add_dependency(%q<pry-byebug>.freeze, [">= 0"])
|
168
|
+
s.add_dependency(%q<rspec>.freeze, [">= 3"])
|
169
|
+
s.add_dependency(%q<nokogiri>.freeze, [">= 0"])
|
170
|
+
s.add_dependency(%q<sqlite3>.freeze, [">= 0"])
|
171
|
+
s.add_dependency(%q<sequel>.freeze, [">= 0"])
|
172
|
+
s.add_dependency(%q<mongoid>.freeze, [">= 0"])
|
173
|
+
s.add_dependency(%q<bson>.freeze, [">= 0"])
|
174
|
+
s.add_dependency(%q<bson_ext>.freeze, [">= 0"])
|
175
175
|
end
|
176
176
|
end
|
177
177
|
|
data/lib/datagrid/filters.rb
CHANGED
@@ -139,7 +139,7 @@ module Datagrid
|
|
139
139
|
|
140
140
|
def initialize(*args, &block) # :nodoc:
|
141
141
|
self.filters_array = self.class.filters_array.clone
|
142
|
-
|
142
|
+
self.filters_array.each do |filter|
|
143
143
|
self[filter.name] = filter.default(self)
|
144
144
|
end
|
145
145
|
super(*args, &block)
|
@@ -292,5 +292,33 @@ describe Datagrid::Filters do
|
|
292
292
|
expect(non_admin_filters).to_not include(:id)
|
293
293
|
expect(non_admin_filters).to include(:name)
|
294
294
|
end
|
295
|
+
|
296
|
+
context 'with delegation to attribute' do
|
297
|
+
let(:role) { OpenStruct.new('admin?' => admin) }
|
298
|
+
let(:klass) do
|
299
|
+
test_report_class do
|
300
|
+
attr_accessor :role
|
301
|
+
delegate :admin?, to: :role
|
302
|
+
|
303
|
+
scope { Entry }
|
304
|
+
|
305
|
+
filter(:id, :integer, if: :admin?)
|
306
|
+
end
|
307
|
+
end
|
308
|
+
|
309
|
+
subject { klass.new(role: role).filters.map(&:name) }
|
310
|
+
|
311
|
+
context 'when condition is true' do
|
312
|
+
let(:admin) { true }
|
313
|
+
|
314
|
+
it { is_expected.to include(:id) }
|
315
|
+
end
|
316
|
+
|
317
|
+
context 'when condition is false' do
|
318
|
+
let(:admin) { false }
|
319
|
+
|
320
|
+
it { is_expected.to_not include(:id) }
|
321
|
+
end
|
322
|
+
end
|
295
323
|
end
|
296
324
|
end
|
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.5.
|
4
|
+
version: 1.5.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Bogdan Gusiev
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-
|
11
|
+
date: 2017-03-06 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
@@ -299,7 +299,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
299
299
|
version: '0'
|
300
300
|
requirements: []
|
301
301
|
rubyforge_project:
|
302
|
-
rubygems_version: 2.
|
302
|
+
rubygems_version: 2.6.7
|
303
303
|
signing_key:
|
304
304
|
specification_version: 4
|
305
305
|
summary: Ruby gem to create datagrids
|