Sha256: 19f6f9920d8fcc6ba88845c13acfedbf402d5f08bc4f9846d24b1e21884ab48b

Contents?: true

Size: 631 Bytes

Versions: 5

Compression:

Stored size: 631 Bytes

Contents

# frozen_string_literal: true
module Thredded
  # A view model for a page of PostViews of a Topic.
  class TopicPostsPageView < Thredded::PostsPageView
    # @return [Thredded::BaseTopicView]
    attr_reader :topic

    # @param user [Thredded.user_class] the user who is viewing the posts page
    # @param topic [Thredded::TopicCommon]
    # @param paginated_scope [ActiveRecord::Relation<Thredded::PostCommon>]
    def initialize(user, topic, paginated_scope)
      super(user, paginated_scope)
      @topic = "#{paginated_scope.reflect_on_association(:postable).klass}View".constantize.from_user(topic, user)
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
thredded-0.10.0 app/view_models/thredded/topic_posts_page_view.rb
thredded-0.9.4 app/view_models/thredded/topic_posts_page_view.rb
thredded-0.9.3 app/view_models/thredded/topic_posts_page_view.rb
thredded-0.9.2 app/view_models/thredded/topic_posts_page_view.rb
thredded-0.9.1 app/view_models/thredded/topic_posts_page_view.rb