Sha256: 93ea5f50a0305fbcacbb77afb0d092a0897efef20fa32edd576847d2c0f59379

Contents?: true

Size: 1.01 KB

Versions: 14

Compression:

Stored size: 1.01 KB

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_verification_workflows,
                    :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_verification_workflows
      Verifications::Adapter.from_collection(
        current_organization.available_authorizations & Decidim.authorization_workflows.map(&:name)
      )
    end
  end
end

Version data entries

14 entries across 14 versions & 1 rubygems

Version Path
decidim-core-0.11.2 app/controllers/concerns/decidim/user_profile.rb
decidim-core-0.11.1 app/controllers/concerns/decidim/user_profile.rb
decidim-core-0.11.0.pre1 app/controllers/concerns/decidim/user_profile.rb
decidim-core-0.10.1 app/controllers/concerns/decidim/user_profile.rb
decidim-core-0.10.0 app/controllers/concerns/decidim/user_profile.rb
decidim-core-0.9.3 app/controllers/concerns/decidim/user_profile.rb
decidim-core-0.9.2 app/controllers/concerns/decidim/user_profile.rb
decidim-core-0.9.1 app/controllers/concerns/decidim/user_profile.rb
decidim-core-0.9.0 app/controllers/concerns/decidim/user_profile.rb
decidim-core-0.8.4 app/controllers/concerns/decidim/user_profile.rb
decidim-core-0.8.3 app/controllers/concerns/decidim/user_profile.rb
decidim-core-0.8.2 app/controllers/concerns/decidim/user_profile.rb
decidim-core-0.8.1 app/controllers/concerns/decidim/user_profile.rb
decidim-core-0.8.0 app/controllers/concerns/decidim/user_profile.rb