Class: Decidim::Comments::CommentsCell
- Inherits:
-
ViewModel
- Object
- ViewModel
- Decidim::Comments::CommentsCell
- Includes:
- UserRoleChecker
- Defined in:
- app/cells/decidim/comments/comments_cell.rb
Overview
A cell to display a comments section for a commentable object.
Direct Known Subclasses
Instance Method Summary collapse
- #add_comment ⇒ Object
- #blocked_comments_warning ⇒ Object
- #comments_loading ⇒ Object
- #inline ⇒ Object
- #render_comments ⇒ Object
- #reply? ⇒ Boolean
- #single_comment_warning ⇒ Object
- #user_comments_blocked_warning ⇒ Object
Instance Method Details
#add_comment ⇒ Object
20 21 22 |
# File 'app/cells/decidim/comments/comments_cell.rb', line 20 def add_comment render :add_comment if can_add_comments? end |
#blocked_comments_warning ⇒ Object
40 41 42 43 44 45 |
# File 'app/cells/decidim/comments/comments_cell.rb', line 40 def blocked_comments_warning return unless comments_blocked? return if user_comments_blocked? render :blocked_comments_warning end |
#comments_loading ⇒ Object
34 35 36 37 38 |
# File 'app/cells/decidim/comments/comments_cell.rb', line 34 def comments_loading return if single_comment? render :comments_loading end |
#inline ⇒ Object
16 17 18 |
# File 'app/cells/decidim/comments/comments_cell.rb', line 16 def inline render :inline end |
#render_comments ⇒ Object
10 11 12 13 14 |
# File 'app/cells/decidim/comments/comments_cell.rb', line 10 def render_comments return render_single_comment if single_comment? two_columns_layout? ? render_comments_in_two_columns : render(:comments_in_single_column) end |
#reply? ⇒ Boolean
30 31 32 |
# File 'app/cells/decidim/comments/comments_cell.rb', line 30 def reply? model.is_a?(Decidim::Comments::Comment) end |
#single_comment_warning ⇒ Object
24 25 26 27 28 |
# File 'app/cells/decidim/comments/comments_cell.rb', line 24 def single_comment_warning return unless single_comment? render :single_comment_warning end |
#user_comments_blocked_warning ⇒ Object
47 48 49 50 51 52 |
# File 'app/cells/decidim/comments/comments_cell.rb', line 47 def user_comments_blocked_warning return if comments_blocked? # Shows already the general warning return unless user_comments_blocked? render :user_comments_blocked_warning end |