Class: Thredded::MessageboardDecorator
- Inherits:
-
SimpleDelegator
- Object
- SimpleDelegator
- Thredded::MessageboardDecorator
- Includes:
- ActionView::Helpers::NumberHelper, ActionView::Helpers::TagHelper
- Defined in:
- app/decorators/thredded/messageboard_decorator.rb
Instance Method Summary collapse
- #category_options ⇒ Object
-
#initialize(messageboard) ⇒ MessageboardDecorator
constructor
A new instance of MessageboardDecorator.
- #latest_topic ⇒ Object
- #latest_user ⇒ Object
- #meta ⇒ Object
- #original ⇒ Object
Constructor Details
#initialize(messageboard) ⇒ MessageboardDecorator
Returns a new instance of MessageboardDecorator.
6 7 8 9 |
# File 'app/decorators/thredded/messageboard_decorator.rb', line 6 def initialize() super = end |
Instance Method Details
#category_options ⇒ Object
33 34 35 |
# File 'app/decorators/thredded/messageboard_decorator.rb', line 33 def .categories.map { |cat| [cat.name, cat.id] } end |
#latest_topic ⇒ Object
22 23 24 25 26 27 |
# File 'app/decorators/thredded/messageboard_decorator.rb', line 22 def latest_topic @latest_topic ||= begin .topics.order_latest_first.first || Thredded::NullTopic.new end end |
#latest_user ⇒ Object
29 30 31 |
# File 'app/decorators/thredded/messageboard_decorator.rb', line 29 def latest_user latest_topic.last_user end |
#meta ⇒ Object
15 16 17 18 19 20 |
# File 'app/decorators/thredded/messageboard_decorator.rb', line 15 def topics_count = number_to_human(.topics_count) posts_count = number_to_human(.posts_count) "#{topics_count} topics / #{posts_count} posts".downcase end |
#original ⇒ Object
11 12 13 |
# File 'app/decorators/thredded/messageboard_decorator.rb', line 11 def original end |