Class: Decidim::Posts::PostCommentCell
- Inherits:
-
ViewModel
- Object
- ViewModel
- Decidim::Posts::PostCommentCell
- Includes:
- Cell::ViewModel::Partial, Comments::CommentsHelper, ResourceHelper
- Defined in:
- app/cells/decidim/posts/post_comment_cell.rb
Instance Method Summary collapse
- #comments_count ⇒ Object
- #machine_translations_toggled? ⇒ Boolean
- #model_type ⇒ Object
- #post ⇒ Object
- #post_commentable? ⇒ Boolean
- #show ⇒ Object
Instance Method Details
#comments_count ⇒ Object
41 42 43 |
# File 'app/cells/decidim/posts/post_comment_cell.rb', line 41 def comments_count model.comments_count end |
#machine_translations_toggled? ⇒ Boolean
37 38 39 |
# File 'app/cells/decidim/posts/post_comment_cell.rb', line 37 def machine_translations_toggled? RequestStore.store[:toggle_machine_translations] end |
#model_type ⇒ Object
17 18 19 20 21 22 23 24 25 |
# File 'app/cells/decidim/posts/post_comment_cell.rb', line 17 def model_type if model.is_a?(Decidim::Posts::Post) "Post" elsif model.is_a?(Decidim::Meetings::Meeting) "Meeting" else "Post" end end |
#post ⇒ Object
13 14 15 |
# File 'app/cells/decidim/posts/post_comment_cell.rb', line 13 def post model end |
#post_commentable? ⇒ Boolean
27 28 29 30 31 32 33 34 35 |
# File 'app/cells/decidim/posts/post_comment_cell.rb', line 27 def post_commentable? if model.respond_to?(:enable_comments?) model.enable_comments? elsif model.respond_to?(:comments_enabled?) model.comments_enabled? else false # Default to false if neither method exists end end |
#show ⇒ Object
9 10 11 |
# File 'app/cells/decidim/posts/post_comment_cell.rb', line 9 def show render :show end |