five-two-nw-olivander 0.2.0.37 → 0.2.0.38

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: c981a57d42b00be64a2c6916e9407f6359be57a12286db6d107dcd53723ccb51
4
- data.tar.gz: e4a4b83c85c99d775c66930ab1b3873faa16e5ba3da090e8d6ef3e97153fa1fa
3
+ metadata.gz: 9bd58e03477da793320172cd5573cbcf620bb80718dd0738c81fc4bb43f7ba77
4
+ data.tar.gz: 73051678eacddbd98c9837807cf3927aceb7f007495e6707df8ca3c86cae71b3
5
5
  SHA512:
6
- metadata.gz: aa2450a62d515a7cb15f1fccacab6da0225fbdf7a52d9839f846bd2d7fc65d5420dd2257dd9847873208865454885fd13b9e6285f2e903be5ae54f8963d09ce0
7
- data.tar.gz: da063e58ceefc6c15684199222f15cacd501dbc781f6d247d5bae47c5a710a7a6b4fc5d85595ac9994cb353f46d4b3caac79c6bd728120c92a89227765aba40a
6
+ metadata.gz: d065f3f59f8c589faaa0bf14382aeac4ad5f53c1d990f8222943dee86f6fd8e74d259bf722db00a3d138e252270fe129e5d1d1453683c8b6410daed7307eabbb
7
+ data.tar.gz: ac20459dab97139df83767b3cd7cbe1b49b265ce212d2e5eedcd813e8fd4e8294f9fa551d5aa33acf8eef43cfb727d0125306f7238f4e519aa52db922e207679
@@ -29,6 +29,9 @@
29
29
  $(document).ready(function(e) {
30
30
  return destroySelect2s();
31
31
  });
32
+ $(document).on('page:change', function() {
33
+ return destroySelect2s();
34
+ });
32
35
 
33
36
  // $(document).ready(function(e) {
34
37
  // return $('.effective-datatables-filters input').click(function() {
@@ -13,6 +13,7 @@
13
13
  *= require 'adminlte/plugins/tempusdominus-bootstrap-4/css/tempusdominus-bootstrap-4.min'
14
14
  *= require 'adminlte/plugins/icheck-bootstrap/icheck-bootstrap.min'
15
15
  *= require 'adminlte/plugins/jqvmap/jqvmap.min'
16
+ *= require effective_datatables
16
17
  *= require 'adminlte/dist/css/adminlte.min'
17
18
  *= require 'adminlte/plugins/overlayScrollbars/css/OverlayScrollbars.min'
18
19
  *= require 'adminlte/plugins/daterangepicker/daterangepicker'
@@ -25,7 +26,6 @@
25
26
  *= require 'adminlte/plugins/ekko-lightbox/ekko-lightbox.css'
26
27
  *= require 'adminlte/plugins/bootstrap-colorpicker/css/bootstrap-colorpicker.min.css'
27
28
  *= require 'adminlte/plugins/bootstrap-switch/css/bootstrap-switch.min.css'
28
- *= require effective_datatables
29
29
  *= require_tree .
30
30
  *= require_self
31
31
  */
@@ -47,4 +47,5 @@ ul.no-bullets {
47
47
  list-style-type: none; /* Remove bullets */
48
48
  padding: 0; /* Remove padding */
49
49
  margin: 0; /* Remove margins */
50
- }
50
+ }
51
+ table.dataTable.table-striped > tbody > tr:nth-of-type(2n+1) { background: rgba(0, 0, 0, 0.05); }
@@ -14,17 +14,23 @@ module Olivander
14
14
  self.confirm = kwargs[:confirm] || false
15
15
  self.turbo_frame = kwargs[:turbo_frame]
16
16
  self.turbo = kwargs[:turbo] == true ? true : !turbo_frame.blank?
17
- self.collection = kwargs[:collection] || false
18
- self.crud_action = kwargs[:crud_action] || false
19
- self.show_in_form = kwargs[:show_in_form] || true
20
- self.show_in_datatable = kwargs[:show_in_datatable] || true
21
- self.no_route = kwargs[:no_route] || false
17
+ self.collection = default_if_not_present(kwargs[:collection], false)
18
+ self.crud_action = default_if_not_present(kwargs[:crud_action], false)
19
+ self.show_in_form = default_if_not_present(kwargs[:show_in_form], true)
20
+ self.show_in_datatable = default_if_not_present(kwargs[:show_in_datatable], true)
21
+ self.no_route = default_if_not_present(kwargs[:no_route], false)
22
22
  self.path_helper = kwargs[:path_helper]
23
23
  self.confirm_with = kwargs[:confirm_with]
24
24
  self.primary = kwargs[:primary] || crud_action
25
25
  self.html_attributes = kwargs[:html_attributes]
26
26
  end
27
27
 
28
+ def default_if_not_present(value, default)
29
+ return value unless value.nil?
30
+
31
+ default
32
+ end
33
+
28
34
  def args_hash(options = nil)
29
35
  {}.tap do |h|
30
36
  h.merge!(method: verb) unless turbo
@@ -137,7 +143,7 @@ module Olivander
137
143
  def action(sym, **kwargs)
138
144
  raise 'Must be invoked in a resource block' unless current_resource.present?
139
145
 
140
- controller ||= current_resource.model
146
+ kwargs[:controller] ||= current_resource.model
141
147
  current_resource.actions << ResourceAction.new(sym, **kwargs)
142
148
  end
143
149
 
@@ -19,7 +19,7 @@ module Olivander
19
19
  Rails.logger.debug "initializing datatable for #{klazz}"
20
20
 
21
21
  instance = klazz.new
22
- klazz_attributes = instance.attributes.collect{ |x| x[0] }
22
+ klazz_attributes = instance.attributes.collect { |x| x[0] }
23
23
  column_attributes = klazz_attributes
24
24
  column_attributes &&= only if only.size.positive?
25
25
  column_attributes -= except if except.size.positive?
@@ -64,7 +64,7 @@ module Olivander
64
64
  order(order_by[0], order_by[1]) if order_by.size == 2
65
65
  # bulk_actions_col if datatable._bulk_actions.size.positive?
66
66
 
67
- #TODO: use columns from model here instead of attributes keys
67
+ # TODO: use columns from model here instead of attributes keys
68
68
  column_attributes.each do |key|
69
69
  label = field_label_for(klazz, key)
70
70
  sym = key.gsub('_id', '')
@@ -76,7 +76,7 @@ module Olivander
76
76
  col sym, visible: visible, action: :show
77
77
  elsif sym.include?('.')
78
78
  col sym, visible: visible, label: label
79
- elsif klazz.columns.select{ |x| x.name == key }.first&.type == :boolean
79
+ elsif klazz.columns.select { |x| x.name == key }.first&.type == :boolean
80
80
  col sym, visible: visible, label: label do |c|
81
81
  val = c.send(sym)
82
82
  icon_class = val ? 'fa-check text-success' : 'fa-times text-danger'
@@ -2,5 +2,5 @@
2
2
 
3
3
  # needed for gem
4
4
  module Olivander
5
- VERSION = '0.2.0.37'
5
+ VERSION = '0.2.0.38'
6
6
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: five-two-nw-olivander
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0.37
4
+ version: 0.2.0.38
5
5
  platform: ruby
6
6
  authors:
7
7
  - Eric Dennis
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2024-10-24 00:00:00.000000000 Z
11
+ date: 2024-10-28 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: chartkick