Class: Thredded::TopicDecorator
- Inherits:
-
SimpleDelegator
- Object
- SimpleDelegator
- Thredded::TopicDecorator
- Defined in:
- app/decorators/thredded/topic_decorator.rb
Class Method Summary collapse
Instance Method Summary collapse
- #category_options ⇒ Object
- #css_class ⇒ Object
-
#initialize(private_topic) ⇒ TopicDecorator
constructor
A new instance of TopicDecorator.
Constructor Details
#initialize(private_topic) ⇒ TopicDecorator
Returns a new instance of TopicDecorator.
5 6 7 |
# File 'app/decorators/thredded/topic_decorator.rb', line 5 def initialize(private_topic) super(Thredded::BaseTopicDecorator.new(private_topic)) end |
Class Method Details
.model_name ⇒ Object
9 10 11 |
# File 'app/decorators/thredded/topic_decorator.rb', line 9 def self.model_name ActiveModel::Name.new(self, nil, 'Topic') end |
Instance Method Details
#category_options ⇒ Object
21 22 23 |
# File 'app/decorators/thredded/topic_decorator.rb', line 21 def .decorate. end |
#css_class ⇒ Object
13 14 15 16 17 18 19 |
# File 'app/decorators/thredded/topic_decorator.rb', line 13 def css_class classes = [] classes << 'thredded--topic--locked' if locked? classes << 'thredded--topic--sticky' if sticky? classes += ['thredded--topic--category'] + categories.map { |c| "thredded--topic--category--#{c.name}" } if categories.present? classes.join(' ') end |