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



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

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

#updateObject



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

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