Class: Decidim::Proposals::Admin::ValuationAssignmentForm

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

Instance Method Summary collapse

Instance Method Details

#proposalsObject


15
16
17
# File 'decidim-proposals/app/forms/decidim/proposals/admin/valuation_assignment_form.rb', line 15

def proposals
  @proposals ||= Decidim::Proposals::Proposal.where(component: current_component, id: proposal_ids).uniq
end

#same_participatory_spaceObject


29
30
31
32
33
# File 'decidim-proposals/app/forms/decidim/proposals/admin/valuation_assignment_form.rb', line 29

def same_participatory_space
  return if !valuator_role || !current_component

  errors.add(:id, :invalid) if current_component.participatory_space != valuator_role.participatory_space
end

#valuator_roleObject


19
20
21
# File 'decidim-proposals/app/forms/decidim/proposals/admin/valuation_assignment_form.rb', line 19

def valuator_role
  @valuator_role ||= current_component.participatory_space.user_roles(:valuator).find_by(id: id)
end

#valuator_userObject


23
24
25
26
27
# File 'decidim-proposals/app/forms/decidim/proposals/admin/valuation_assignment_form.rb', line 23

def valuator_user
  return unless valuator_role

  @valuator_user ||= valuator_role.user
end