compony 0.0.6 → 0.0.7

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: ffb648bd48df260288580ceae282773587e7137ecfec89c4623edf001e6e21b6
4
- data.tar.gz: eb4f6db5431d5a783bf4140f398af1497536e896c00c61b325fb3c9b76d6a9f9
3
+ metadata.gz: 5e3590a5ce07d22e7d483af2c98c972e9c64403e43084560e193bb6382215844
4
+ data.tar.gz: 054e3c2ef26650cdf404b0615f74dc12f0a610728e9b9b1446a90a4c91952365
5
5
  SHA512:
6
- metadata.gz: e1c67fc5e79e5c6aa6f3059044d4d21be882e829e67426528ad10f0291347a961c934a8ef914849bedabd1cb175bb206e9f896d483427e5097a9c6dcd6ce3c8e
7
- data.tar.gz: 6b270d52f19654332dc22a43795a00c691e189d57015826e6bcdfb1dc7e637e0ba8aca5060dc7be1663e606ce86b9f70d93866297b22d2a4236b5556bd8092da
6
+ metadata.gz: 90139644b0d2f3dd9adbff42e42bcdecae69d93676e5c4527795bd89a81103f5eabab4fd846fb3ad5e32b3463b0303b5e860f65d31939c0438f2e211bd28b4f6
7
+ data.tar.gz: a9c0714b201b1df42f0996e1a965de71ed6c6738cf8a6e0e332883a1b97f9dcdb876d89a138965c63db957e6b99bf54bdba7cbfc6a977b68c94f0b98dba496f5
data/CHANGELOG.md CHANGED
@@ -1,3 +1,7 @@
1
+ # 0.0.7
2
+
3
+ - Fix `standalone_access_permitted_for?` check for buttons pointing to non-get verbs
4
+
1
5
  # 0.0.6
2
6
 
3
7
  - Fix a bug that breaks hidden fields of type reference
data/compony.gemspec CHANGED
@@ -2,19 +2,19 @@
2
2
  # This file is auto-generated via: 'rake gemspec'.
3
3
 
4
4
  # -*- encoding: utf-8 -*-
5
- # stub: compony 0.0.6 ruby lib
5
+ # stub: compony 0.0.7 ruby lib
6
6
 
7
7
  Gem::Specification.new do |s|
8
8
  s.name = "compony".freeze
9
- s.version = "0.0.6"
9
+ s.version = "0.0.7"
10
10
 
11
11
  s.required_rubygems_version = Gem::Requirement.new(">= 0".freeze) if s.respond_to? :required_rubygems_version=
12
12
  s.require_paths = ["lib".freeze]
13
13
  s.authors = ["Sandro Kalbermatter".freeze, "contributors".freeze]
