iquest-simple_table 0.1.6 → 0.1.7

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: 3467bc3b3a8172ad4006627cd80ffb16dfdbf42e
4
- data.tar.gz: 9d71f5bb3bdc5128fa08045607867da425d401f3
3
+ metadata.gz: 7ab59378988a3966d251551b568147b400a333c9
4
+ data.tar.gz: 5dfc55a27e2721ea26cd6a7fa75c2c949a653700
5
5
  SHA512:
6
- metadata.gz: 346741660d4b9430f19bfaf492aa8e460104d80cac706dc0d6f43a5d5a8e661f9556ce037da4bb5111099373668def71535d46114eecadf5666117e667ab0aa4
7
- data.tar.gz: 7275110d69aaa202aa2cb6297c820b6f440c92e7d67fd8db56539c544ffa2a155a024611bd168276af16a07380442c85822c07b5857fc4c642656c3bd99a7db3
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::Relation
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
@@ -1,5 +1,5 @@
1
1
  module Iquest
2
2
  module SimpleTable
3
- VERSION = "0.1.6"
3
+ VERSION = "0.1.7"
4
4
  end
5
5
  end
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.6
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-04-15 00:00:00.000000000 Z
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