effective_datatables 2.6.15 → 2.6.16

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: 9d928965ede9ce8dfc004b6f2653cac420eee7c6
4
- data.tar.gz: b1612ccf4823b60f283d4c7f885b4b1224774dd4
3
+ metadata.gz: f0db1b45edf40f52aa0419d0ade8b440b191bede
4
+ data.tar.gz: be8443850e6d0d9eaf1d6072782c212c7616eb76
5
5
  SHA512:
6
- metadata.gz: 7f26405d6274b823095d11290b1573114ace9ba17b386f59658b31d6fc27b9025bd3b04a24e9360f9e44700bcaa739edcca138f6686ac0cd365947f17b7ecb83
7
- data.tar.gz: 4b622c39357d491f66baac5e773b86e0cfb0bd9ca98f4e80e8632771d8ea96febc437bd749f0819d8765b92915d7a0e9029acf00c0f61f77123a90b54eea0709
6
+ metadata.gz: 3b84a7aef73fe0f4f58153e69bc5f1dffaea6dfc1d62689e6c4b9be1a564549caa12968d07a8331437c0eeeb20a6844242884d888d26f64dedf2d1302e51767c
7
+ data.tar.gz: cc7eafce76ae1659c13a9efc10862f5ab35f7068780ec8a11dee197c77d3f701a172e37a930fc14825245f05e23ae433e8de77c2e725ad55a39e33544bf7291b
@@ -161,6 +161,6 @@ table.dataTable tbody {
161
161
  }
162
162
 
163
163
  td.col-bulk_actions {
164
- input[type='checkbox'] { margin-left: 3px; }
164
+ input[type='checkbox'] { margin-left: 1px; margin-right: 1px; }
165
165
  }
166
166
  }
@@ -0,0 +1,8 @@
1
+ .effective-datatable-scopes {
2
+ .form-inline {
3
+ .form-control, input[type='submit'] {
4
+ margin-left: 8px;
5
+ }
6
+ }
7
+ margin-bottom: 12px;
8
+ }
@@ -5,3 +5,5 @@
5
5
  @import 'dataTables/responsive/responsive.bootstrap';
6
6
 
7
7
  @import 'effective_datatables/overrides';
8
+
9
+ @import 'effective_datatables/scopes';
@@ -0,0 +1,11 @@
1
+ # These are expected to be called by a developer. They are part of the datatables DSL.
2
+ module EffectiveDatatablesControllerHelper
3
+
4
+ def render_datatable_index(datatable)
5
+ raise 'expected Effective::Datatable' unless datatable.kind_of?(Effective::Datatable)
6
+
7
+ @datatable = datatable
8
+ render file: 'effective/datatables/index'
9
+ end
10
+
11
+ end
@@ -23,7 +23,7 @@ module Effective
23
23
  def initialize(*args)
24
24
  if args.present? && args.first != nil
25
25
  raise "#{self.class.name}.new() can only be initialized with a Hash like arguments" unless args.first.kind_of?(Hash)
26
- args.first.each { |k, v| self.attributes[k] = v }
26
+ args.first.each { |k, v| self.attributes[k] = v.presence }
27
27
  end
28
28
 
29
29
  if respond_to?(:initialize_scopes) # There was at least one scope defined in the scopes do .. end block
@@ -31,9 +31,14 @@ module Effective
31
31
  # We want to make sure an input_html: { value: default } exists
32
32
  def _initialize_scope_options(scopes)
33
33
  (scopes || []).each do |name, options|
34
- value = attributes.key?(name) ? attributes[name] : options[:default]
34
+ value = attributes.key?(name) ? attributes[name].presence : options[:default]
35
35
 
36
- if (options[:fallback] || options[:presence]) && attributes[name].blank? && attributes[name] != false
36
+ if attributes.key?(name) == false
37
+ self.attributes[name] = options[:default]
38
+ value = options[:default]
39
+ end
40
+
41
+ if (options[:fallback] || options[:presence]) && attributes[name].blank?
37
42
  self.attributes[name] = options[:default]
38
43
  value = options[:default]
39
44
  end
@@ -1,5 +1,5 @@
1
1
  .row
2
- .col-sm-12
2
+ .col-sm-12.effective-datatable-scopes
3
3
  = simple_form_for :scopes, url: request.path, method: :get, html: { class: 'form-inline' } do |form|
4
4
 
5
5
  - datatable.scopes.each do |name, options|
@@ -0,0 +1,2 @@
1
+ = render_datatable_scopes(@datatable)
2
+ = render_datatable(@datatable)
@@ -9,6 +9,8 @@ module EffectiveDatatables
9
9
  ActiveSupport.on_load :action_controller do
10
10
  helper EffectiveDatatablesHelper
11
11
  helper EffectiveDatatablesPrivateHelper
12
+
13
+ ActionController::Base.send :include, ::EffectiveDatatablesControllerHelper
12
14
  end
13
15
  end
14
16
 
@@ -1,3 +1,3 @@
1
1
  module EffectiveDatatables
2
- VERSION = '2.6.15'.freeze
2
+ VERSION = '2.6.16'.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: 2.6.15
4
+ version: 2.6.16
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: 2016-10-17 00:00:00.000000000 Z
11
+ date: 2016-10-23 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -133,7 +133,9 @@ files:
133
133
  - app/assets/stylesheets/dataTables/responsive/responsive.bootstrap.css
134
134
  - app/assets/stylesheets/effective_datatables.scss
135
135
  - app/assets/stylesheets/effective_datatables/_overrides.scss.erb
136
+ - app/assets/stylesheets/effective_datatables/_scopes.scss
136
137
  - app/controllers/effective/datatables_controller.rb
138
+ - app/helpers/effective_datatables_controller_helper.rb
137
139
  - app/helpers/effective_datatables_helper.rb
138
140
  - app/helpers/effective_datatables_private_helper.rb
139
141
  - app/models/effective/access_denied.rb
@@ -158,6 +160,7 @@ files:
158
160
  - app/views/effective/datatables/_datatable.html.haml
159
161
  - app/views/effective/datatables/_scopes.html.haml
160
162
  - app/views/effective/datatables/_spacer_template.html
163
+ - app/views/effective/datatables/index.html.haml
161
164
  - config/routes.rb
162
165
  - lib/effective_datatables.rb
163
166
  - lib/effective_datatables/engine.rb