Sha256: 51c0a58a767b8a7ebacff590b8ae775d579ac6d25e34ab2e3cce10dd2f1ace57

Contents?: true

Size: 948 Bytes

Versions: 19

Compression:

Stored size: 948 Bytes

Contents

# frozen_string_literal: true

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

      def edit
        authorize! :update, current_organization
        @form = form(OrganizationForm).from_model(current_organization)
      end

      def update
        authorize! :update, current_organization
        @form = form(OrganizationForm).from_params(params)

        UpdateOrganization.call(current_organization, @form) do
          on(:ok) do
            flash[:notice] = I18n.t("organization.update.success", scope: "decidim.admin")
            redirect_to edit_organization_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

19 entries across 19 versions & 1 rubygems

Version Path
decidim-admin-0.11.2 app/controllers/decidim/admin/organization_controller.rb
decidim-admin-0.11.1 app/controllers/decidim/admin/organization_controller.rb
decidim-admin-0.11.0.pre1 app/controllers/decidim/admin/organization_controller.rb
decidim-admin-0.10.1 app/controllers/decidim/admin/organization_controller.rb
decidim-admin-0.10.0 app/controllers/decidim/admin/organization_controller.rb
decidim-admin-0.9.3 app/controllers/decidim/admin/organization_controller.rb
decidim-admin-0.9.2 app/controllers/decidim/admin/organization_controller.rb
decidim-admin-0.9.1 app/controllers/decidim/admin/organization_controller.rb
decidim-admin-0.9.0 app/controllers/decidim/admin/organization_controller.rb
decidim-admin-0.8.4 app/controllers/decidim/admin/organization_controller.rb
decidim-admin-0.8.3 app/controllers/decidim/admin/organization_controller.rb
decidim-admin-0.8.2 app/controllers/decidim/admin/organization_controller.rb
decidim-admin-0.8.1 app/controllers/decidim/admin/organization_controller.rb
decidim-admin-0.8.0 app/controllers/decidim/admin/organization_controller.rb
decidim-admin-0.7.4 app/controllers/decidim/admin/organization_controller.rb
decidim-admin-0.7.3 app/controllers/decidim/admin/organization_controller.rb
decidim-admin-0.7.2 app/controllers/decidim/admin/organization_controller.rb
decidim-admin-0.7.1 app/controllers/decidim/admin/organization_controller.rb
decidim-admin-0.7.0 app/controllers/decidim/admin/organization_controller.rb