Sha256: 48b551d7707d2972ad94e298555de6ce318d87b96502e633b0e65091cc6c5aee

Contents?: true

Size: 1.07 KB

Versions: 51

Compression:

Stored size: 1.07 KB

Contents

# frozen_string_literal: true

module Decidim
  # This cell is intended to be used on profiles.
  # Lists the members of the given user group.
  class MembersCell < Decidim::ViewModel
    include Decidim::CellsPaginateHelper
    include Decidim::ApplicationHelper
    include Decidim::Core::Engine.routes.url_helpers
    include Decidim::CardHelper

    def show
      render :show
    end

    def membership_cell_name
      return "decidim/user_group_admin_membership_profile" if options[:from_admin].presence

      "decidim/user_group_membership_profile"
    end

    def memberships
      @memberships ||= case options[:role].to_s
                       when "member"
                         Decidim::UserGroups::MemberMemberships.for(model).page(params[:page]).per(20)
                       when "admin"
                         Decidim::UserGroups::AdminMemberships.for(model).page(params[:page]).per(20)
                       else
                         Decidim::UserGroups::AcceptedMemberships.for(model).page(params[:page]).per(20)
                       end
    end
  end
end

Version data entries

51 entries across 51 versions & 1 rubygems

Version Path
decidim-core-0.27.9 app/cells/decidim/members_cell.rb
decidim-core-0.27.8 app/cells/decidim/members_cell.rb
decidim-core-0.27.7 app/cells/decidim/members_cell.rb
decidim-core-0.27.6 app/cells/decidim/members_cell.rb
decidim-core-0.26.10 app/cells/decidim/members_cell.rb
decidim-core-0.26.9 app/cells/decidim/members_cell.rb
decidim-core-0.27.5 app/cells/decidim/members_cell.rb
decidim-core-0.26.8 app/cells/decidim/members_cell.rb
decidim-core-0.27.4 app/cells/decidim/members_cell.rb
decidim-core-0.27.3 app/cells/decidim/members_cell.rb
decidim-core-0.26.7 app/cells/decidim/members_cell.rb
decidim-core-0.26.5 app/cells/decidim/members_cell.rb
decidim-core-0.27.2 app/cells/decidim/members_cell.rb
decidim-core-0.27.1 app/cells/decidim/members_cell.rb
decidim-core-0.26.4 app/cells/decidim/members_cell.rb
decidim-core-0.27.0 app/cells/decidim/members_cell.rb
decidim-core-0.26.3 app/cells/decidim/members_cell.rb
decidim-core-0.27.0.rc2 app/cells/decidim/members_cell.rb
decidim-core-0.27.0.rc1 app/cells/decidim/members_cell.rb
decidim-core-0.26.2 app/cells/decidim/members_cell.rb