14
- s.date = "2023-08-08"
14
+ s.date = "2023-09-18"
15
15
  s.files = [".gitignore".freeze, ".ruby-version".freeze, ".yardopts".freeze, "CHANGELOG.md".freeze, "Gemfile".freeze, "Gemfile.lock".freeze, "LICENSE".freeze, "README.md".freeze, "Rakefile".freeze, "app/controllers/compony_controller.rb".freeze, "compony.gemspec".freeze, "config/locales/de.yml".freeze, "config/locales/en.yml".freeze, "config/routes.rb".freeze, "doc/resourceful_lifecycle.graphml".freeze, "doc/resourceful_lifecycle.pdf".freeze, "lib/compony.rb".freeze, "lib/compony/component.rb".freeze, "lib/compony/component_mixins/default/labelling.rb".freeze, "lib/compony/component_mixins/default/standalone.rb".freeze, "lib/compony/component_mixins/default/standalone/resourceful_verb_dsl.rb".freeze, "lib/compony/component_mixins/default/standalone/standalone_dsl.rb".freeze, "lib/compony/component_mixins/default/standalone/verb_dsl.rb".freeze, "lib/compony/component_mixins/resourceful.rb".freeze, "lib/compony/components/button.rb".freeze, "lib/compony/components/destroy.rb".freeze, "lib/compony/components/edit.rb".freeze, "lib/compony/components/form.rb".freeze, "lib/compony/components/new.rb".freeze, "lib/compony/components/with_form.rb".freeze, "lib/compony/controller_mixin.rb".freeze, "lib/compony/engine.rb".freeze, "lib/compony/method_accessible_hash.rb".freeze, "lib/compony/model_fields/anchormodel.rb".freeze, "lib/compony/model_fields/association.rb".freeze, "lib/compony/model_fields/attachment.rb".freeze, "lib/compony/model_fields/base.rb".freeze, "lib/compony/model_fields/boolean.rb".freeze, "lib/compony/model_fields/currency.rb".freeze, "lib/compony/model_fields/date.rb".freeze, "lib/compony/model_fields/datetime.rb".freeze, "lib/compony/model_fields/decimal.rb".freeze, "lib/compony/model_fields/email.rb".freeze, "lib/compony/model_fields/float.rb".freeze, "lib/compony/model_fields/integer.rb".freeze, "lib/compony/model_fields/phone.rb".freeze, "lib/compony/model_fields/rich_text.rb".freeze, "lib/compony/model_fields/string.rb".freeze, "lib/compony/model_fields/text.rb".freeze, "lib/compony/model_fields/time.rb".freeze, "lib/compony/model_fields/url.rb".freeze, "lib/compony/model_mixin.rb".freeze, "lib/compony/request_context.rb".freeze, "lib/compony/version.rb".freeze, "lib/compony/view_helpers.rb".freeze, "lib/generators/component/USAGE".freeze, "lib/generators/component/component_generator.rb".freeze, "lib/generators/component/templates/component.rb.erb".freeze, "lib/generators/component/templates/destroy.rb.erb".freeze, "lib/generators/component/templates/edit.rb.erb".freeze, "lib/generators/component/templates/form.rb.erb".freeze, "lib/generators/component/templates/new.rb.erb".freeze, "lib/generators/components/USAGE".freeze, "lib/generators/components/components_generator.rb".freeze]
16
16
  s.required_ruby_version = Gem::Requirement.new(">= 3.0.0".freeze)
17
- s.rubygems_version = "3.4.13".freeze
17
+ s.rubygems_version = "3.4.19".freeze
18
18
  s.summary = "Needs summary".freeze
19
19
 
20
20
  s.specification_version = 4
@@ -75,7 +75,8 @@ module Compony
75
75
  # - when called standalone (via request to the component), the load data step must be completed
76
76
  # - when called to check for permission only, e.g. to display a button to it, initialize the component by passing the :data keyword to `new`
77
77
  # By default, this checks the authorization to access the main standalone entrypoint (with name `nil`) and HTTP verb GET.
78
- def standalone_access_permitted_for?(controller, standalone_name: nil, verb: :get)
78
+ def standalone_access_permitted_for?(controller, standalone_name: nil, verb: nil)
79
+ verb ||= :get
79
80
  standalone_name = standalone_name&.to_sym
80
81
  verb = verb.to_sym
81
82
  standalone_config = standalone_configs[standalone_name] || fail("#{inspect} does not provide the standalone config #{standalone_config.inspect}.")
@@ -2,7 +2,7 @@ module Compony
2
2
  module Version
3
3
  MAJOR = 0
4
4
  MINOR = 0
5
- PATCH = 6
5
+ PATCH = 7
6
6
 
7
7
  EDGE = false
8
8
 
data/lib/compony.rb CHANGED
@@ -145,6 +145,7 @@ module Compony
145
145
  params: nil,
146
146
  feasibility_action: nil,
147
147
  feasibility_target: nil,
148
+ method: nil,
148
149
  **override_kwargs)
149
150
  label_opts ||= button_defaults[:label_opts] || {}
150
151
  params ||= button_defaults[:params] || {}
@@ -157,7 +158,8 @@ module Compony
157
158
  icon: target_comp_instance.icon,
158
159
  color: target_comp_instance.color,
159
160
  path: Compony.path(target_comp_instance.comp_name, target_comp_instance.family_name, model, **params),
160
- visible: ->(controller) { target_comp_instance.standalone_access_permitted_for?(controller) }
161
+ method:,
162
+ visible: ->(controller) { target_comp_instance.standalone_access_permitted_for?(controller, verb: method) }
161
163
  }
162
164
  if feasibility_target
163
165
  options.merge!({
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: compony
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.6
4
+ version: 0.0.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sandro Kalbermatter
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2023-08-08 00:00:00.000000000 Z
12
+ date: 2023-09-18 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: yard