Class: Decidim::Admin::HelpSectionsController

Inherits:
ApplicationController show all
Includes:
TranslationsHelper
Defined in:
app/controllers/decidim/admin/help_sections_controller.rb

Overview

Controller that allows managing the user organization.

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

#showObject



19
20
21
22
23
# File 'app/controllers/decidim/admin/help_sections_controller.rb', line 19

def show
  @form = form(HelpSectionsForm).from_model(
    OpenStruct.new(sections:)
  )
end

#updateObject



25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
# File 'app/controllers/decidim/admin/help_sections_controller.rb', line 25

def update
  @form = form(HelpSectionsForm).from_params(
    params[:help_sections]
  )

  UpdateHelpSections.call(@form, current_organization) do
    on(:ok) do
      flash[:notice] = t("help_sections.success", scope: "decidim.admin")
      redirect_to action: :show
    end

    on(:invalid) do
      flash.now[:alert] = t("help_sections.error", scope: "decidim.admin")
    end
  end
end