Class: Decidim::Comments::CommentsCell

Inherits:
ViewModel
  • Object
show all
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

TwoColumnsCommentsCell

Instance Method Summary collapse

Instance Method Details

#add_commentObject



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_warningObject



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_loadingObject



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

#inlineObject



16
17
18
# File 'app/cells/decidim/comments/comments_cell.rb', line 16

def inline
  render :inline
end

#render_commentsObject



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

Returns:

  • (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_warningObject



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_warningObject



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