Module: Decidim::Initiatives::SignatureTypeOptionsHelper

Defined in:
app/helpers/decidim/initiatives/signature_type_options_helper.rb

Overview

Helper methods for the create initiative wizard.

Instance Method Summary collapse

Instance Method Details

#signature_type_options(initiative_form) ⇒ Object



7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
# File 'app/helpers/decidim/initiatives/signature_type_options_helper.rb', line 7

def signature_type_options(initiative_form)
  return all_signature_type_options unless initiative_form.signature_type_updatable?

  type = ::Decidim::InitiativesType.find(initiative_form.type_id)
  allowed_signatures = type.allowed_signature_types_for_initiatives

  case allowed_signatures
  when %w(online)
    online_signature_type_options
  when %w(offline)
    offline_signature_type_options
  else
    all_signature_type_options
  end
end