Class: Decidim::Admin::HelpSectionsController

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

Overview

Controller that allows managing the user organization.

Instance Method Summary collapse

Methods included from TranslationsHelper

empty_translatable, ensure_translatable, multi_translation, translated_in_current_locale?

Methods included from TranslatableAttributes

#default_locale?

Methods inherited from ApplicationController

#permission_class_chain, #permission_scope, #user_has_no_permission_path, #user_not_authorized_path

Methods included from Headers::HttpCachingDisabler

#disable_http_caching

Methods included from NeedsSnippets

#snippets

Methods included from RegistersPermissions

register_permissions

Methods included from NeedsOrganization

enhance_controller, extended, included

Instance Method Details

#showObject



19
20
21
22
23
# File 'decidim-admin/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 'decidim-admin/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, current_user) 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