Class: Decidim::Proposals::ProposalForm

Inherits:
Form
  • Object
show all
Defined in:
app/forms/decidim/proposals/proposal_form.rb

Overview

A form object to be used when public users want to create a proposal.

Instance Method Summary collapse

Instance Method Details

#categoryObject

Finds the Category from the category_id.

Returns a Decidim::Category



42
43
44
# File 'app/forms/decidim/proposals/proposal_form.rb', line 42

def category
  @category ||= categories.where(id: category_id).first
end

#has_address?Boolean

Returns:

  • (Boolean)


53
54
55
# File 'app/forms/decidim/proposals/proposal_form.rb', line 53

def has_address?
  current_feature.settings.geocoding_enabled? && has_address
end

#organization_scopesObject



29
30
31
# File 'app/forms/decidim/proposals/proposal_form.rb', line 29

def organization_scopes
  current_organization.scopes
end

#process_scopeObject



33
34
35
# File 'app/forms/decidim/proposals/proposal_form.rb', line 33

def process_scope
  current_feature.participatory_process.scope
end

#scopeObject

Finds the Scope from the scope_id.

Returns a Decidim::Scope



49
50
51
# File 'app/forms/decidim/proposals/proposal_form.rb', line 49

def scope
  @scope ||= process_scope || organization_scopes.where(id: scope_id).first
end