effective_datatables 4.8.13 → 4.9.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
  SHA256:
3
- metadata.gz: 0b0edb95c464c25b0ed732bfac841becc3d09685befc3c352714b1ee0a2c7497
4
- data.tar.gz: 6a469ab0e68213f62ac74a04ed14235ed924b7ac51fcea1d130d113763bba9e7
3
+ metadata.gz: afc1825001f74c08289310c87a0e3ffa014a2e909c21487841103e3adf05e0a5
4
+ data.tar.gz: 5318e53b07af9daa08cc4fd39f14cf9570620e30f9222beb70b830de47dd0f06
5
5
  SHA512:
6
- metadata.gz: fba9d13292e49be2ce9a0a5b6ddbb08cbed6753ce8196aebf6ddab0f3daaf0d8dae78d23fb17ddbb25834f3245241ab5fcde1a6f06bd6d667be1da6865d482ba
7
- data.tar.gz: 39b61f089ffbc7ec9b505611717bf421a3a68f5131253040e17eae00d429dd5aacd36cf0c831d8919ab0992e6ff5aef98363094c1161fa2e0fbb2ccf1d50c733
6
+ metadata.gz: 9c882a77988f466ef89a54361abd2fa26953554b4a859999d05c462e88a8412966ab3292914d28ae22f9a550bcb3eaea85ffa76d24aa5fc6bb16a53c05352801
7
+ data.tar.gz: 0a129c87f1bce4334570f80f10ca8ab2b432ede293f9ab34c0e135bdde99e936563864e4cc0abc6f0c679fca2498d3965f8ad5610d941b1512620774264b45e7
data/MIT-LICENSE CHANGED
@@ -1,4 +1,4 @@
1
- Copyright 2019 Code and Effect Inc.
1
+ Copyright 2021 Code and Effect Inc.
2
2
 
3
3
  Permission is hereby granted, free of charge, to any person obtaining
