Class: Thredded::MessageboardView
- Inherits:
-
Object
- Object
- Thredded::MessageboardView
- Defined in:
- app/view_models/thredded/messageboard_view.rb
Overview
A view model for Messageboard.
Instance Attribute Summary collapse
- #posts_count ⇒ Integer readonly
- #topics_count ⇒ Integer readonly
- #unread_followed_topics_count ⇒ Integer readonly
- #unread_topics_count ⇒ Integer readonly
Instance Method Summary collapse
- #edit_preferences_path ⇒ String
-
#initialize(messageboard, topics_count: messageboard.topics_count, posts_count: messageboard.posts_count, unread_topics_count: 0, unread_followed_topics_count: 0) ⇒ MessageboardView
constructor
A new instance of MessageboardView.
- #path ⇒ String
- #unread_followed_topics? ⇒ Boolean
- #unread_topics? ⇒ Boolean
Constructor Details
#initialize(messageboard, topics_count: messageboard.topics_count, posts_count: messageboard.posts_count, unread_topics_count: 0, unread_followed_topics_count: 0) ⇒ MessageboardView
Returns a new instance of MessageboardView.
30 31 32 33 34 35 36 37 38 39 40 41 42 |
# File 'app/view_models/thredded/messageboard_view.rb', line 30 def initialize( , topics_count: .topics_count, posts_count: .posts_count, unread_topics_count: 0, unread_followed_topics_count: 0 ) @messageboard = @topics_count = topics_count @posts_count = posts_count @unread_topics_count = unread_topics_count @unread_followed_topics_count = unread_followed_topics_count end |
Instance Attribute Details
#posts_count ⇒ Integer (readonly)
17 18 19 |
# File 'app/view_models/thredded/messageboard_view.rb', line 17 def posts_count @posts_count end |
#topics_count ⇒ Integer (readonly)
14 15 16 |
# File 'app/view_models/thredded/messageboard_view.rb', line 14 def topics_count @topics_count end |
#unread_followed_topics_count ⇒ Integer (readonly)
23 24 25 |
# File 'app/view_models/thredded/messageboard_view.rb', line 23 def unread_followed_topics_count @unread_followed_topics_count end |
#unread_topics_count ⇒ Integer (readonly)
20 21 22 |
# File 'app/view_models/thredded/messageboard_view.rb', line 20 def unread_topics_count @unread_topics_count end |
Instance Method Details
#edit_preferences_path ⇒ String
60 61 62 |
# File 'app/view_models/thredded/messageboard_view.rb', line 60 def edit_preferences_path Thredded::UrlsHelper.(@messageboard) end |
#path ⇒ String
55 56 57 |
# File 'app/view_models/thredded/messageboard_view.rb', line 55 def path Thredded::UrlsHelper.(@messageboard) end |
#unread_followed_topics? ⇒ Boolean
50 51 52 |
# File 'app/view_models/thredded/messageboard_view.rb', line 50 def unread_followed_topics? !@unread_followed_topics_count.zero? end |
#unread_topics? ⇒ Boolean
45 46 47 |
# File 'app/view_models/thredded/messageboard_view.rb', line 45 def unread_topics? !@unread_topics_count.zero? end |