Class: Decidim::Admin::RemindersController

Inherits:
ApplicationController show all
Includes:
ComponentPathHelper
Defined in:
app/controllers/decidim/admin/reminders_controller.rb

Instance Method Summary collapse

Methods inherited from ApplicationController

#permission_class_chain, #permission_scope, #user_has_no_permission_path, #user_not_authorized_path

Instance Method Details

#createObject



17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
# File 'app/controllers/decidim/admin/reminders_controller.rb', line 17

def create
  enforce_permission_to :create, :reminder

  @form = reminder_form_from_params(params)

  command_class.call(@form) do
    on(:ok) do |reminders_queued|
      flash[:notice] = t("decidim.admin.reminders.create.success", count: reminders_queued)
      redirect_to manage_component_path(current_component)
    end

    on(:invalid) do
      flash.now[:alert] = t("decidim.admin.reminders.create.error")
      render :new
    end
  end
end

#newObject



10
11
12
13
14
15
# File 'app/controllers/decidim/admin/reminders_controller.rb', line 10

def new
  enforce_permission_to :create, :reminder

  @form = reminder_form_from_params(name: reminder_manifest.name)
  render :new
end