Sha256: a2a1e0140c64761b9866ff080d0ac801473aa707a1eb42ed222a3a35b43ff41e

Contents?: true

Size: 1.46 KB

Versions: 7

Compression:

Stored size: 1.46 KB

Contents

# frozen_string_literal: true

require "active_support/concern"

module Decidim
  # This concern groups methods and helpers needed by Devise controllers.
  module DeviseControllers
    extend ActiveSupport::Concern

    RegistersPermissions
      .register_permissions(::Decidim::DeviseControllers,
                            ::Decidim::Admin::Permissions,
                            ::Decidim::Permissions)

    included do
      include Decidim::NeedsOrganization
      include Decidim::LocaleSwitcher
      include ImpersonateUsers
      include NeedsPermission
      include Decidim::SafeRedirect
      include NeedsSnippets

      helper Decidim::TranslationsHelper
      helper Decidim::MetaTagsHelper
      helper Decidim::DecidimFormHelper
      helper Decidim::LanguageChooserHelper
      helper Decidim::CookiesHelper
      helper Decidim::ReplaceButtonsHelper
      helper Decidim::LayoutHelper
      helper Decidim::MenuHelper
      helper Decidim::OmniauthHelper

      layout "layouts/decidim/application"

      # Saves the location before loading each page so we can return to the
      # right page.
      before_action :store_current_location

      def permission_class_chain
        PermissionsRegistry.chain_for(DeviseControllers)
      end

      def permission_scope
        :public
      end

      def store_current_location
        return if redirect_url.blank? || !request.format.html?

        store_location_for(:user, redirect_url)
      end
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
decidim-core-0.23.5 app/controllers/concerns/decidim/devise_controllers.rb
decidim-core-0.23.4 app/controllers/concerns/decidim/devise_controllers.rb
decidim-core-0.23.3 app/controllers/concerns/decidim/devise_controllers.rb
decidim-core-0.23.2 app/controllers/concerns/decidim/devise_controllers.rb
decidim-core-0.23.1 app/controllers/concerns/decidim/devise_controllers.rb
decidim-core-0.23.1.rc1 app/controllers/concerns/decidim/devise_controllers.rb
decidim-core-0.23.0 app/controllers/concerns/decidim/devise_controllers.rb