Sha256: ea676f046fb7ca9b8e85b0205f91f2b4f7a9e1a9ab23d5ad42b017feacc3ca4f

Contents?: true

Size: 881 Bytes

Versions: 12

Compression:

Stored size: 881 Bytes

Contents

# frozen_string_literal: true

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

    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

12 entries across 12 versions & 1 rubygems

Version Path
decidim-core-0.27.9 app/controllers/decidim/user_interests_controller.rb
decidim-core-0.27.8 app/controllers/decidim/user_interests_controller.rb
decidim-core-0.27.7 app/controllers/decidim/user_interests_controller.rb
decidim-core-0.27.6 app/controllers/decidim/user_interests_controller.rb
decidim-core-0.27.5 app/controllers/decidim/user_interests_controller.rb
decidim-core-0.27.4 app/controllers/decidim/user_interests_controller.rb
decidim-core-0.27.3 app/controllers/decidim/user_interests_controller.rb
decidim-core-0.27.2 app/controllers/decidim/user_interests_controller.rb
decidim-core-0.27.1 app/controllers/decidim/user_interests_controller.rb
decidim-core-0.27.0 app/controllers/decidim/user_interests_controller.rb
decidim-core-0.27.0.rc2 app/controllers/decidim/user_interests_controller.rb
decidim-core-0.27.0.rc1 app/controllers/decidim/user_interests_controller.rb