datagrid 0.6.3 → 0.6.4

Sign up to get free protection for your applications and to get access to all the features.
data/Gemfile CHANGED
@@ -7,8 +7,8 @@ gem "rails", ">= 3.0"
7
7
  group :development do
8
8
 
9
9
  gem "rake"
10
- gem "bundler", "~> 1.1.0"
11
- gem "jeweler", "~> 1.6.0"
10
+ gem "bundler"
11
+ gem "jeweler"
12
12
 
13
13
  gem "debugger", :platform => "ruby_19"
14
14
 
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.6.3
1
+ 0.6.4
@@ -9,7 +9,7 @@ Local variables:
9
9
  <%= datagrid_header(grid, options) %>
10
10
  </thead>
11
11
  <tbody>
12
- <% if grid.rows.empty? %>
12
+ <% if assets.empty? %>
13
13
  <tr><td class="noresults" colspan="100%"><%= I18n.t 'datagrid.no_results', :default => '&mdash;&mdash;'.html_safe %></td></tr>
14
14
  <% else %>
15
15
  <%= datagrid_rows(grid, assets, options) %>
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = "datagrid"
8
- s.version = "0.6.3"
8
+ s.version = "0.6.4"
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 = "2012-08-28"
12
+ s.date = "2012-09-17"
13
13
  s.description = "This allows you to easily build datagrid aka data tables with sortable columns and filters"
14
14
  s.email = "agresso@gmail.com"
