iquest-simple_table 0.1.6 → 0.1.7
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.
- checksums.yaml +4 -4
- data/lib/iquest/simple_table/table_builder.rb +7 -7
- data/lib/iquest/simple_table/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7ab59378988a3966d251551b568147b400a333c9
|
4
|
+
data.tar.gz: 5dfc55a27e2721ea26cd6a7fa75c2c949a653700
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f334c5745d16a39c1a68cd9ca8b466a9da4a710162771d13051026decb6fdc4f523300b4781f2d4e1e0af0cc0658ace95502401b6d95f85baa298876476452e3
|
7
|
+
data.tar.gz: 203a8bd294eed93ac7c71676073021a6c1496d2376d190d169ec3194783e4cddd04572ed9c4bbad9420c28fba2deca60d94be80586e306a9d76814cf78635f2c
|
@@ -15,7 +15,7 @@ module Iquest
|
|
15
15
|
@collection = collection_or_search.result
|
16
16
|
@search = collection_or_search
|
17
17
|
@klass = @search.klass
|
18
|
-
elsif collection_or_search.is_a? ActiveRecord::
|
18
|
+
elsif collection_or_search.is_a?(ActiveRecord::Relation) || collection_or_search.is_a?(ActiveRecord::AssociationRelation)
|
19
19
|
@collection = collection_or_search
|
20
20
|
@klass = @collection.klass
|
21
21
|
elsif collection_or_search.is_a?(Array) && (search = collection_or_search.detect {|o| o.is_a?(Ransack::Search)})
|
@@ -24,12 +24,12 @@ module Iquest
|
|
24
24
|
@klass = @collection.klass
|
25
25
|
options[:search_url] ||= polymorphic_path(collection_or_search.map {|o| o.is_a?(Ransack::Search) ? o.klass : o})
|
26
26
|
options[:new_url] ||= new_polymorphic_path(collection_or_search.map {|o| o.is_a?(Ransack::Search) ? o.klass : o}) rescue NoMethodError
|
27
|
-
elsif collection_or_search.is_a?(Array) && (collection = collection_or_search.detect {|o| o.is_a?(ActiveRecord::Relation)})
|
27
|
+
elsif collection_or_search.is_a?(Array) && (collection = collection_or_search.detect {|o| o.is_a?(ActiveRecord::Relation) || o.is_a?(ActiveRecord::AssociationRelation)})
|
28
28
|
@collection = collection
|
29
29
|
@klass = @collection.klass
|
30
|
-
options[:new_url] ||= new_polymorphic_path(collection_or_search.map {|o| o.is_a?(ActiveRecord::Relation)}) rescue NoMethodError
|
30
|
+
options[:new_url] ||= new_polymorphic_path(collection_or_search.map {|o| o.is_a?(ActiveRecord::Relation) || o.is_a?(ActiveRecord::AssociationRelation)}) rescue NoMethodError
|
31
31
|
else
|
32
|
-
raise TypeError, 'ActiveRecord::Relation or Ransack::Search expected'
|
32
|
+
raise TypeError, 'ActiveRecord::Relation, ActiveRecord::AssociationRelation or Ransack::Search expected'
|
33
33
|
end
|
34
34
|
apply_pagination
|
35
35
|
#draper
|
@@ -180,7 +180,7 @@ module Iquest
|
|
180
180
|
end
|
181
181
|
|
182
182
|
def render_table_body
|
183
|
-
content_tag :tbody do
|
183
|
+
content_tag :tbody, class: 'rowlink', data: {link: 'row', target: 'a.rowlink'} do
|
184
184
|
collection.map do |item|
|
185
185
|
render_table_row(item)
|
186
186
|
end.join.html_safe
|
@@ -224,7 +224,7 @@ module Iquest
|
|
224
224
|
obj = args.second
|
225
225
|
value = get_value(attr, obj)
|
226
226
|
formatter = options[:formatter]
|
227
|
-
content_tag :td do
|
227
|
+
content_tag :td, class: options[:class] do
|
228
228
|
render_value(value, &formatter)
|
229
229
|
end
|
230
230
|
end
|
@@ -259,7 +259,7 @@ module Iquest
|
|
259
259
|
end
|
260
260
|
|
261
261
|
def render_actions(item)
|
262
|
-
content_tag :td do
|
262
|
+
content_tag :td, class: 'rowlink-skip' do
|
263
263
|
@actions.map do |action|
|
264
264
|
render_action(item, action)
|
265
265
|
end.join.html_safe
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: iquest-simple_table
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.7
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Pavel Dusanek
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-
|
11
|
+
date: 2014-05-07 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: ransack_simple_form
|