docbrown/app/views/comments/_comment.json.jbuilder
Jeremy Friesen a65954107f
Refactoring to add helper method (#16064)
* Refactoring to add helper method

Prior to this commit, we made view level calls to service modules.  This
refactor provides convenience methods on the model.

Furthermore, it addresses a few Rubocop violations that "come along for
the ride."

* Ensuring cached entity squaks like User

* Fixing broken spec

* Fixing typo
2022-01-12 11:21:44 -05:00

18 lines
627 B
Ruby

json.status "created"
json.css @comment.custom_css
json.depth @comment.depth
json.url @comment.path
json.readable_publish_date @comment.readable_publish_date
json.published_timestamp @comment.decorate.published_timestamp
json.body_html @comment.processed_html
json.id @comment.id
json.id_code @comment.id_code_generated
json.newly_created true
json.user do
json.id current_user.id
json.username current_user.username
json.name current_user.name
json.profile_pic current_user.profile_image_url_for(length: 50)
json.twitter_username current_user.twitter_username
json.github_username current_user.github_username
end