15
15
  s.extra_rdoc_files = [
@@ -83,7 +83,7 @@ Gem::Specification.new do |s|
83
83
  s.homepage = "http://github.com/bogdan/datagrid"
84
84
  s.licenses = ["MIT"]
85
85
  s.require_paths = ["lib"]
86
- s.rubygems_version = "1.8.11"
86
+ s.rubygems_version = "1.8.24"
87
87
  s.summary = "Ruby gem to create datagrids"
88
88
 
89
89
  if s.respond_to? :specification_version then
@@ -92,8 +92,8 @@ Gem::Specification.new do |s|
92
92
  if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
93
93
  s.add_runtime_dependency(%q<rails>, [">= 3.0"])
94
94
  s.add_development_dependency(%q<rake>, [">= 0"])
95
- s.add_development_dependency(%q<bundler>, ["~> 1.1.0"])
96
- s.add_development_dependency(%q<jeweler>, ["~> 1.6.0"])
95
+ s.add_development_dependency(%q<bundler>, [">= 0"])
96
+ s.add_development_dependency(%q<jeweler>, [">= 0"])
97
97
  s.add_development_dependency(%q<debugger>, [">= 0"])
98
98
  s.add_development_dependency(%q<rspec>, [">= 0"])
99
99
  s.add_development_dependency(%q<accept_values_for>, [">= 0"])
@@ -107,8 +107,8 @@ Gem::Specification.new do |s|
107
107
  else
108
108
  s.add_dependency(%q<rails>, [">= 3.0"])
109
109
  s.add_dependency(%q<rake>, [">= 0"])
110
- s.add_dependency(%q<bundler>, ["~> 1.1.0"])
111
- s.add_dependency(%q<jeweler>, ["~> 1.6.0"])
110
+ s.add_dependency(%q<bundler>, [">= 0"])
111
+ s.add_dependency(%q<jeweler>, [">= 0"])
112
112
  s.add_dependency(%q<debugger>, [">= 0"])
113
113
  s.add_dependency(%q<rspec>, [">= 0"])
114
114
  s.add_dependency(%q<accept_values_for>, [">= 0"])
@@ -123,8 +123,8 @@ Gem::Specification.new do |s|
123
123
  else
124
124
  s.add_dependency(%q<rails>, [">= 3.0"])
125
125
  s.add_dependency(%q<rake>, [">= 0"])
126
- s.add_dependency(%q<bundler>, ["~> 1.1.0"])
127
- s.add_dependency(%q<jeweler>, ["~> 1.6.0"])
126
+ s.add_dependency(%q<bundler>, [">= 0"])
127
+ s.add_dependency(%q<jeweler>, [">= 0"])
128
128
  s.add_dependency(%q<debugger>, [">= 0"])
129
129
  s.add_dependency(%q<rspec>, [">= 0"])
130
130
  s.add_dependency(%q<accept_values_for>, [">= 0"])
@@ -10,9 +10,13 @@ class Datagrid::Filters::EnumFilter < Datagrid::Filters::BaseFilter
10
10
  value
11
11
  end
12
12
 
13
- def select
13
+ def select(object = nil)
14
14
  option = self.options[:select]
15
- option.respond_to?(:call) ? option.call : option
15
+ if option.respond_to?(:call)
16
+ option.arity == 1 ? option.call(object) : option.call
17
+ else
18
+ option
19
+ end
16
20
  end
17
21
 
18
22
  def include_blank
@@ -39,7 +39,7 @@ module Datagrid
39
39
  if !options.has_key?(:multiple) && filter.multiple
40
40
  options[:multiple] = true
41
41
  end
42
- select filter.name, filter.select || [], {:include_blank => filter.include_blank, :prompt => filter.prompt}, options
42
+ select filter.name, filter.select(object) || [], {:include_blank => filter.include_blank, :prompt => filter.prompt}, options
43
43
  end
44
44
 
45
45
  def datagrid_integer_filter(attribute_or_filter, options = {})
@@ -15,6 +15,15 @@ describe Datagrid::Filters::EnumFilter do
15
15
  filter(:group_id, :enum, :select => proc { [1,2] })
16
16
  end.class.filter_by_name(:group_id).select.should == [1,2]
17
17
  end
18
+
19
+ it "should support select option as proc with instace input" do
20
+ klass = test_report do
21
+ scope {Entry}
22
+ filter(:group_id, :enum, :select => proc { |obj| obj.object_id })
23
+ end.class
24
+ instance = klass.new
25
+ klass.filter_by_name(:group_id).select(instance).should == instance.object_id
26
+ end
18
27
 
19
28
  it "should initialize select option only on instanciation" do
20
29
  class ReportWithLazySelect
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: datagrid
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.6.3
4
+ version: 0.6.4
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,11 +9,11 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-08-28 00:00:00.000000000 Z
12
+ date: 2012-09-17 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rails
16
- requirement: &19221460 !ruby/object:Gem::Requirement
16
+ requirement: !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ! '>='
@@ -21,10 +21,15 @@ dependencies:
21
21
  version: '3.0'
22
22
  type: :runtime
23
23
  prerelease: false
24
- version_requirements: *19221460
24
+ version_requirements: !ruby/object:Gem::Requirement
25
+ none: false
26
+ requirements:
27
+ - - ! '>='
28
+ - !ruby/object:Gem::Version
29
+ version: '3.0'
25
30
  - !ruby/object:Gem::Dependency
26
31
  name: rake
27
- requirement: &19219460 !ruby/object:Gem::Requirement
32
+ requirement: !ruby/object:Gem::Requirement
28
33
  none: false
29
34
  requirements:
30
35
  - - ! '>='
@@ -32,32 +37,47 @@ dependencies:
32
37
  version: '0'
33
38
  type: :development
34
39
  prerelease: false
35
- version_requirements: *19219460
40
+ version_requirements: !ruby/object:Gem::Requirement
41
+ none: false
42
+ requirements:
43
+ - - ! '>='
44
+ - !ruby/object:Gem::Version
45
+ version: '0'
36
46
  - !ruby/object:Gem::Dependency
37
47
  name: bundler
38
- requirement: &19214100 !ruby/object:Gem::Requirement
48
+ requirement: !ruby/object:Gem::Requirement
39
49
  none: false
40
50
  requirements:
41
- - - ~>
51
+ - - ! '>='
42
52
  - !ruby/object:Gem::Version
43
- version: 1.1.0
53
+ version: '0'
44
54
  type: :development
45
55
  prerelease: false
46
- version_requirements: *19214100
56
+ version_requirements: !ruby/object:Gem::Requirement
57
+ none: false
58
+ requirements:
59
+ - - ! '>='
60
+ - !ruby/object:Gem::Version
61
+ version: '0'
47
62
  - !ruby/object:Gem::Dependency
48
63
  name: jeweler
49
- requirement: &19239940 !ruby/object:Gem::Requirement
64
+ requirement: !ruby/object:Gem::Requirement
50
65
  none: false
51
66
  requirements:
52
- - - ~>
67
+ - - ! '>='
53
68
  - !ruby/object:Gem::Version
54
- version: 1.6.0
69
+ version: '0'
55
70
  type: :development
56
71
  prerelease: false
57
- version_requirements: *19239940
72
+ version_requirements: !ruby/object:Gem::Requirement
73
+ none: false
74
+ requirements:
75
+ - - ! '>='
76
+ - !ruby/object:Gem::Version
77
+ version: '0'
58
78
  - !ruby/object:Gem::Dependency
59
79
  name: debugger
60
- requirement: &19235660 !ruby/object:Gem::Requirement
80
+ requirement: !ruby/object:Gem::Requirement
61
81
  none: false
62
82
  requirements:
63
83
  - - ! '>='
@@ -65,10 +85,15 @@ dependencies:
65
85
  version: '0'
66
86
  type: :development
67
87
  prerelease: false
68
- version_requirements: *19235660
88
+ version_requirements: !ruby/object:Gem::Requirement
89
+ none: false
90
+ requirements:
91
+ - - ! '>='
92
+ - !ruby/object:Gem::Version
93
+ version: '0'
69
94
  - !ruby/object:Gem::Dependency
70
95
  name: rspec
71
- requirement: &19248680 !ruby/object:Gem::Requirement
96
+ requirement: !ruby/object:Gem::Requirement
72
97
  none: false
73
98
  requirements:
74
99
  - - ! '>='
@@ -76,10 +101,15 @@ dependencies:
76
101
  version: '0'
77
102
  type: :development
78
103
  prerelease: false
79
- version_requirements: *19248680
104
+ version_requirements: !ruby/object:Gem::Requirement
105
+ none: false
106
+ requirements:
107
+ - - ! '>='
108
+ - !ruby/object:Gem::Version
109
+ version: '0'
80
110
  - !ruby/object:Gem::Dependency
81
111
  name: accept_values_for
82
- requirement: &19245240 !ruby/object:Gem::Requirement
112
+ requirement: !ruby/object:Gem::Requirement
83
113
  none: false
84
114
  requirements:
85
115
  - - ! '>='
@@ -87,10 +117,15 @@ dependencies:
87
117
  version: '0'
88
118
  type: :development
89
119
  prerelease: false
90
- version_requirements: *19245240
120
+ version_requirements: !ruby/object:Gem::Requirement
121
+ none: false
122
+ requirements:
123
+ - - ! '>='
124
+ - !ruby/object:Gem::Version
125
+ version: '0'
91
126
  - !ruby/object:Gem::Dependency
92
127
  name: nokogiri
93
- requirement: &19268860 !ruby/object:Gem::Requirement
128
+ requirement: !ruby/object:Gem::Requirement
94
129
  none: false
95
130
  requirements:
96
131
  - - ! '>='
@@ -98,10 +133,15 @@ dependencies:
98
133
  version: '0'
99
134
  type: :development
100
135
  prerelease: false
101
- version_requirements: *19268860
136
+ version_requirements: !ruby/object:Gem::Requirement
137
+ none: false
138
+ requirements:
139
+ - - ! '>='
140
+ - !ruby/object:Gem::Version
141
+ version: '0'
102
142
  - !ruby/object:Gem::Dependency
103
143
  name: sqlite3-ruby
104
- requirement: &19277160 !ruby/object:Gem::Requirement
144
+ requirement: !ruby/object:Gem::Requirement
105
145
  none: false
106
146
  requirements:
107
147
  - - ! '>='
@@ -109,21 +149,31 @@ dependencies:
109
149
  version: '0'
110
150
  type: :development
111
151
  prerelease: false
112
- version_requirements: *19277160
152
+ version_requirements: !ruby/object:Gem::Requirement
153
+ none: false
154
+ requirements:
155
+ - - ! '>='
156
+ - !ruby/object:Gem::Version
157
+ version: '0'
113
158
  - !ruby/object:Gem::Dependency
114
159
  name: mongoid
115
- requirement: &19299280 !ruby/object:Gem::Requirement
160
+ requirement: !ruby/object:Gem::Requirement
116
161
  none: false
117
162
  requirements:
118
- - - =
163
+ - - '='
119
164
  - !ruby/object:Gem::Version
120
165
  version: 2.2.2
121
166
  type: :development
122
167
  prerelease: false
123
- version_requirements: *19299280
168
+ version_requirements: !ruby/object:Gem::Requirement
169
+ none: false
170
+ requirements:
171
+ - - '='
172
+ - !ruby/object:Gem::Version
173
+ version: 2.2.2
124
174
  - !ruby/object:Gem::Dependency
125
175
  name: mongo_mapper
126
- requirement: &19317860 !ruby/object:Gem::Requirement
176
+ requirement: !ruby/object:Gem::Requirement
127
177
  none: false
128
178
  requirements:
129
179
  - - ! '>='
@@ -131,32 +181,47 @@ dependencies:
131
181
  version: 0.11.0
132
182
  type: :development
133
183
  prerelease: false
134
- version_requirements: *19317860
184
+ version_requirements: !ruby/object:Gem::Requirement
185
+ none: false
186
+ requirements:
187
+ - - ! '>='
188
+ - !ruby/object:Gem::Version
189
+ version: 0.11.0
135
190
  - !ruby/object:Gem::Dependency
136
191
  name: bson
137
- requirement: &19315320 !ruby/object:Gem::Requirement
192
+ requirement: !ruby/object:Gem::Requirement
138
193
  none: false
139
194
  requirements:
140
- - - =
195
+ - - '='
141
196
  - !ruby/object:Gem::Version
142
197
  version: 1.4.0
143
198
  type: :development
144
199
  prerelease: false
145
- version_requirements: *19315320
200
+ version_requirements: !ruby/object:Gem::Requirement
201
+ none: false
202
+ requirements:
203
+ - - '='
204
+ - !ruby/object:Gem::Version
205
+ version: 1.4.0
146
206
  - !ruby/object:Gem::Dependency
147
207
  name: bson_ext
148
- requirement: &19313340 !ruby/object:Gem::Requirement
208
+ requirement: !ruby/object:Gem::Requirement
149
209
  none: false
150
210
  requirements:
151
- - - =
211
+ - - '='
152
212
  - !ruby/object:Gem::Version
153
213
  version: 1.4.0
154
214
  type: :development
155
215
  prerelease: false
156
- version_requirements: *19313340
216
+ version_requirements: !ruby/object:Gem::Requirement
217
+ none: false
218
+ requirements:
219
+ - - '='
220
+ - !ruby/object:Gem::Version
221
+ version: 1.4.0
157
222
  - !ruby/object:Gem::Dependency
158
223
  name: fastercsv
159
- requirement: &19334040 !ruby/object:Gem::Requirement
224
+ requirement: !ruby/object:Gem::Requirement
160
225
  none: false
161
226
  requirements:
162
227
  - - ! '>='
@@ -164,7 +229,12 @@ dependencies:
164
229
  version: '0'
165
230
  type: :development
166
231
  prerelease: false
167
- version_requirements: *19334040
232
+ version_requirements: !ruby/object:Gem::Requirement
233
+ none: false
234
+ requirements:
235
+ - - ! '>='
236
+ - !ruby/object:Gem::Version
237
+ version: '0'
168
238
  description: This allows you to easily build datagrid aka data tables with sortable
169
239
  columns and filters
170
240
  email: agresso@gmail.com
@@ -251,7 +321,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
251
321
  version: '0'
252
322
  segments:
253
323
  - 0
254
- hash: 717556836869026164
324
+ hash: -1803543762513057738
255
325
  required_rubygems_version: !ruby/object:Gem::Requirement
256
326
  none: false
257
327
  requirements:
@@ -260,7 +330,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
260
330
  version: '0'
261
331
  requirements: []
262
332
  rubyforge_project:
263
- rubygems_version: 1.8.11
333
+ rubygems_version: 1.8.24
264
334
  signing_key:
265
335
  specification_version: 3
266
336
  summary: Ruby gem to create datagrids