fancygrid 2.0.1 → 2.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/VERSION +1 -1
- data/app/views/fancygrid/table.html.haml +2 -2
- data/fancygrid.gemspec +2 -2
- data/lib/fancygrid/column.rb +9 -1
- data/lib/fancygrid/grid.rb +48 -0
- data/spec/dummy/app/controllers/application_controller.rb +15 -0
- metadata +3 -3
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
2.0.
|
1
|
+
2.0.2
|
@@ -19,7 +19,7 @@
|
|
19
19
|
= text_field_tag(:value, column.search_value)
|
20
20
|
|
21
21
|
- fancygrid.records.each do |record|
|
22
|
-
%tr.fg-row
|
22
|
+
%tr.fg-row{ :class => fancygrid.tr_class(record), :id => fancygrid.tr_id(record) }
|
23
23
|
- fancygrid.visible_columns.each do |column|
|
24
|
-
%td{ :class => column.tag_class }
|
24
|
+
%td{ :class => column.tag_class + " " + fancygrid.td_class(record).to_s, :id => fancygrid.td_id(record) }
|
25
25
|
= render_fancygrid_cell(record, column, &format_block)
|
data/fancygrid.gemspec
CHANGED
@@ -5,11 +5,11 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = "fancygrid"
|
8
|
-
s.version = "2.0.
|
8
|
+
s.version = "2.0.2"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["Alexander Graefenstein"]
|
12
|
-
s.date = "
|
12
|
+
s.date = "2013-02-20"
|
13
13
|
s.description = "Enables easy table rendering in rails applications"
|
14
14
|
s.email = "giniedp@online.de"
|
15
15
|
s.extra_rdoc_files = [
|
data/lib/fancygrid/column.rb
CHANGED
@@ -35,7 +35,6 @@ module Fancygrid
|
|
35
35
|
# Value resolver proc for this column.
|
36
36
|
attr_accessor :value_proc
|
37
37
|
|
38
|
-
|
39
38
|
def initialize(parent, name, options = {})
|
40
39
|
super(parent, name, options)
|
41
40
|
|
@@ -53,6 +52,9 @@ module Fancygrid
|
|
53
52
|
@value_proc = options.fetch(:value_proc, nil)
|
54
53
|
|
55
54
|
@human_name = options.fetch(:human_name, nil)
|
55
|
+
|
56
|
+
@th_class = options.fetch(:th_class, "")
|
57
|
+
@td_class = options.fetch(:td_class, "")
|
56
58
|
|
57
59
|
@formatable = self.root.respond_to?(self.formatter_method)
|
58
60
|
end
|
@@ -99,6 +101,12 @@ module Fancygrid
|
|
99
101
|
@tag_class or @tag_class = self.identifier.split(".").join(" ")
|
100
102
|
end
|
101
103
|
|
104
|
+
def th_class(record)
|
105
|
+
end
|
106
|
+
|
107
|
+
def td_class(record)
|
108
|
+
end
|
109
|
+
|
102
110
|
# Gets the internationalization lookup path for this column.
|
103
111
|
#
|
104
112
|
def i18n_path
|
data/lib/fancygrid/grid.rb
CHANGED
@@ -249,5 +249,53 @@ module Fancygrid#:nodoc:
|
|
249
249
|
end
|
250
250
|
return result
|
251
251
|
end
|
252
|
+
|
253
|
+
def tr_class=value
|
254
|
+
@tr_class = value
|
255
|
+
end
|
256
|
+
def tr_class(record=nil)
|
257
|
+
@tr_class = Proc.new if block_given?
|
258
|
+
if @tr_class.is_a? Proc
|
259
|
+
@tr_class.call(record) if record
|
260
|
+
else
|
261
|
+
@tr_class
|
262
|
+
end
|
263
|
+
end
|
264
|
+
|
265
|
+
def tr_id=value
|
266
|
+
@tr_id = value
|
267
|
+
end
|
268
|
+
def tr_id(record=nil)
|
269
|
+
@tr_id = Proc.new if block_given?
|
270
|
+
if @tr_id.is_a? Proc
|
271
|
+
@tr_id.call(record) if record
|
272
|
+
else
|
273
|
+
@tr_id
|
274
|
+
end
|
275
|
+
end
|
276
|
+
|
277
|
+
def td_class=value
|
278
|
+
@td_class = value
|
279
|
+
end
|
280
|
+
def td_class(record=nil)
|
281
|
+
@td_class = Proc.new if block_given?
|
282
|
+
if @td_class.is_a? Proc
|
283
|
+
@td_class.call(record) if record
|
284
|
+
else
|
285
|
+
@td_class
|
286
|
+
end
|
287
|
+
end
|
288
|
+
|
289
|
+
def td_id=value
|
290
|
+
@td_id = value
|
291
|
+
end
|
292
|
+
def td_id(record=nil)
|
293
|
+
@td_id = Proc.new if block_given?
|
294
|
+
if @td_id.is_a? Proc
|
295
|
+
@td_id.call(record) if record
|
296
|
+
else
|
297
|
+
@td_id
|
298
|
+
end
|
299
|
+
end
|
252
300
|
end
|
253
301
|
end
|
@@ -17,6 +17,21 @@ class ApplicationController < ActionController::Base
|
|
17
17
|
grid.ajax_url = "/index.html"
|
18
18
|
grid.paginate = request.format.html?
|
19
19
|
grid.select = true
|
20
|
+
|
21
|
+
grid.tr_class do |record|
|
22
|
+
"tr-#{record.id}"
|
23
|
+
end
|
24
|
+
grid.tr_id do |record|
|
25
|
+
"tr-#{record.id}"
|
26
|
+
end
|
27
|
+
|
28
|
+
grid.td_class do |record|
|
29
|
+
"td-#{record.id}"
|
30
|
+
end
|
31
|
+
grid.td_id do |record|
|
32
|
+
"td-#{record.id}"
|
33
|
+
end
|
34
|
+
|
20
35
|
grid.find do |q|
|
21
36
|
q.includes :tickets
|
22
37
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: fancygrid
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.0.
|
4
|
+
version: 2.0.2
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date:
|
12
|
+
date: 2013-02-20 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rails
|
@@ -185,7 +185,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
185
185
|
version: '0'
|
186
186
|
segments:
|
187
187
|
- 0
|
188
|
-
hash:
|
188
|
+
hash: -979915640466591579
|
189
189
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
190
190
|
none: false
|
191
191
|
requirements:
|