Sha256: b6321cdc0a452af36836b76e5187dc2a896e9a64bdb08344590d7838de85be84

Contents?: true

Size: 895 Bytes

Versions: 43

Compression:

Stored size: 895 Bytes

Contents

# frozen_string_literal: true

module Decidim
  # The controller to handle the user's notifications settings page.
  class NotificationsSettingsController < Decidim::ApplicationController
    include Decidim::UserProfile

    def show
      authorize! :show, current_user
      @notifications_settings = form(NotificationsSettingsForm).from_model(current_user)
    end

    def update
      authorize! :update, current_user
      @notifications_settings = form(NotificationsSettingsForm).from_params(params)

      UpdateNotificationsSettings.call(current_user, @notifications_settings) do
        on(:ok) do
          flash.now[:notice] = t("notifications_settings.update.success", scope: "decidim")
        end

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

      render action: :show
    end
  end
end

Version data entries

43 entries across 43 versions & 2 rubygems

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