effective_datatables 1.7.1 → 1.8.0

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: e33500ce573ca5338516e3e79dfb3c06c44dc81d
4
- data.tar.gz: 6aa75a77d9bf1151deb0cfc71935086f2cb75fdd
3
+ metadata.gz: 78bd204abaed2266a4181b691f12d54a80fd44e8
4
+ data.tar.gz: e589cd16e82ce18b1fe771096992d65e79c2c145
5
5
  SHA512:
6
- metadata.gz: 9de12751ecd5de42f4404d52e90ff3666e1ecff389d8f6acc2e3c108a8e4493a923a9025ce192c0e86e99f72e75cbf68180b06d76fbeef925e901f336aa3838a
7
- data.tar.gz: 41f47e6044204bc970b0660b7a583d5a46e17ac9725465ef763ffbe711c1580f108d24d509812c774836527f4bf8c03acb99a65502af6fb50fa5e0403a5f648d
6
+ metadata.gz: f43d5f8b2e4913c95d18c309e5824d72914aca83fb22f22678e1783d56bcfbdd6a1b4dc797ba40e7fef73cecf51798d07c351e2ccdc0aa7baf15736a60107a41
7
+ data.tar.gz: 375369ddc8cdc7ec70069dc06c0f6c65097f14019f0b08c35a799dd57018e2b978b2493a473155be975460495b682d77b224229305fb30a23bc4586d02e2d421
@@ -62,7 +62,8 @@ initializeDataTables = ->
62
62
  # Assign PreSearch columns
63
63
  search_inputs.each (index, input) =>
64
64
  $input = $(input)
65
- table.fnSettings().aoPreSearchCols[$input.data('column-index')].sSearch = $input.val() if $input.val()
65
+ if $input.data('column-index') && $input.val()
66
+ table.fnSettings().aoPreSearchCols[$input.data('column-index')].sSearch = $input.val()
66
67
 
67
68
  # FixedColumns doesn't work well yet.
68
69
  # fixedColumns = new $.fn.dataTable.FixedColumns(table,
@@ -20,7 +20,7 @@ module EffectiveDatatablesHelper
20
20
  case opts[:filter][:type]
21
21
  when :string, :text, :number
22
22
  form.input name, :label => false, :required => false, :as => :string, :placeholder => (opts[:label] || name),
23
- :input_html => { :autocomplete => 'off', :data => {'column-name' => opts[:name], 'column-index' => opts[:index]} }
23
+ :input_html => { :name => nil, :autocomplete => 'off', :data => {'column-name' => opts[:name], 'column-index' => opts[:index]} }
24
24
  when :select, :boolean
25
25
  if opts[:filter][:values].respond_to?(:call)
26
26
  opts[:filter][:values] = opts[:filter][:values].call()
@@ -31,7 +31,7 @@ module EffectiveDatatablesHelper
31
31
  end
32
32
 
33
33
  form.input name, :label => false, :required => false, :as => :select, :collection => opts[:filter][:values], :include_blank => (opts[:label] || name.titleize),
34
- :input_html => { :autocomplete => 'off', :data => {'column-name' => opts[:name], 'column-index' => opts[:index]} }
34
+ :input_html => { :name => nil, :autocomplete => 'off', :data => {'column-name' => opts[:name], 'column-index' => opts[:index]} }
35
35
  else
36
36
  content_tag(:p, opts[:label] || name)
37
37
  end
@@ -21,21 +21,23 @@
21
21
  }
22
22
  }
23
23
 
24
- = simple_form_for datatable, :url => '#', :html => {:id => "#{datatable.to_param}-form" } do |f|
25
- %table.effective-datatable{effective_datatable_params}
26
- %thead
27
- - max_depth = datatable.table_columns.map { |_, opts| opts[:th][:depth].to_i rescue 0 }.max
28
- - [*0..max_depth].each do |depth|
29
- %tr
30
- - table_columns = datatable.table_columns.select { |_, opts| (opts[:th][:depth] || 0 rescue 0) == depth }
31
- - table_columns.each do |name, opts|
32
- %th{(opts[:th] || {}).merge({:title => opts[:label] || name})}
33
- = render_datatable_header_cell(f, name, opts, filterable)
34
- - (opts[:append_th] || []).each do |faux_col|
35
- %th{(faux_col[:th] || {}).merge({:title => faux_col[:label]})}
36
- = faux_col[:label]
37
- %tbody
38
- - (datatable.to_json[:data] || []).each do |row|
39
- %tr
40
- - row.each do |col|
41
- %td= col.to_s.html_safe
24
+ form_builder = nil
25
+ simple_form_for(datatable, url: '#', html: {id: "#{datatable.to_param}-form"}) { |f| form_builder = f }
26
+
27
+ %table.effective-datatable{effective_datatable_params}
28
+ %thead
29
+ - max_depth = datatable.table_columns.map { |_, opts| opts[:th][:depth].to_i rescue 0 }.max
30
+ - [*0..max_depth].each do |depth|
31
+ %tr
32
+ - table_columns = datatable.table_columns.select { |_, opts| (opts[:th][:depth] || 0 rescue 0) == depth }
33
+ - table_columns.each do |name, opts|
34
+ %th{(opts[:th] || {}).merge({:title => opts[:label] || name})}
35
+ = render_datatable_header_cell(form_builder, name, opts, filterable)
36
+ - (opts[:append_th] || []).each do |faux_col|
37
+ %th{(faux_col[:th] || {}).merge({:title => faux_col[:label]})}
38
+ = faux_col[:label]
39
+ %tbody
40
+ - (datatable.to_json[:data] || []).each do |row|
41
+ %tr
42
+ - row.each do |col|
43
+ %td= col.to_s.html_safe
@@ -1,3 +1,3 @@
1
1
  module EffectiveDatatables
2
- VERSION = '1.7.1'.freeze
2
+ VERSION = '1.8.0'.freeze
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: effective_datatables
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.7.1
4
+ version: 1.8.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Code and Effect
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-06-26 00:00:00.000000000 Z
11
+ date: 2015-06-29 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails