Sha256: 6c6e2887186bd589364909f9a4c3f74eed1d130d7275014a0d543d8a038571d8
Contents?: true
Size: 1 KB
Versions: 47
Compression:
Stored size: 1 KB
Contents
# frozen_string_literal: true module Decidim module Proposals module Admin class ValuationAssignmentForm < Decidim::Form mimic :valuator_role attribute :id, Integer attribute :proposal_ids, Array validates :valuator_role, :proposals, :current_component, presence: true validate :same_participatory_space def proposals @proposals ||= Decidim::Proposals::Proposal.where(component: current_component, id: proposal_ids).uniq end def valuator_role @valuator_role ||= current_component.participatory_space.user_roles(:valuator).find_by(id: id) end def valuator_user return unless valuator_role @valuator_user ||= valuator_role.user end def same_participatory_space return if !valuator_role || !current_component errors.add(:id, :invalid) if current_component.participatory_space != valuator_role.participatory_space end end end end end
Version data entries
47 entries across 47 versions & 1 rubygems