Sha256: 2f8f3e49fffeee04de89928808f3c4e0c3f6d0c5485c3fc1d64ad5582ccf4309

Contents?: true

Size: 521 Bytes

Versions: 4

Compression:

Stored size: 521 Bytes

Contents

# frozen_string_literal: true
module Thredded
  # A view model for Topic.
  class TopicView < BaseTopicView
    delegate :categories,
             to: :@topic

    def states
      super + [
        (:locked if @topic.locked?),
        (:sticky if @topic.sticky?),
      ].compact
    end

    def edit_path
      Thredded::UrlsHelper.edit_messageboard_topic_path(@topic.messageboard, @topic)
    end

    def destroy_path
      Thredded::UrlsHelper.messageboard_topic_path(@topic.messageboard, @topic)
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
thredded-0.4.0 app/view_models/thredded/topic_view.rb
thredded-0.3.2 app/view_models/thredded/topic_view.rb
thredded-0.3.1 app/view_models/thredded/topic_view.rb
thredded-0.3.0 app/view_models/thredded/topic_view.rb