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



21
22
23
# File 'app/cells/decidim/comments/comments_cell.rb', line 21

def add_comment
  render :add_comment if can_add_comments?
end

#blocked_comments_warningObject



41
42
43
44
45
46
# File 'app/cells/decidim/comments/comments_cell.rb', line 41

def blocked_comments_warning
  return unless comments_blocked?
  return if user_comments_blocked?

  render :blocked_comments_warning
end

#comments_loadingObject



35
36
37
38
39
# File 'app/cells/decidim/comments/comments_cell.rb', line 35

def comments_loading
  return if single_comment?

  render :comments_loading
end

#inlineObject



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

def inline
  render :inline
end

#render_commentsObject



11
12
13
14
15
# File 'app/cells/decidim/comments/comments_cell.rb', line 11

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)


31
32
33
# File 'app/cells/decidim/comments/comments_cell.rb', line 31

def reply?
  model.is_a?(Decidim::Comments::Comment)
end

#single_comment_warningObject



25
26
27
28
29
# File 'app/cells/decidim/comments/comments_cell.rb', line 25

def single_comment_warning
  return unless single_comment?

  render :single_comment_warning
end

#user_comments_blocked_warningObject



48
49
50
51
52
53
# File 'app/cells/decidim/comments/comments_cell.rb', line 48

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