when highlighting a comment, force it and its parents to show
This commit is contained in:
parent
84e125c328
commit
d2a873a4e9
|
@ -137,10 +137,13 @@ class StoriesController < ApplicationController
|
||||||
@comments = @story.merged_comments.includes(:user, :story,
|
@comments = @story.merged_comments.includes(:user, :story,
|
||||||
:hat).arrange_for_user(@user)
|
:hat).arrange_for_user(@user)
|
||||||
|
|
||||||
|
@force_show_thread_id = nil
|
||||||
|
|
||||||
if params[:comment_short_id]
|
if params[:comment_short_id]
|
||||||
@comments.each do |c,x|
|
@comments.each do |c,x|
|
||||||
if c.short_id == params[:comment_short_id]
|
if c.short_id == params[:comment_short_id]
|
||||||
c.highlighted = true
|
c.highlighted = true
|
||||||
|
@force_show_thread_id = c.thread_id
|
||||||
break
|
break
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -1,6 +1,8 @@
|
||||||
<input id="comment_folder_<%= comment.short_id %>"
|
<input id="comment_folder_<%= comment.short_id %>"
|
||||||
class="comment_folder_button" type="checkbox"
|
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 %>"
|
<div id="comment_<%= comment.short_id %>"
|
||||||
data-shortid="<%= comment.short_id if comment.persisted? %>"
|
data-shortid="<%= comment.short_id if comment.persisted? %>"
|
||||||
class="comment <%= comment.current_vote ? (comment.current_vote[:vote] == 1 ?
|
class="comment <%= comment.current_vote ? (comment.current_vote[:vote] == 1 ?
|
||||||
|
|
Loading…
Reference in a new issue