when highlighting a comment, force it and its parents to show

This commit is contained in:
Carl Chenet 2017-05-16 18:41:52 +02:00
parent 84e125c328
commit d2a873a4e9
2 changed files with 6 additions and 1 deletions

View file

@ -137,10 +137,13 @@ class StoriesController < ApplicationController
@comments = @story.merged_comments.includes(:user, :story,
:hat).arrange_for_user(@user)
@force_show_thread_id = nil
if params[:comment_short_id]
@comments.each do |c,x|
if c.short_id == params[:comment_short_id]
c.highlighted = true
@force_show_thread_id = c.thread_id
break
end
end

View file

@ -1,6 +1,8 @@
<input id="comment_folder_<%= comment.short_id %>"
class="comment_folder_button" type="checkbox"
<%= comment.score <= Comment::DOWNVOTABLE_MIN_SCORE ? "checked" : "" %>>
<%= comment.score <= Comment::DOWNVOTABLE_MIN_SCORE &&
!(@force_show_thread_id && @force_show_thread_id == comment.thread_id) ?
"checked" : "" %>>
<div id="comment_<%= comment.short_id %>"
data-shortid="<%= comment.short_id if comment.persisted? %>"
class="comment <%= comment.current_vote ? (comment.current_vote[:vote] == 1 ?