Sha256: 4069f548dc198a5b2b0650c7c3b71fa02f2d336257093f30e3bfdf783c340f7d

Contents?: true

Size: 908 Bytes

Versions: 46

Compression:

Stored size: 908 Bytes

Contents

# frozen_string_literal: true

module Decidim
  # The controller to handle the user's interests page.
  class UserInterestsController < Decidim::ApplicationController
    include Decidim::UserProfile

    helper_method :scopes

    def show
      enforce_permission_to :read, :user, current_user: current_user
      @user_interests = form(UserInterestsForm).from_model(current_user)
    end

    def update
      enforce_permission_to :update, :user, current_user: current_user
      @user_interests = form(UserInterestsForm).from_params(params)

      UpdateUserInterests.call(current_user, @user_interests) do
        on(:ok) do
          flash.keep[:notice] = t("user_interests.update.success", scope: "decidim")
        end

        on(:invalid) do
          flash.keep[:alert] = t("user_interests.update.error", scope: "decidim")
        end
      end

      redirect_to action: :show
    end
  end
end

Version data entries

46 entries across 46 versions & 1 rubygems

Version Path
decidim-core-0.26.10 app/controllers/decidim/user_interests_controller.rb
decidim-core-0.26.9 app/controllers/decidim/user_interests_controller.rb
decidim-core-0.26.8 app/controllers/decidim/user_interests_controller.rb
decidim-core-0.26.7 app/controllers/decidim/user_interests_controller.rb
decidim-core-0.26.5 app/controllers/decidim/user_interests_controller.rb
decidim-core-0.26.4 app/controllers/decidim/user_interests_controller.rb
decidim-core-0.26.3 app/controllers/decidim/user_interests_controller.rb
decidim-core-0.26.2 app/controllers/decidim/user_interests_controller.rb
decidim-core-0.26.1 app/controllers/decidim/user_interests_controller.rb
decidim-core-0.26.0 app/controllers/decidim/user_interests_controller.rb
decidim-core-0.26.0.rc2 app/controllers/decidim/user_interests_controller.rb
decidim-core-0.26.0.rc1 app/controllers/decidim/user_interests_controller.rb
decidim-core-0.25.2 app/controllers/decidim/user_interests_controller.rb
decidim-core-0.25.1 app/controllers/decidim/user_interests_controller.rb
decidim-core-0.25.0 app/controllers/decidim/user_interests_controller.rb
decidim-core-0.25.0.rc4 app/controllers/decidim/user_interests_controller.rb
decidim-core-0.25.0.rc3 app/controllers/decidim/user_interests_controller.rb
decidim-core-0.25.0.rc2 app/controllers/decidim/user_interests_controller.rb
decidim-core-0.25.0.rc1 app/controllers/decidim/user_interests_controller.rb
decidim-core-0.24.3 app/controllers/decidim/user_interests_controller.rb