Sha256: fcab372f8a10dd9b9c1808284c8f8c6c7b1b44ae7d5981423d74c01d9d6f0cae

Contents?: true

Size: 1.65 KB

Versions: 54

Compression:

Stored size: 1.65 KB

Contents

# frozen_string_literal: true

module Decidim
  module Meetings
    module Admin
      # This controller allows an admin to manage meetings from a Participatory Process
      class MeetingsController < Admin::ApplicationController
        def new
          @form = form(MeetingForm).instance
        end

        def create
          @form = form(MeetingForm).from_params(params, current_feature: current_feature)

          CreateMeeting.call(@form) do
            on(:ok) do
              flash[:notice] = I18n.t("meetings.create.success", scope: "decidim.meetings.admin")
              redirect_to meetings_path
            end

            on(:invalid) do
              flash.now[:alert] = I18n.t("meetings.create.invalid", scope: "decidim.meetings.admin")
              render action: "new"
            end
          end
        end

        def edit
          @form = form(MeetingForm).from_model(meeting)
        end

        def update
          @form = form(MeetingForm).from_params(params, current_feature: current_feature)

          UpdateMeeting.call(@form, meeting) do
            on(:ok) do
              flash[:notice] = I18n.t("meetings.update.success", scope: "decidim.meetings.admin")
              redirect_to meetings_path
            end

            on(:invalid) do
              flash.now[:alert] = I18n.t("meetings.update.invalid", scope: "decidim.meetings.admin")
              render action: "edit"
            end
          end
        end

        def destroy
          meeting.destroy!

          flash[:notice] = I18n.t("meetings.destroy.success", scope: "decidim.meetings.admin")

          redirect_to meetings_path
        end
      end
    end
  end
end

Version data entries

54 entries across 54 versions & 2 rubygems

Version Path
decidim-meetings-0.9.3 app/controllers/decidim/meetings/admin/meetings_controller.rb
decidim-meetings-0.9.2 app/controllers/decidim/meetings/admin/meetings_controller.rb
decidim-meetings-0.9.1 app/controllers/decidim/meetings/admin/meetings_controller.rb
decidim-meetings-0.9.0 app/controllers/decidim/meetings/admin/meetings_controller.rb
decidim-meetings-0.8.4 app/controllers/decidim/meetings/admin/meetings_controller.rb
decidim-meetings-0.8.3 app/controllers/decidim/meetings/admin/meetings_controller.rb
decidim-meetings-0.8.2 app/controllers/decidim/meetings/admin/meetings_controller.rb
decidim-meetings-0.8.1 app/controllers/decidim/meetings/admin/meetings_controller.rb
decidim-meetings-0.8.0 app/controllers/decidim/meetings/admin/meetings_controller.rb
decidim-meetings-0.7.4 app/controllers/decidim/meetings/admin/meetings_controller.rb
decidim-meetings-0.7.3 app/controllers/decidim/meetings/admin/meetings_controller.rb
decidim-meetings-0.7.2 app/controllers/decidim/meetings/admin/meetings_controller.rb
decidim-meetings-0.7.1 app/controllers/decidim/meetings/admin/meetings_controller.rb
decidim-meetings-0.7.0 app/controllers/decidim/meetings/admin/meetings_controller.rb
decidim-meetings-0.6.8 app/controllers/decidim/meetings/admin/meetings_controller.rb
decidim-0.6.8 decidim-meetings/app/controllers/decidim/meetings/admin/meetings_controller.rb
decidim-meetings-0.6.7 app/controllers/decidim/meetings/admin/meetings_controller.rb
decidim-0.6.7 decidim-meetings/app/controllers/decidim/meetings/admin/meetings_controller.rb
decidim-meetings-0.6.6 app/controllers/decidim/meetings/admin/meetings_controller.rb
decidim-0.6.6 decidim-meetings/app/controllers/decidim/meetings/admin/meetings_controller.rb