Sha256: 412c7df74f9667800113b86d739fa80f3765759ff3ed8d6d5c766837ac89eb69

Contents?: true

Size: 1.18 KB

Versions: 6

Compression:

Stored size: 1.18 KB

Contents

# frozen_string_literal: true

module Decidim
  module Admin
    # Controller that allows managing the appearance of the organization.
    class OrganizationAppearanceController < Decidim::Admin::ApplicationController
      layout "decidim/admin/settings"

      add_breadcrumb_item_from_menu :admin_settings_menu

      helper Decidim::Admin::UploaderImageDimensionsHelper

      def edit
        enforce_permission_to :update, :organization, organization: current_organization
        @form = form(OrganizationAppearanceForm).from_model(current_organization)
      end

      def update
        enforce_permission_to :update, :organization, organization: current_organization
        @form = form(OrganizationAppearanceForm).from_params(params)

        UpdateOrganizationAppearance.call(@form, current_organization) do
          on(:ok) do
            flash[:notice] = I18n.t("organization.update.success", scope: "decidim.admin")
            redirect_to edit_organization_appearance_path
          end

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

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
decidim-admin-0.29.1 app/controllers/decidim/admin/organization_appearance_controller.rb
decidim-admin-0.29.0 app/controllers/decidim/admin/organization_appearance_controller.rb
decidim-admin-0.29.0.rc4 app/controllers/decidim/admin/organization_appearance_controller.rb
decidim-admin-0.29.0.rc3 app/controllers/decidim/admin/organization_appearance_controller.rb
decidim-admin-0.29.0.rc2 app/controllers/decidim/admin/organization_appearance_controller.rb
decidim-admin-0.29.0.rc1 app/controllers/decidim/admin/organization_appearance_controller.rb