effective_resources 2.2.10 → 2.2.12

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: 3f5258d38255a23862d15be45d82d15d68596bb42b2f31f88e5159c339e2fae8
4
- data.tar.gz: c6dba77a6cdb45ec02fead79b8050cee8c482325ec772a53ffde5cea9facc754
3
+ metadata.gz: a2e1045a3f584c05b66281ec3239905cd43100ee124bf9c0fdcfeff7d289fd6f
4
+ data.tar.gz: 6276115c7a5104f3f51ce56c54681c0ab775fb63c8ff2f362e3f6fd51fcfebde
5
5
  SHA512:
6
- metadata.gz: c0f15eacdd2e1b34c85b57921dd21d01f3dfb1b22e45f17b45c2f0a066add4f0ede0856e649e843a77c016212c5133e88b780980ce48cc30c844a6e0e735149c
7
- data.tar.gz: 22088c964406e716aa5d430372813632064278e1a02e1a4fa09f6845a1a8d55b5799a14ce2d29329b624fe59d7d7b1710fcb0437242c345848de21e9bd2a46cb
6
+ metadata.gz: b5dfd7efe2f70a7b9b5aa337cfbe915700fa211006e95d5d754e631565a1301367e7690b650394c19681bf3a47f2645ecdc1a02fef850abc3931d65c36893228
7
+ data.tar.gz: 768dbb29366b8ad1df0cc5e9deed4f3e2c216df6de6175c60384033524f12a49c5425b900e16f6c71cd5fa0cf7e4c537aab28f4b824955ec0ee95e651422bd2f
@@ -1,11 +1,14 @@
1
1
  # HasManyPurgable
2
2
  #
3
- # Mark your model with 'has_many_purgable' or 'has_one_purgable' to allow any has_many or has_one to be purgable
3
+ # Mark your model with 'has_many_purgable' or 'has_one_purgable' (both the same thing)
4
+ # to allow any has_many_attached or has_one_attached to be purgable.
5
+ #
4
6
  # Pass 'has_many_purgable :files, :avatar' to only allow the files and avatar to be purged.
7
+ #
5
8
  # Works with effective_bootstrap file_field to display a Delete file on save checkbox
6
- # to submit a _purge_attached array or association names to purge.
9
+ # to submit a _purge array of attachments to purge.
7
10
  #
8
- # You must permit the attribute _purge_attached: []
11
+ # You must permit the attribute _purge: []
9
12
 
10
13
  module HasManyPurgable
11
14
  extend ActiveSupport::Concern
@@ -30,13 +33,13 @@ module HasManyPurgable
30
33
  options = @has_many_purgable_options
31
34
  self.send(:define_method, :has_many_purgable_options) { options }
32
35
 
33
- attr_accessor :_purge_attached
36
+ attr_accessor :_purge
34
37
 
35
38
  effective_resource do
36
- _purge_attached :permitted_param
39
+ _purge :permitted_param
37
40
  end
38
41
 
39
- with_options(if: -> { _purge_attached.present? }) do
42
+ with_options(if: -> { _purge.present? }) do
40
43
  before_validation { has_many_purgable_mark_for_destruction }
41
44
  after_save { has_many_purgable_purge }
42
45
  end
@@ -62,7 +65,7 @@ module HasManyPurgable
62
65
 
63
66
  # As submitted by the form and permitted by our associations and options
64
67
  def has_many_purgable_attachments
65
- submitted = (Array(_purge_attached) - [nil, '', '0', ' ', 'false', 'f', 'off']).map(&:to_sym)
68
+ submitted = (Array(_purge) - [nil, '', '0', ' ', 'false', 'f', 'off']).map(&:to_sym)
66
69
  submitted & has_many_purgable_names
67
70
  end
68
71
 
@@ -8,18 +8,34 @@ module Effective
8
8
  Tenant.engine_path(tenant).sub("#{Rails.root}/", '') if tenant?
9
9
  end
10
10
 
11
+ # Model
11
12
  def model_file
12
13
  File.join(*[tenant_path, 'app/models', class_path, "#{name}.rb"].compact)
13
14
  end
14
15
 
16
+ # Controller
15
17
  def controller_file
16
18
  File.join(*[tenant_path, 'app/controllers', class_path, namespace, "#{plural_name}_controller.rb"].compact)
17
19
  end
18
20
 
21
+ def admin_effective_controller_file
22
+ File.join(*[tenant_path, 'app/controllers', namespace, "#{plural_name}_controller.rb"].compact)
23
+ end
24
+
25
+ # Datatable
19
26
  def datatable_file
20
27
  File.join(*[tenant_path, 'app/datatables', class_path, namespace, "#{plural_name}_datatable.rb"].compact)
21
28
  end
22
29
 
30
+ def effective_datatable_file
31
+ File.join(*[tenant_path, 'app/datatables', namespace, "effective_#{plural_name}_datatable.rb"].compact)
32
+ end
33
+
34
+ def admin_effective_datatable_file
35
+ File.join(*[tenant_path, 'app/datatables', namespace, "effective_#{plural_name}_datatable.rb"].compact)
36
+ end
37
+
38
+ # Views
23
39
  def view_file(action = :index, partial: false)
24
40
  File.join(*[tenant_path, 'app/views', class_path, namespace, plural_name, "#{'_' if partial}#{action}.html.haml"].compact)
25
41
  end
@@ -28,8 +44,8 @@ module Effective
28
44
  File.join(*[class_path, namespace, plural_name, action].compact)
29
45
  end
30
46
 
31
- def flat_view_file(action = :index, partial: false)
32
- File.join(*[tenant_path, 'app/views', class_path, plural_name, "#{'_' if partial}#{action}.html.haml"].compact)
47
+ def admin_effective_view_file(action = :index, partial: false)
48
+ File.join(*[tenant_path, 'app/views', namespace, plural_name, "#{'_' if partial}#{action}.html.haml"].compact)
33
49
  end
34
50
 
35
51
  def routes_file
@@ -1,3 +1,3 @@
1
1
  module EffectiveResources
2
- VERSION = '2.2.10'.freeze
2
+ VERSION = '2.2.12'.freeze
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: effective_resources
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.2.10
4
+ version: 2.2.12
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: 2023-01-31 00:00:00.000000000 Z
11
+ date: 2023-02-01 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails