effective_datatables 4.3.7 → 4.3.8

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: 4642aa5881ff3eb183f287db8c42b61c5ec18a3d
4
- data.tar.gz: ac20c253b356faf06abba201e3f705b81d64e5e4
3
+ metadata.gz: 42a1366723d6c700c2b5fb7c7fd613601182216b
4
+ data.tar.gz: 2781167994252173acbb561c09a0cf9f437b52a8
5
5
  SHA512:
6
- metadata.gz: 309b3348a5507dd365dd6349b472301c29ca39ffd1cf77e516d031ed7a4c0c7a52b6fffe3cece2e59525acd1e412956cb26f645d13994287a2c898f7416fd573
7
- data.tar.gz: 4b79372f60d9a26baeae025a63a84f2318d600adacc73b48525a463f21a6cc7b44bb7f066fdf53b6da7c11e36ee4ea8899a9458fcc407b966465a454d474d585
6
+ metadata.gz: ebd8eb10dd82fd0bd5db5642a5b8b74dc0e75f5f839d800b2ed9f76c9578d80475a6716627f90cffe80ffd6ce3204ce32e0a3853e0a802396fa5e2547bf6a410
7
+ data.tar.gz: bb2baf349bc5722e809f1b11cfe0424e758c775ccde053ed39f8f20af6865f7b3030cc9171c42a5ccb8956e2531b6276793d3a0a80c67c7d3915875b2cc68542
data/README.md CHANGED
@@ -195,11 +195,11 @@ class PostsDatatable < Effective::Datatable
195
195
  col :post_category, action: :edit
196
196
 
197
197
  if attributes[:user_id].nil? # Show all users, otherwise this table is meant for one user only
198
- col :user, search: { collection: User.authors }
199
-
200
- col 'user.first_name' # Using the joined syntax
198
+ col :user, search: User.authors.all
201
199
  end
202
200
 
201
+ col 'user.first_name' # Using the joined syntax
202
+
203
203
  if can?(:index, Comment)
204
204
  col :comments
205
205
  end
@@ -238,9 +238,11 @@ class PostsDatatable < Effective::Datatable
238
238
  # Puts links to show/edit/destroy actions, if authorized to those actions.
239
239
  # Use the actions_col block to add additional actions
240
240
 
241
- actions_col(edit: false) do |post|
242
- dropdown_link_to('Approve', approve_post_path(post) data: { method: :post, confirm: "Approve #{post}?"})
243
- end
241
+ actions_col
242
+
243
+ # actions_col(edit: false) do |post|
244
+ # dropdown_link_to('Approve', approve_post_path(post) data: { method: :post, confirm: "Approve #{post}?"})
245
+ # end
244
246
  end
245
247
 
246
248
  end
@@ -434,7 +436,9 @@ responsive: 10000 # Controls how columns collapse https://datatables.ne
434
436
  search: false
435
437
  search: :string
436
438
  search: { as: :string, fuzzy: true }
437
- search: { as: :select, collection: User.all, multiple: true }
439
+ search: User.all
440
+ search: { as: :select, collection: User.all, multiple: true, include_null: 'All Users' }
441
+ search: { collection: { 'All Books' => Book.all, 'All Shirts' => Shirt.all}, polymorphic: true }
438
442
 
439
443
  sort: true|false # Should this column be orderable. true by default
440
444
  sql_column: 'posts.rating' # The sql column to search/sort on. Only needed when doing custom selects or tricky joins.
@@ -447,7 +451,7 @@ It is auto-detected from an ActiveRecord collection's SQL datatype, and set to `
447
451
 
448
452
  Valid options for `:as` are as follows:
449
453
 
450
- `:boolean`, `:currency`, `:datetime`, `:date`, `:decimal`, `:duration`, `:email`, `:float`, `:integer`, `:percentage`, `:price`, `:resource`, `:string`, `:text`
454
+ `:boolean`, `:currency`, `:datetime`, `:date`, `:decimal`, `:duration`, `:email`, `:float`, `:integer`, `:percent`, `:price`, `:resource`, `:string`, `:text`
451
455
 
452
456
  These settings are loosely based on the regular datatypes, with some custom effective types thrown in:
453
457
 
@@ -521,6 +525,7 @@ The authorization method is configured via the `config/initializers/effective_da
521
525
  There are just a few options:
522
526
 
523
527
  ```ruby
528
+ btn_class: 'btn-sm btn-outline-primary'
524
529
  show: true|false
525
530
  edit: true|false
526
531
  destroy: true|false
@@ -697,10 +702,10 @@ end
697
702
  The filter command has the following options:
698
703
 
699
704
  ```ruby
700
- as: :select|:date|:boolean # Passed to SimpleForm
705
+ as: :select|:date|:boolean # Passed to form
701
706
  label: 'My label' # Label for this form field
702
707
  parse: -> { |term| term.to_i } # Parse the incoming term (string) into whatever datatype
703
- required: true|false # Passed to SimpleForm
708
+ required: true|false # Passed to form
704
709
  ```
705
710
 
706
711
  Any other option given will be yielded to SimpleForm as `input_html` options.
@@ -757,8 +762,6 @@ or if using [effective_resources](https://github.com/code-and-effect/effective_r
757
762
 
758
763
  ```ruby
759
764
  include Effective::CrudController
760
-
761
- collection_action :bulk_approve
762
765
  ```
763
766
 
764
767
  and in your model
@@ -3,6 +3,7 @@ module EffectiveDatatablesHelper
3
3
 
4
4
  def render_datatable(datatable, input_js: {}, buttons: true, charts: true, entries: true, filters: true, inline: false, pagination: true, search: true, simple: false, sort: true)
5
5
  raise 'expected datatable to be present' unless datatable
6
+ raise 'expected input_js to be a Hash' unless input_js.kind_of?(Hash)
6
7
 
7
8
  if simple
8
9
  buttons = charts = entries = filters = pagination = search = sort = false
@@ -48,7 +49,7 @@ module EffectiveDatatablesHelper
48
49
  'display-records' => datatable.to_json[:recordsFiltered],
49
50
  'display-start' => datatable.display_start,
50
51
  'inline' => inline.to_s,
51
- 'options' => (input_js || {}).to_json.html_safe,
52
+ 'options' => input_js.to_json,
52
53
  'reset' => (datatable_reset(datatable) if search),
53
54
  'reorder' => datatable_reorder(datatable),
54
55
  'reorder-index' => (datatable.columns[:_reorder][:index] if datatable.reorder?).to_s,
@@ -1,3 +1,3 @@
1
1
  module EffectiveDatatables
2
- VERSION = '4.3.7'.freeze
2
+ VERSION = '4.3.8'.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: 4.3.7
4
+ version: 4.3.8
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: 2018-10-31 00:00:00.000000000 Z
11
+ date: 2018-11-02 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails