Sha256: 8fa7bdf23073ac753caea4179675e6e328f1ee7038d33d3052adc687b0eece89
Contents?: true
Size: 1.3 KB
Versions: 44
Compression:
Stored size: 1.3 KB
Contents
# frozen_string_literal: true module Decidim module Votings module Admin # This command is executed when the user updates a polling station # from the admin panel. class UpdatePollingStation < ManagePollingStation def initialize(form, polling_station) @form = form @polling_station = polling_station end # Updates the polling station if valid. # # Broadcasts :ok if successful, :invalid otherwise. def call return broadcast(:invalid) if form.invalid? update_polling_station! manage_polling_officers(polling_station, form.polling_station_president_id, form.polling_station_manager_ids) broadcast(:ok, polling_station) end private attr_reader :form, :polling_station def update_polling_station! attributes = { title: form.title, address: form.address, latitude: form.latitude, longitude: form.longitude, location: form.location, location_hints: form.location_hints } Decidim.traceability.update!( polling_station, form.current_user, attributes, visibility: "all" ) end end end end end
Version data entries
44 entries across 44 versions & 1 rubygems