Sha256: d4ba48cca68161fab25a44a1dec2527ef48eb5b09ff8a3f9121d241ea447078f
Contents?: true
Size: 1.24 KB
Versions: 6
Compression:
Stored size: 1.24 KB
Contents
# frozen_string_literal: true module Decidim module Budgets module Admin # This command is executed when the user changes a Project from the admin # panel. class UpdateProject < Decidim::Commands::UpdateResource include ::Decidim::GalleryMethods fetch_form_attributes :scope, :category, :title, :description, :budget_amount, :address, :latitude, :longitude def initialize(form, project) super(form, project) @attached_to = project end private def run_after_hooks link_proposals create_gallery if process_gallery? photo_cleanup! end def run_before_hooks return unless process_gallery? build_gallery raise Decidim::Commands::HookError if gallery_invalid? end def attributes super.merge({ selected_at: }) end def proposals @proposals ||= resource.sibling_scope(:proposals).where(id: form.proposal_ids) end def link_proposals resource.link_resources(proposals, "included_proposals") end def selected_at return unless form.selected Time.current end end end end end
Version data entries
6 entries across 6 versions & 1 rubygems