4
4
  a copy of this software and associated documentation files (the
data/README.md CHANGED
@@ -8,7 +8,7 @@ Does the right thing with searching sql columns as well as computed values from
8
8
 
9
9
  Displays links to associated edit/show/destroy actions based on `current_user` authorized actions.
10
10
 
11
- Other features include aggregate (total/average) footer rows, bulk actions, show/hide columns, responsive collapsing columns and Google charts.
11
+ Other features include aggregate (total/average) footer rows, bulk actions, show/hide columns, responsive collapsing columns, google charts, and inline crud.
12
12
 
13
13
  This gem includes the jQuery DataTables assets.
14
14
 
@@ -54,7 +54,8 @@ Please check out [Effective Datatables 3.x](https://github.com/code-and-effect/e
54
54
  * [bulk_action](#bulk_action_divider)
55
55
  * [bulk_download](#bulk_download)
56
56
  * [bulk_action_content](#bulk_action_content)
57
- * [charts](#charts)
57
+ * [Charts](#charts)
58
+ * [Inline](#inline)
58
59
  * [Extras](#extras)
59
60
  * [Advanced Search and Sort](#advanced-search-and-sort)
60
61
  * [Addtional Functionality](#additional-functionality)
@@ -453,7 +454,7 @@ The `datatable do ... end` block configures a table of data.
453
454
 
454
455
  Initialize the datatable in your controller or view, `@datatable = PostsDatatable.new(self)`, and render it in your view `<%= render_datatable(@datatable) %>`
455
456
 
456
- ### col
457
+ ## col
457
458
 
458
459
  This is the main DSL method that you will interact with.
459
460
 
@@ -526,7 +527,7 @@ You can also use the joined syntax, `col 'user.email'` to create a column for ju
526
527
 
527
528
  This feature is only working with `belongs_to` and you need to add the `.joins(:user)` to the collection do ... end block yourself.
528
529
 
529
- ### val
530
+ ## val
530
531
 
531
532
  Shorthand for value, this command also creates a column on the datatable.
532
533
 
@@ -548,7 +549,7 @@ This is implemented as a full Array search/sort and is much slower for large dat
548
549
 
549
550
  The `.format do ... end` block can then be used to apply custom formatting.
550
551
 
551
- ### bulk_actions_col
552
+ ## bulk_actions_col
552
553
 
553
554
  Creates a column of checkboxes for use with the `bulk_actions` section.
554
555
 
@@ -558,7 +559,7 @@ Use these checkboxes to select all / none / one or more rows for the `bulk_actio
558
559
 
559
560
  You can only have one `bulk_actions_col` per datatable.
560
561
 
561
- ### actions_col
562
+ ## actions_col
562
563
 
563
564
  When working with an ActiveRecord based collection, this column will consider the `current_user`'s authorization, and generate links to edit, show and destroy actions for any collection class.
564
565
 
@@ -596,7 +597,7 @@ Any `data-remote` actions will be hijacked and performed as inline ajax by datat
596
597
 
597
598
  If you'd like to opt-out of this behavior, use `actions_col(inline: false)` or add `data-inline: false` to your action link.
598
599
 
599
- ### length
600
+ ## length
600
601
 
601
602
  Sets the default number of rows per page. Valid lengths are `5`, `10`, `25`, `50`, `100`, `250`, `500`, `:all`
602
603
 
@@ -606,7 +607,7 @@ When not specified, effective_datatables uses the default as per the `config/ini
606
607
  length 100
607
608
  ```
608
609
 
609
- ### order
610
+ ## order
610
611
 
611
612
  Sets the default order of table rows. The first argument is the column, the second the direction.
612
613
 
@@ -618,7 +619,7 @@ When not specified, effective_datatables will sort by the first defined column.
618
619
  order :created_at, :asc|:desc
619
620
  ```
620
621
 
621
- ### reorder
622
+ ## reorder
622
623
 
623
624
  Enables drag-and-drop row re-ordering.
624
625
 
@@ -636,7 +637,7 @@ reorder :position
636
637
 
637
638
  Using `reorder` will sort the collection by this field and disable all other column sorting.
638
639
 
639
- ### aggregate
640
+ ## aggregate
640
641
 
641
642
  The `aggregate` command inserts a row in the table's `tfoot`.
642
643
 
@@ -681,7 +682,7 @@ The form is submitted by an AJAX POST action, or, in some advanced circumstances
681
682
 
682
683
  Initialize the datatable in your controller or view, `@datatable = PostsDatatable.new(self)`, and render its filters anywhere with `<%= render_datatable_filters(@datatable) %>`.
683
684
 
684
- ### scope
685
+ ## scope
685
686
 
686
687
  All defined scopes are rendered as a single radio button form field. Works great with the [effective_form_inputs](https://github.com/code-and-effect/effective_form_inputs) gem.
687
688
 
@@ -705,7 +706,7 @@ class Post < ApplicationRecord | ActiveRecord::Base
705
706
  end
706
707
  ```
707
708
 
708
- ### filter
709
+ ## filter
709
710
 
710
711
  Each filter has a name and a default/fallback value. If the form is submitted blank, the default values are used.
711
712
 
@@ -758,7 +759,7 @@ Creates a single dropdown menu with a link to each action, download or content.
758
759
 
759
760
  Along with this section, you must put a `bulk_actions_col` somewhere in your `datatable do ... end` section.
760
761
 
761
- ### bulk_action
762
+ ## bulk_action
762
763
 
763
764
  Creates a link that becomes clickable when one or more checkbox/rows are selected as per the `bulk_actions_col` column.
764
765
 
@@ -814,11 +815,11 @@ def approve!
814
815
  end
815
816
  ```
816
817
 
817
- ### bulk_action_divider
818
+ ## bulk_action_divider
818
819
 
819
820
  Inserts a menu divider `<li class='divider' role='separator'></li>`
820
821
 
821
- ### bulk_download
822
+ ## bulk_download
822
823
 
823
824
  So it turns out there are some http issues with using an AJAX action to download a file.
824
825
 
@@ -859,7 +860,7 @@ def bulk_export_report
859
860
  end
860
861
  ```
861
862
 
862
- ### bulk_action_content
863
+ ## bulk_action_content
863
864
 
864
865
  Blindly inserts content into the dropdown.
865
866
 
@@ -873,7 +874,7 @@ end
873
874
 
874
875
  Don't actually use this.
875
876
 
876
- ## charts
877
+ # Charts
877
878
 
878
879
  Create a [Google Chart](https://developers.google.com/chart/interactive/docs/quick_start) based on your searched collection, filters and attributes.
879
880
 
@@ -930,11 +931,169 @@ All options passed to `chart` are used to initialize the chart javascript.
930
931
 
931
932
  By default, the only package that is loaded is `corechart`, see the `config/initializers/effective_datatables.rb` file to add more packages.
932
933
 
933
- ## Extras
934
+ # Inline
935
+
936
+ Any datatable can be used as an inline datatable, to create, update and destroy resources without leaving the current page.
937
+
938
+ If your datatable is already working with `actions_col` and being rendered from an `Effective::CrudController` controller, all you need to do is change your view from `render_datatable(@datatable)` to `render_datatable(@datatable, inline: true)`.
939
+
940
+ Click here for a [Inline Live Demo](https://effective-datatables-demo.herokuapp.com/things) and here for an [Inline Code Example](https://github.com/code-and-effect/effective_datatables_demo)
941
+ (only the `thing` data model and `things_datatable` are being used inline)
942
+
943
+ To use effective_datatables as an inline CRUD builder, you will be relying heavily on [effective_resources](https://github.com/code-and-effect/effective_resources) which is a dependency of this gem. I would also recommend you install [effective_developer](https://github.com/code-and-effect/effective_developer) to get access to some scaffolds and generators. It's not required but I'm gonna use them in this example.
944
+
945
+ Here is how I build rails models for inline datatable CRUD operations:
946
+
947
+ 1. Create a new model file `app/models/thing.rb`:
948
+
949
+ ```ruby
950
+ class Thing < ApplicationRecord
951
+ belongs_to :user
952
+
953
+ effective_resource do
954
+ title :string
955
+ description :text
956
+ timestamps
957
+ end
958
+
959
+ scope :deep, -> { includes(:user) }
960
+ scope :sorted, -> { order(:title) }
961
+
962
+ def to_s
963
+ title
964
+ end
965
+ end
966
+ ```
967
+
968
+ The `effective_resource do` block comes from the [effective_resources](https://github.com/code-and-effect/effective_resources) gem and is used to build any permitted_params.
969
+
970
+ 2. Generate a migration. Run `rails generate effective:migration things` to create a migration based off the model file then `rails db:migrate`.
971
+
972
+ 3. Scaffold the rest. Run `rails generate effective:scaffold_controller things` which will create:
973
+
974
+ - A controller `app/controllers/things_controller.rb`:
975
+
976
+ ```ruby
977
+ class ThingsController < ApplicationController
978
+ include Effective::CrudController
979
+ end
980
+ ```
981
+
982
+ The Effective::CrudController comes from [effective_resources](https://github.com/code-and-effect/effective_resources) gem and handles the standard 7 CRUD actions and member and collection actions. It is opinionated code that follows rails conventions. It considers the `routes.rb` and `ability.rb` or other authorization, to find all available actions.
983
+
984
+ - A datatable `app/datatables/things_datatable.rb`:
985
+
986
+ ```ruby
987
+ class ThingsDatatable < Effective::Datatable
988
+ datatable do
989
+ col :title
990
+ col :description
991
+ actions_col
992
+ end
993
+
994
+ collection do
995
+ Thing.deep.all
996
+ end
997
+ end
998
+ ```
999
+
1000
+ This is an ordinary datatable. As long as it's an ActiveRecord collection, inline crud will work.
1001
+
1002
+ - A view partial `app/views/things/_thing.html.haml`:
1003
+
1004
+ ```ruby
1005
+ %table.table
1006
+ %tbody
1007
+ %tr
1008
+ %th Title
1009
+ %td= thing.title
1010
+ %tr
1011
+ %th Description
1012
+ %td= thing.description
1013
+ ```
1014
+
1015
+ This file is what rails uses when you call `render(thing)` and what datatables uses for the inline `show` action. It's important that its called `_thing.html`.
1016
+
1017
+ - A form partial `app/views/things/_form.html.haml`:
1018
+
1019
+ ```ruby
1020
+ = effective_form_with(model: thing) do |f|
1021
+ = f.text_field :title
1022
+ = f.text_area :description
1023
+ = f.submit
1024
+ ```
1025
+
1026
+ The `effective_form_with` comes from [effective_bootstrap](https://github.com/code-and-effect/effective_bootstrap) gem and is a drop-in replacement for the newer `form_with` syntax. It's really good, you should use it, but an ordinary `form_with` will work here just fine.
1027
+
1028
+ This `_form.html` is an effective gems convention. This file must exist for your resource.
1029
+
1030
+ - A resources entry in `config/routes.rb`:
1031
+
1032
+ ```ruby
1033
+ Rails.application.routes.draw do
1034
+ resources :things do
1035
+ post :approve, on: :member
1036
+ post :reject, on: :member
1037
+ end
1038
+ end
1039
+ ```
1040
+
1041
+ Above we have `resources :things` for the 7 crud actions. And we add two more member actions, which datatables will call `approve!` or `reject!` on thing.
1042
+
1043
+
1044
+ 4. Render in the view. Create an `app/views/things/index.html.haml` and call `render_datatable(@datatable, inline: true)` or `render_inline_datatable(@datatable).
1045
+
1046
+ ```ruby
1047
+ = render_datatable(@datatable, inline: true)
1048
+ ```
1049
+
1050
+ Your datatable should now have New, Show, Edit, Approve and Reject buttons. Click them for inline functionality.
1051
+
1052
+ ## Troubleshooting Inline
1053
+
1054
+ If things aren't working, try the following:
1055
+
1056
+ - Double check your javascripts:
1057
+
1058
+ ```ruby
1059
+ //= require jquery3
1060
+ //= require popper
1061
+ //= require bootstrap
1062
+ //= require effective_bootstrap
1063
+ //= require effective_datatables
1064
+ //= require jquery_ujs
1065
+ ```
1066
+
1067
+ The inline functionality requires one of sprockets jquery_ujs, sprockets rails_ujs or webpack @rails/ujs libraries.
1068
+
1069
+ - Double check your stylesheets:
1070
+
1071
+ ```ruby
1072
+ @import 'bootstrap';
1073
+ @import 'effective_bootstrap';
1074
+ @import 'effective_datatables';
1075
+ ```
1076
+
1077
+ - Make sure your datatable is not being rendered inside a `<form>...</form>` tag. It will display a javascript console error and won't work.
1078
+
1079
+ - Double check your `resources :things` are in `routes.rb` in the same namespace as the controller, and that you have authorization for those actions in `ability.rb` or whatever your `config/initializers/effective_datatables.rb` `config.authorization_method` returns.
1080
+
1081
+ ## A note on how it works
1082
+
1083
+ We use good old `rails_ujs` for all inline actions.
1084
+
1085
+ When inline, any of the actions_col actions, as well as the New button, will be changed into `data-remote: true` actions.
1086
+
1087
+ The [inline_crud javascript](https://github.com/code-and-effect/effective_datatables/blob/master/app/assets/javascripts/effective_datatables/inline_crud.js.coffee) handles fetching the form, or view partial and expanding/collapsing the appropriate row of the datatable.
1088
+
1089
+ When an inline action is clicked, effective_datatables will make an AJAX request to the server, which could be received by an `Effective::CrudController` that will handle the `.js` format, and respond_with the appropriate [rails_ujs .js.erb views](https://github.com/code-and-effect/effective_resources/tree/master/app/views/application).
1090
+
1091
+
1092
+ # Extras
934
1093
 
935
1094
  The following commands don't quite fit into the DSL, but are present nonetheless.
936
1095
 
937
- ### simple
1096
+ ## simple
938
1097
 
939
1098
  To render a simple table, without pagination, sorting, filtering, export buttons, per page, and default visibility:
940
1099
 
@@ -942,7 +1101,7 @@ To render a simple table, without pagination, sorting, filtering, export buttons
942
1101
  <%= render_datatable(@datatable, simple: true) %>
943
1102
  ```
944
1103
 
945
- ### index
1104
+ ## index
946
1105
 
947
1106
  If you just want to render a datatable and nothing else, there is a quick way to skip creating a view:
948
1107
 
@@ -956,13 +1115,13 @@ end
956
1115
 
957
1116
  will render `views/effective/datatables/index` with the assigned datatable.
958
1117
 
959
- ## Advanced Search and Sort
1118
+ # Advanced Search and Sort
960
1119
 
961
1120
  The built-in search and ordering can be overridden on a per-column basis.
962
1121
 
963
1122
  The only gotcha here is that you must be aware of the type of collection.
964
1123
 
965
- ### With ActiveRecord collection
1124
+ ## With ActiveRecord collection
966
1125
 
967
1126
  In the case of a `col` and an ActiveRecord collection:
968
1127
 
@@ -994,7 +1153,7 @@ If `column[:sql_column].blank?` then this `col` has fallen back to being a `val`
994
1153
 
995
1154
  Try adding `col :post_category, sql_column: 'post_categories.title'`
996
1155
 
997
- ### With Array collection
1156
+ ## With Array collection
998
1157
 
999
1158
  And in the case of a `col` with an Array collection, or any `val`:
1000
1159
 
@@ -1033,7 +1192,7 @@ end
1033
1192
 
1034
1193
  The search and sort for each column will be merged together to form the final results.
1035
1194
 
1036
- ### Default search collection
1195
+ ## Default search collection
1037
1196
 
1038
1197
  When using a `col :comments` type belongs_to or has_many column, a search collection for that class will be loaded.
1039
1198
 
@@ -16,7 +16,7 @@ flash = (message, status = '') ->
16
16
  timeout = $processing.data('timeout')
17
17
  clearTimeout(timeout) if timeout
18
18
 
19
- delay = (if status == 'danger' then 4000 else 1500)
19
+ delay = (if status == 'danger' then 4000 else 1000)
20
20
 
21
21
  $processing.html(message).data('timeout', setTimeout( =>
22
22
  $processing.html('Processing...')
@@ -165,7 +165,6 @@ initializeDataTables = (target) ->
165
165
  $input.on 'change', (event) -> dataTableSearch($(event.currentTarget))
166
166
  else if $input.is('input')
167
167
  $input.delayedChange ($input) -> dataTableSearch($input)
168
- $input.on('paste', -> dataTableSearch($input))
169
168
 
170
169
  # Do the actual search
171
170
  dataTableSearch = ($input) -> # This is the function called by a select or input to run the search
@@ -201,6 +200,7 @@ initializeDataTables = (target) ->
201
200
 
202
201
  table.addClass('initialized')
203
202
  table.children('thead').trigger('effective-bootstrap:initialize')
203
+ table.children('thead').find('input[autofocus]').first().focus()
204
204
  true
205
205
 
206
206
  destroyDataTables = ->
@@ -123,7 +123,6 @@ beforeNew = ($action) ->
123
123
 
124
124
  # Append spinner and show Processing
125
125
  $th.append($table.data('spinner'))
126
- $table.DataTable().flash()
127
126
  $table.one 'draw.dt', (event) ->
128
127
  $th.find('a').show().siblings('svg').remove() if event.target == event.currentTarget
129
128
 
@@ -152,7 +151,6 @@ beforeEdit = ($action) ->
152
151
 
153
152
  # Append spinner and show Processing
154
153
  $td.append($table.data('spinner'))
155
- $table.DataTable().flash()
156
154
 
157
155
  afterEdit = ($action) ->
158
156
  $tr = $action.closest('tr')
@@ -14,7 +14,7 @@
14
14
 
15
15
  return this.each(function() {
16
16
  var element = $(this);
17
- element.keyup(function() {
17
+ element.on('keyup paste', function() {
18
18
  clearTimeout(timer);
19
19
  timer = setTimeout(function() {
20
20
  var newVal = element.val();
@@ -1,6 +1,6 @@
1
1
  # These are expected to be called by a developer. They are part of the datatables DSL.
2
2
  module EffectiveDatatablesHelper
3
- def render_datatable(datatable, input_js: {}, buttons: true, charts: true, entries: true, filters: true, inline: false, pagination: true, search: true, simple: false, sort: true)
3
+ def render_datatable(datatable, input_js: {}, buttons: true, charts: true, entries: true, filters: true, inline: false, namespace: nil, pagination: true, search: true, simple: false, sort: true)
4
4
  raise 'expected datatable to be present' unless datatable
5
5
  raise 'expected input_js to be a Hash' unless input_js.kind_of?(Hash)
6
6
 
@@ -10,6 +10,7 @@ module EffectiveDatatablesHelper
10
10
 
11
11
  datatable.attributes[:inline] = true if inline
12
12
  datatable.attributes[:sortable] = false unless sort
13
+ datatable.attributes[:namespace] = namespace if namespace
13
14
 
14
15
  datatable.view ||= self
15
16
 
@@ -187,9 +187,3 @@ module Effective
187
187
 
188
188
  end
189
189
  end
190
-
191
- # [
192
- # [1, 'title 1'],
193
- # [2, 'title 2'],
194
- # [3, 'title 3']
195
- # ]
@@ -10,7 +10,7 @@ module Effective
10
10
 
11
11
  def load_cookie!
12
12
  return unless EffectiveDatatables.save_state
13
- return unless view.respond_to?(:cookies)
13
+ return unless (view.cookies rescue false) # Rails 6.1 view doesn't respond_to?(:cookies)
14
14
 
15
15
  @dt_cookie = view.cookies.signed['_effective_dt']
16
16
 
@@ -34,7 +34,7 @@ module Effective
34
34
 
35
35
  def save_cookie!
36
36
  return unless EffectiveDatatables.save_state
37
- return unless view.respond_to?(:cookies)
37
+ return unless (view.cookies rescue false)
38
38
 
39
39
  @dt_cookie ||= []
40
40
  @dt_cookie << [cookie_key, cookie_payload]
@@ -1,8 +1,9 @@
1
1
  .btn-group.buttons-bulk-actions
2
2
  %button.btn.btn-link.btn-sm.dropdown-toggle{'type': 'button', 'data-toggle': 'dropdown', 'aria-haspopup': true, 'aria-expanded': false, 'disabled': 'disabled'}
3
- Bulk Actions
3
+ = t('effective_datatables.bulk_actions')
4
4
  .dropdown-menu
5
5
  - if datatable._bulk_actions.present?
6
6
  = datatable._bulk_actions.join.html_safe
7
7
  - else
8
- %a.dropdown-item{href: '#'} No bulk actions
8
+ %a.dropdown-item{href: '#'}
9
+ = t('effective_datatables.no_bulk_actions')
@@ -7,6 +7,7 @@ en:
7
7
  new: New
8
8
  actions: Actions
9
9
  bulk_actions: Bulk Actions
10
+ no_bulk_actions: No bulk actions
10
11
  applying: Applying...
11
12
  boolean_true: 'Yes'
12
13
  boolean_false: 'No'
@@ -7,6 +7,7 @@ es:
7
7
  new: Nuevo
8
8
  actions: Acciones
9
9
  bulk_actions: Acciones en masa
10
+ no_bulk_actions: Sin acciones en masa
10
11
  applying: Filtrando...
11
12
  boolean_true: 'Sí'
12
13
  boolean_false: 'No'
@@ -7,6 +7,7 @@ nl:
7
7
  new: Nieuwe
8
8
  actions: Acties
9
9
  bulk_actions: Bulkacties
10
+ no_bulk_actions: Geen bulkacties
10
11
  applying: Toepassen...
11
12
  boolean_true: 'Ja'
12
13
  boolean_false: 'Nee'
@@ -1,3 +1,3 @@
1
1
  module EffectiveDatatables
2
- VERSION = '4.8.13'.freeze
2
+ VERSION = '4.9.1'.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.8.13
4
+ version: 4.9.1
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: 2020-11-20 00:00:00.000000000 Z
11
+ date: 2021-04-23 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -67,7 +67,7 @@ dependencies:
67
67
  - !ruby/object:Gem::Version
68
68
  version: '0'
69
69
  - !ruby/object:Gem::Dependency
70
- name: sass
70
+ name: sassc
71
71
  requirement: !ruby/object:Gem::Requirement
72
72
  requirements:
73
73
  - - ">="
@@ -129,11 +129,9 @@ files:
129
129
  - app/assets/stylesheets/effective_datatables.scss
130
130
  - app/assets/stylesheets/effective_datatables/_overrides.bootstrap4.scss
131
131
  - app/controllers/effective/datatables_controller.rb
132
- - app/datatables/effective_style_guide_datatable.rb
133
132
  - app/helpers/effective_datatables_controller_helper.rb
134
133
  - app/helpers/effective_datatables_helper.rb
135
134
  - app/helpers/effective_datatables_private_helper.rb
136
- - app/models/effective/access_denied.rb
137
135
  - app/models/effective/datatable.rb
138
136
  - app/models/effective/datatable_column.rb
139
137
  - app/models/effective/datatable_column_tool.rb
@@ -163,7 +161,6 @@ files:
163
161
  - app/views/effective/datatables/_resource_column.html.haml
164
162
  - app/views/effective/datatables/_spacer_template.html
165
163
  - app/views/effective/datatables/index.html.haml
166
- - app/views/effective/style_guide/_effective_datatables.html.haml
167
164
  - config/effective_datatables.rb
168
165
  - config/locales/en.yml
169
166
  - config/locales/es.yml
@@ -1,45 +0,0 @@
1
- class EffectiveStyleGuideDatatable < Effective::Datatable
2
- datatable do
3
- length 10
4
-
5
- col :id
6
- col :material, search: { collection: ['Stainless Steel', 'Copper', 'Cast Iron', 'Composite'] }
7
- col :bowl, search: { collection: ['Single Bowl', 'Double Bowl', 'Triple Bowl'] }
8
- col :name
9
- col :date, as: :date
10
- end
11
-
12
- # Set the permission check to the same as Effective::StyleGuide
13
- def collection_class
14
- defined?(Effective::StyleGuide) ? Effective::StyleGuide : super
15
- end
16
-
17
- collection do
18
- now = Time.zone.now
19
- [
20
- [1, 'Stainless Steel', 'Single Bowl', 'KOHLER Staccato', (now + 1.day)],
21
- [2, 'Stainless Steel', 'Double Bowl', 'KOHLER Vault Undercounter', (now + 1.day)],
22
- [3, 'Stainless Steel', 'Triple Bowl', 'KRAUS All-In-One', (now + 1.day)],
23
- [4, 'Stainless Steel', 'Single Bowl', 'KOHLER Vault Dual Mount', (now + 1.day)],
24
- [5, 'Stainless Steel', 'Single Bowl', 'KRAUS All-In-One Undermount', (now + 2.days)],
25
- [6, 'Stainless Steel', 'Double Bowl', 'Glacier Bay All-in-One', (now + 2.days)],
26
- [7, 'Stainless Steel', 'Single Bowl', 'Elkay Neptune', (now + 2.days)],
27
- [8, 'Copper', 'Single Bowl', 'ECOSINKS Apron Front Dual Mount', (now + 2.days)],
28
- [9, 'Copper', 'Double Bowl', 'ECOSINKS Dual Mount Front Hammered', (now + 2.days)],
29
- [10, 'Copper', 'Triple Bowl', 'Glarier Bay Undermount', (now + 3.days)],
30
- [11, 'Copper', 'Single Bowl', 'Whitehaus Undermount', (now + 3.days)],
31
- [12, 'Copper', 'Double Bowl', 'Belle Foret Apron Front', (now + 3.days)],
32
- [13, 'Copper', 'Double Bowl', 'Pegasus Dual Mount', (now + 3.days)],
33
- [14, 'Cast Iron', 'Double Bowl', 'KOHLER Whitehaven', (now + 3.days)],
34
- [15, 'Cast Iron', 'Triple Bowl', 'KOHLER Hartland', (now + 3.days)],
35
- [16, 'Cast Iron', 'Single Bowl', 'KOHLER Cape Dory Undercounter', (now + 4.days)],
36
- [17, 'Cast Iron', 'Double Bowl', 'KOLER Bakersfield', (now + 4.days)],
37
- [18, 'Cast Iron', 'Double Bowl', 'American Standard Offset', (now + 4.days)],
38
- [19, 'Cast Iron', 'Single Bowl', 'Brookfield Top', (now + 4.days)],
39
- [20, 'Composite', 'Single Bowl', 'Blanco Diamond Undermount', (now + 5.days)],
40
- [21, 'Composite', 'Double Bowl', 'Mont Blanc Waterbrook', (now + 5.days)],
41
- [22, 'Composite', 'Triple Bowl', 'Pegasus Triple Mount', (now + 5.days)],
42
- [23, 'Composite', 'Single Bowl', 'Swanstone Dual Mount', (now + 5.days)]
43
- ]
44
- end
45
- end
@@ -1,17 +0,0 @@
1
- unless defined?(Effective::AccessDenied)
2
- module Effective
3
- class AccessDenied < StandardError
4
- attr_reader :action, :subject
5
-
6
- def initialize(message = nil, action = nil, subject = nil)
7
- @message = message
8
- @action = action
9
- @subject = subject
10
- end
11
-
12
- def to_s
13
- @message || I18n.t(:'unauthorized.default', :default => 'Access Denied')
14
- end
15
- end
16
- end
17
- end
@@ -1 +0,0 @@
1
- = render_datatable(EffectiveStyleGuideDatatable.new)