Sha256: 3ec10313f6705d3db97e9dcce0d75066da9a55e193d25cf563864047e34abf9a

Contents?: true

Size: 952 Bytes

Versions: 4

Compression:

Stored size: 952 Bytes

Contents

# frozen_string_literal: true
require "active_support/concern"

module Decidim
  # The UserProfile concern must be included in all the controllers
  # that are shown in the user's profile settings. It adds the
  # proper layout, as well as helper methods that help render the
  # side menu, amongst others.
  module UserProfile
    extend ActiveSupport::Concern
    include FormFactory

    delegate :user_groups, to: :current_user, prefix: false

    included do
      helper Decidim::UserProfileHelper
      layout "layouts/decidim/user_profile"

      helper_method :available_authorization_handlers,
                    :user_groups

      before_action :current_user
      authorize_resource :current_user
    end

    # Public: Available authorization handlers in order to conditionally
    # show the menu element.
    def available_authorization_handlers
      current_organization.available_authorizations.map(&:constantize)
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
decidim-core-0.1.0 app/controllers/concerns/decidim/user_profile.rb
decidim-core-0.0.8.1 app/controllers/concerns/decidim/user_profile.rb
decidim-core-0.0.7 app/controllers/concerns/decidim/user_profile.rb
decidim-core-0.0.6 app/controllers/concerns/decidim/user_profile.rb