comments: refactor to use ViewComponent.
This commit is contained in:
10
app/helpers/comments_helper.rb
Normal file
10
app/helpers/comments_helper.rb
Normal file
@@ -0,0 +1,10 @@
|
||||
module CommentsHelper
|
||||
def render_comment(comment, **options)
|
||||
render CommentComponent.new(comment: comment, **options)
|
||||
end
|
||||
|
||||
def render_comment_list(comments, **options)
|
||||
dtext_data = DText.preprocess(comments.map(&:body))
|
||||
render CommentComponent.with_collection(comments, dtext_data: dtext_data, **options)
|
||||
end
|
||||
end
|
||||
Reference in New Issue
Block a user