effective_datatables 3.0.9 → 3.0.10
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +3 -0
- data/app/assets/javascripts/effective_datatables/initialize.js.coffee +1 -1
- data/app/helpers/effective_datatables_helper.rb +2 -2
- data/app/models/effective/datatable.rb +1 -1
- data/app/models/effective/effective_datatable/resource.rb +6 -0
- data/app/models/effective/effective_datatable/state.rb +2 -1
- data/config/effective_datatables.rb +3 -0
- data/lib/effective_datatables.rb +2 -0
- data/lib/effective_datatables/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: 16759c0e5f1a13f16ea9ebd7b227826a059d6d41
|
4
|
+
data.tar.gz: 566fb03358fb13f1f16fe43fd17b317fb2f960e1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 03025955a600bc23c5a208a28f94ce65efb65a84cc68e9fedc9083c96c230e6f08ee42d20c2daa32c0d0b23bd922f24e2817b2ab9b4ac3badeec1996e28395ee
|
7
|
+
data.tar.gz: ff418748517d4133b1d6a0ccf595332d883ea439f43ef880d1d6bb877b8537bf821d40c3ebde5a231fa1799a15683406150d4e80f00f392b9c89e8f7df1fc412
|
data/README.md
CHANGED
@@ -41,6 +41,7 @@ A lot has changed. See below for full details.
|
|
41
41
|
# Getting Started
|
42
42
|
|
43
43
|
```ruby
|
44
|
+
gem 'haml-rails' # or try using gem 'hamlit-rails'
|
44
45
|
gem 'effective_datatables'
|
45
46
|
```
|
46
47
|
|
@@ -313,6 +314,8 @@ As well, a datatable can be initialized with `attributes`.
|
|
313
314
|
|
314
315
|
When initialized with a Hash, that hash is available throughout the entire datatable as `attributes`.
|
315
316
|
|
317
|
+
You can call the attributes from within the datatable as `attributes` or within a partial/view as `@datatable.attributes`.
|
318
|
+
|
316
319
|
These attributes are serialized and stored in an encrypted cookie. Objects won't work. Keep it simple.
|
317
320
|
|
318
321
|
Attributes cannot be changed by search, filter, or state in any way. They're guaranteed to be the same as when first initialized.
|
@@ -3,7 +3,7 @@ initializeDataTables = ->
|
|
3
3
|
return if $.fn.DataTable.fnIsDataTable(this)
|
4
4
|
|
5
5
|
datatable = $(this)
|
6
|
-
simple = (datatable.data('simple') == true)
|
6
|
+
simple = ('' + datatable.data('simple') == 'true')
|
7
7
|
input_js_options = datatable.data('input-js-options') || {}
|
8
8
|
buttons_export_columns = input_js_options['buttons_export_columns'] || ':not(.col-actions)'
|
9
9
|
|
@@ -17,7 +17,7 @@ module EffectiveDatatablesHelper
|
|
17
17
|
|
18
18
|
effective_datatable_params = {
|
19
19
|
id: datatable.to_param,
|
20
|
-
class: datatable.table_html_class,
|
20
|
+
class: Array(datatable.table_html_class).join(' '),
|
21
21
|
data: {
|
22
22
|
'effective-form-inputs' => defined?(EffectiveFormInputs),
|
23
23
|
'bulk-actions' => datatable_bulk_actions(datatable),
|
@@ -29,7 +29,7 @@ module EffectiveDatatablesHelper
|
|
29
29
|
'display-start' => datatable.display_start,
|
30
30
|
'input-js-options' => (input_js || {}).to_json.html_safe,
|
31
31
|
'reset' => datatable_reset(datatable),
|
32
|
-
'simple' =>
|
32
|
+
'simple' => simple.to_s,
|
33
33
|
'source' => effective_datatables.datatable_path(datatable, {format: 'json'}),
|
34
34
|
'total-records' => datatable.to_json[:recordsTotal]
|
35
35
|
}
|
@@ -83,6 +83,10 @@ module Effective
|
|
83
83
|
opts[:search] = { as: opts[:search] }
|
84
84
|
when Array, ActiveRecord::Relation
|
85
85
|
opts[:search] = { collection: opts[:search] }
|
86
|
+
when Hash
|
87
|
+
# Nothing
|
88
|
+
else
|
89
|
+
raise "column #{name} unexpected search value"
|
86
90
|
end
|
87
91
|
|
88
92
|
search = opts[:search]
|
@@ -93,6 +97,8 @@ module Effective
|
|
93
97
|
search[:collection] = search[:collection].map { |obj| [obj.to_s, obj.to_param] }
|
94
98
|
elsif search[:collection].kind_of?(Array)
|
95
99
|
search[:collection].each { |obj| obj[1] = 'nil' if obj[1] == nil }
|
100
|
+
elsif search[:collection].kind_of?(Hash)
|
101
|
+
search[:collection].each { |k, v| search[:collection][k] = 'nil' if v == nil }
|
96
102
|
end
|
97
103
|
|
98
104
|
search[:value] ||= search.delete(:selected) if search.key?(:selected)
|
@@ -150,7 +150,8 @@ module Effective
|
|
150
150
|
|
151
151
|
if state[:search].blank? && !datatables_ajax_request?
|
152
152
|
columns.each do |name, opts|
|
153
|
-
|
153
|
+
next unless opts[:search].kind_of?(Hash) && opts[:search].key?(:value)
|
154
|
+
state[:search][name] = opts[:search][:value]
|
154
155
|
end
|
155
156
|
end
|
156
157
|
|
@@ -24,6 +24,9 @@ EffectiveDatatables.setup do |config|
|
|
24
24
|
# Valid options are: 5, 10, 25, 50, 100, 250, 1000, :all
|
25
25
|
config.default_length = 25
|
26
26
|
|
27
|
+
# Default class used on the <table> tag
|
28
|
+
config.html_class = 'table table-bordered table-striped'
|
29
|
+
|
27
30
|
# When using the actions_column DSL method, apply the following behavior
|
28
31
|
# Valid values for each action are:
|
29
32
|
# true - display this action if authorized?(:show, Post)
|
data/lib/effective_datatables.rb
CHANGED
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: 3.0.
|
4
|
+
version: 3.0.10
|
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: 2017-06-
|
11
|
+
date: 2017-06-13 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|