Sha256: 259d37b624e50bd8991cad45ec3f842a2d2c991380f1f64b64f329f1b821f6ec
Contents?: true
Size: 1.07 KB
Versions: 19
Compression:
Stored size: 1.07 KB
Contents
# frozen_string_literal: true module Decidim module Accountability module Admin # This command is executed when the user creates a TimelineEntry # for a Result from the admin panel. class CreateTimelineEntry < Decidim::Command def initialize(form, user) @form = form @user = user end # Creates the timeline_entry if valid. # # Broadcasts :ok if successful, :invalid otherwise. def call return broadcast(:invalid) if @form.invalid? transaction do create_timeline_entry end broadcast(:ok) end private attr_reader :timeline_entry, :form def create_timeline_entry @timeline_entry = Decidim.traceability.create!( TimelineEntry, @user, decidim_accountability_result_id: form.decidim_accountability_result_id, entry_date: form.entry_date, title: form.title, description: form.description ) end end end end end
Version data entries
19 entries across 19 versions & 1 rubygems