Sha256: 3e10d053d1b8e7454297f96883c27b37627beadd39b335c28390c5f34398e920

Contents?: true

Size: 858 Bytes

Versions: 15

Compression:

Stored size: 858 Bytes

Contents

# frozen_string_literal: true

module Decidim
  # This cell renders the profile of the given user.
  class UserProfileCell < Decidim::CardMCell
    include Decidim::SanitizeHelper

    def user_data
      render
    end

    def unlinked_user_data
      render
    end

    def user
      model
    end

    def resource_path
      decidim.profile_path(user.nickname)
    end

    delegate :nickname, to: :presented_resource
    delegate :name, to: :presented_resource
    delegate :officialized?, to: :presented_resource

    delegate :badge, to: :presented_resource

    def description
      html_truncate(decidim_html_escape(user.about.to_s), length: 100)
    end

    def avatar
      user.avatar_url(:big)
    end

    def presented_resource
      @presented_resource ||= user.class.name.include?("Presenter") ? model : present(user)
    end
  end
end

Version data entries

15 entries across 15 versions & 1 rubygems

Version Path
decidim-core-0.24.3 app/cells/decidim/user_profile_cell.rb
decidim-core-0.23.6 app/cells/decidim/user_profile_cell.rb
decidim-core-0.24.2 app/cells/decidim/user_profile_cell.rb
decidim-core-0.23.5 app/cells/decidim/user_profile_cell.rb
decidim-core-0.24.1 app/cells/decidim/user_profile_cell.rb
decidim-core-0.24.0 app/cells/decidim/user_profile_cell.rb
decidim-core-0.24.0.rc2 app/cells/decidim/user_profile_cell.rb
decidim-core-0.23.4 app/cells/decidim/user_profile_cell.rb
decidim-core-0.24.0.rc1 app/cells/decidim/user_profile_cell.rb
decidim-core-0.23.3 app/cells/decidim/user_profile_cell.rb
decidim-core-0.23.2 app/cells/decidim/user_profile_cell.rb
decidim-core-0.23.1 app/cells/decidim/user_profile_cell.rb
decidim-core-0.23.1.rc1 app/cells/decidim/user_profile_cell.rb
decidim-core-0.23.0 app/cells/decidim/user_profile_cell.rb
decidim-core-0.22.0 app/cells/decidim/user_profile_cell.rb