Module: Decidim::VerifyWoRegistration::ApplicationHelper
- Included in:
- VerificationsController
- Defined in:
- app/helpers/decidim/verify_wo_registration/application_helper.rb
Overview
Custom helpers, scoped to the verify_wo_registration engine.
Class Method Summary collapse
-
.all_verifications_of_type_direct?(component) ⇒ Boolean
Checks whether all workflow manifests for the givevn
componentare of type “direct”. - .verify_wo_registration_custom_modal?(component) ⇒ Boolean
- .workflow_manifests(component) ⇒ Object
Class Method Details
.all_verifications_of_type_direct?(component) ⇒ Boolean
Checks whether all workflow manifests for the givevn component are of type “direct”.
23 24 25 26 |
# File 'app/helpers/decidim/verify_wo_registration/application_helper.rb', line 23 def self.all_verifications_of_type_direct?(component) manifests = workflow_manifests(component) manifests.any? && manifests.all? { |manifest| manifest.type == 'direct' } end |
.verify_wo_registration_custom_modal?(component) ⇒ Boolean
8 9 10 |
# File 'app/helpers/decidim/verify_wo_registration/application_helper.rb', line 8 def self.verify_wo_registration_custom_modal?(component) component.settings.try(:supports_without_registration) && all_verifications_of_type_direct?(component) end |
.workflow_manifests(component) ⇒ Object
12 13 14 15 16 17 18 19 20 |
# File 'app/helpers/decidim/verify_wo_registration/application_helper.rb', line 12 def self.workflow_manifests(component) return [] if component.&.blank? || component..try(:fetch, "vote").blank? Decidim::Verifications::Adapter.from_collection( # component.permissions returns a structure of the form: # {"vote"=>{"authorization_handlers"=>{"dummy_authorization_handler"=>{"options"=>{"postal_code"=>"08001"}}}}} component.['vote']['authorization_handlers'].keys ) end |