Skip to content

Commit

Permalink
Standardrb
Browse files Browse the repository at this point in the history
  • Loading branch information
paulmckissock committed Jul 3, 2024
1 parent 1bfd5ad commit 674f33b
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 9 deletions.
13 changes: 6 additions & 7 deletions app/helpers/comments_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,18 +6,18 @@ def render_comment_tree(comment)
concat content_tag(:tr) {
concat content_tag(:td, valign: "top", class: "votelinks") {
content_tag(:center) {
concat button_to(upvote_article_comment_path(comment), method: :post, class: "btn btn-sm upvote-button", data: { votable_type: 'Comment', votable_id: comment.id, article_id: comment.article.id }) {
content_tag(:i, '', class: "fas fa-arrow-up")
concat button_to(upvote_article_comment_path(comment), method: :post, class: "btn btn-sm upvote-button", data: {votable_type: "Comment", votable_id: comment.id, article_id: comment.article.id}) {
content_tag(:i, "", class: "fas fa-arrow-up")
}
concat button_to(downvote_article_comment_path(comment), method: :post, class: "btn btn-sm downvote-button", data: { votable_type: 'Comment', votable_id: comment.id, article_id: comment.article.id }) {
content_tag(:i, '', class: "fas fa-arrow-down")
concat button_to(downvote_article_comment_path(comment), method: :post, class: "btn btn-sm downvote-button", data: {votable_type: "Comment", votable_id: comment.id, article_id: comment.article.id}) {
content_tag(:i, "", class: "fas fa-arrow-down")
}
}
}
concat content_tag(:td, comment.text, valign: "top", style: "padding-left: 10px;")
}
concat content_tag(:tr) {
concat content_tag(:td, '', colspan: "2")
concat content_tag(:td, "", colspan: "2")
concat content_tag(:td, class: "subtext") {
safe_concat content_tag(:span, "#{comment.score} points", id: "score-Comment-#{comment.id}", class: "score")
concat raw(" ")
Expand All @@ -30,7 +30,7 @@ def render_comment_tree(comment)
safe_concat link_to(" reply", article_comment_path(comment.article, comment))
}
}
concat content_tag(:tr, '', style: "height:5px")
concat content_tag(:tr, "", style: "height:5px")
}
}
if comment.replies.any?
Expand All @@ -43,4 +43,3 @@ def render_comment_tree(comment)
end
end
end

4 changes: 2 additions & 2 deletions db/seeds.rb
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@
# Create replies to comments
comments.each_with_index do |comment, i|
replies << Comment.create!(
text: "Sample Reply #{i+1}",
text: "Sample Reply #{i + 1}",
article: comment.article,
user: users.sample,
parent_id: comment.id
Expand All @@ -55,7 +55,7 @@
# replies to replies
replies.each_with_index do |reply, i|
Comment.create!(
text: "Sample Reply to Reply #{i+1}",
text: "Sample Reply to Reply #{i + 1}",
article: reply.article,
user: users.sample,
parent_id: reply.id
Expand Down

0 comments on commit 674f33b

Please sign in to comment.