Sha256: 7e27e3e2456e392e6b7225ce26126a603e755227da1609803a88a0e575827aa7
Contents?: true
Size: 1.5 KB
Versions: 8
Compression:
Stored size: 1.5 KB
Contents
# frozen_string_literal: true module Decidim module Meetings module Admin # This command is executed when the user changes a Meeting from the admin # panel. class UpdateMeeting < Rectify::Command # Initializes a UpdateMeeting Command. # # form - The form from which to get the data. # meeting - The current instance of the page to be updated. def initialize(form, meeting) @form = form @meeting = meeting end # Updates the meeting if valid. # # Broadcasts :ok if successful, :invalid otherwise. def call return broadcast(:invalid) if @form.invalid? update_meeting! broadcast(:ok, @meeting) end private def update_meeting! @meeting.update_attributes!( scope: @form.scope, category: @form.category, title: @form.title, description: @form.description, end_time: @form.end_time, start_time: @form.start_time, address: @form.address, latitude: @form.latitude, longitude: @form.longitude, location: @form.location, location_hints: @form.location_hints ) end def geocode_meeting result = @meeting.geocode @form.errors.add :address, :invalid unless result result end def update_meeting @meeting.save! end end end end end
Version data entries
8 entries across 8 versions & 2 rubygems