Class: Decidim::Budgets::Admin::BudgetForm

Inherits:
Form
  • Object
show all
Includes:
TranslatableAttributes
Defined in:
app/forms/decidim/budgets/admin/budget_form.rb

Overview

This class holds a Form to create/update budgets from Decidim’s admin panel.

Instance Method Summary collapse

Instance Method Details

#decidim_scope_idObject

Scope identifier

Returns the scope identifier related to the meeting



34
35
36
# File 'app/forms/decidim/budgets/admin/budget_form.rb', line 34

def decidim_scope_id
  super || scope&.id
end

#scopeObject

Finds the Scope from the given decidim_scope_id, uses the component scope if missing.

Returns a Decidim::Scope



27
28
29
# File 'app/forms/decidim/budgets/admin/budget_form.rb', line 27

def scope
  @scope ||= @attributes["decidim_scope_id"].value ? current_component.scopes.find_by(id: @attributes["decidim_scope_id"].value) : current_component.scope
end