iquest-simple_table 0.3.0 → 0.3.1

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: 487255feccbbd18459b41325c4ba0072301ba4bb
4
- data.tar.gz: 9d767604c918f80dbb629f0ce226bde0bd1d73c6
3
+ metadata.gz: f98602aed6cd5980db8ed1d92b50a7fbb7994894
4
+ data.tar.gz: 34531ff1eeccb26163a9f6a17aae49e693bbefb4
5
5
  SHA512:
6
- metadata.gz: 2ccec335f52588138657eb6e79bc2829d254fd3ae64995a739d65ac96a090dd3dcc1fa29457f4591c485fc814e2a432980c43b585653dc5adaff8c0156b8b0a8
7
- data.tar.gz: e8f96ccfcb6517d44164d16a4a3600a3d9b8604225b68ddae6d00b79a562564248a9f2fbeeb46ca237d3415634176aceb8d09ca450e5a6d56ad583de886205af
6
+ metadata.gz: f7d25fe0f1d94a2840908281aae021824d73825aebe88b181fc259586973a0736c4f2f66cb24ce2157b358b727e34a4ee078888b08965202ffa0e9a1caa5f2f0
7
+ data.tar.gz: 2b7e1168d26d268ea6e81e8ad5b46244ae62e0384b12921aea95a82d35638ff21737a2f49ced47d388404fb21e02b6b43fa6c0d313edeb0311e4a210183ab5c3
@@ -7,7 +7,7 @@ module Iquest
7
7
  delegate :capture, :content_tag, :link_to, :paginate, :page_entries_info, :params, to: :parent
8
8
  delegate :sort_link, :search_form_for, to: :parent
9
9
  delegate :polymorphic_path, :polymorphic_url, to: :parent
10
- delegate :l, :t, to: :parent
10
+ delegate :l, :t, :dom_id, to: :parent
11
11
 
12
12
  def initialize(parent, collection_or_search, options = {})
13
13
  @parent = parent
@@ -34,7 +34,7 @@ module Iquest
34
34
  @collection = @collection.decorate if @collection.respond_to?(:decorate)
35
35
  options[:search_url] ||= polymorphic_path(@klass) rescue NoMethodError
36
36
  @options = options
37
- @table_id = "table_#{self.object_id}".parameterize
37
+ @table_id = "table_#{@klass}".pluralize.parameterize
38
38
  @columns = {}.with_indifferent_access
39
39
  @actions = []
40
40
  @collection_actions = []
@@ -104,8 +104,8 @@ module Iquest
104
104
  end
105
105
 
106
106
  private
107
- def render_table_without_search
108
- table = content_tag :table, class: @options[:html][:class] << %w(table table-hover table-striped) do
107
+ def render_table_without_search
108
+ table = content_tag :table, id: @table_id, class: @options[:html][:class] << %w(table table-hover table-striped) do
109
109
  render_table_header + render_table_body + render_table_footer
110
110
  end
111
111
 
@@ -194,7 +194,8 @@ module Iquest
194
194
  end
195
195
 
196
196
  def render_table_row(item)
197
- content_tag :tr do
197
+ row_id = "row_#{dom_id(item)}" rescue nil
198
+ content_tag :tr, id: row_id do
198
199
  rendered_columns = columns.map do |col|
199
200
  render_value_cell(col, item)
200
201
  end.join.html_safe
@@ -231,9 +232,10 @@ module Iquest
231
232
  value = get_value(attr, obj)
232
233
  formatter = options[:formatter]
233
234
  cell_value = render_value(obj, value, &formatter)
234
- cell_class = "rowlink-skip" if include_link?(cell_value)
235
- cell_class = "#{cell_class} options[:class]"
236
- content_tag :td, class: cell_class do
235
+ cell_classes = []
236
+ cell_classes << "rowlink-skip" if include_link?(cell_value)
237
+ cell_classes << "#{options[:class]}"
238
+ content_tag :td, class: cell_classes.join(' ') do
237
239
  cell_value
238
240
  end
239
241
  end
@@ -1,5 +1,5 @@
1
1
  module Iquest
2
2
  module SimpleTable
3
- VERSION = "0.3.0"
3
+ VERSION = "0.3.1"
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.3.0
4
+ version: 0.3.1
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-10-17 00:00:00.000000000 Z
11
+ date: 2014-10-29 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: ransack_simple_form