summaryrefslogtreecommitdiff
path: root/app/views
diff options
context:
space:
mode:
authorDouwe Maan <douwe@selenight.nl>2016-07-28 19:14:00 -0600
committerDouwe Maan <douwe@selenight.nl>2016-07-28 19:28:56 -0600
commit6d9715d8777265737c076abe06362d2a8e9e498d (patch)
treead55282043bd84bfbe8b4419568289b895e82d22 /app/views
parentce1843b7dea3b63cfced7800612098a766c68e13 (diff)
downloadgitlab-ce-6d9715d8777265737c076abe06362d2a8e9e498d.tar.gz
Show existing discussion when adding new comment on line with a hidden resolved discussion
Diffstat (limited to 'app/views')
-rw-r--r--app/views/discussions/_diff_discussion.html.haml15
-rw-r--r--app/views/discussions/_diff_with_notes.html.haml2
-rw-r--r--app/views/discussions/_discussion.html.haml3
-rw-r--r--app/views/discussions/_notes.html.haml18
-rw-r--r--app/views/discussions/_parallel_diff_discussion.html.haml33
5 files changed, 30 insertions, 41 deletions
diff --git a/app/views/discussions/_diff_discussion.html.haml b/app/views/discussions/_diff_discussion.html.haml
index 5f49d44b062..c280b5b53b7 100644
--- a/app/views/discussions/_diff_discussion.html.haml
+++ b/app/views/discussions/_diff_discussion.html.haml
@@ -1,13 +1,6 @@
-%tr.notes_holder
+- expanded = local_assigns.fetch(:expanded, discussion.expanded?)
+%tr.notes_holder{class: ('hide' unless expanded)}
%td.notes_line{ colspan: 2 }
%td.notes_content
- %ul.notes{ data: { discussion_id: discussion.id } }
- = render partial: "projects/notes/note", collection: discussion.notes, as: :note
-
- .discussion-reply-holder
- .discussion-with-resolve-btn{ role: "group" }
- .btn-group{ role: "group" }
- = link_to_reply_discussion(discussion)
- .btn-group{ role: "group" }
- = render "discussions/resolve_all", discussion: discussion
- = render "discussions/jump_to_next", discussion: discussion
+ .content
+ = render "discussions/notes", discussion: discussion
diff --git a/app/views/discussions/_diff_with_notes.html.haml b/app/views/discussions/_diff_with_notes.html.haml
index 02b159ffd45..81f538a9de1 100644
--- a/app/views/discussions/_diff_with_notes.html.haml
+++ b/app/views/discussions/_diff_with_notes.html.haml
@@ -11,4 +11,4 @@
= render "projects/diffs/line", line: line, diff_file: diff_file, plain: true
- if discussion.for_line?(line)
- = render "discussions/diff_discussion", discussion: discussion
+ = render "discussions/diff_discussion", discussion: discussion, expanded: true
diff --git a/app/views/discussions/_discussion.html.haml b/app/views/discussions/_discussion.html.haml
index 21f3eb5b1bb..e58f26c5ab3 100644
--- a/app/views/discussions/_discussion.html.haml
+++ b/app/views/discussions/_discussion.html.haml
@@ -44,4 +44,5 @@
- if discussion.diff_discussion? && discussion.diff_file
= render "discussions/diff_with_notes", discussion: discussion
- else
- = render "discussions/notes", discussion: discussion
+ .panel.panel-default
+ = render "discussions/notes", discussion: discussion
diff --git a/app/views/discussions/_notes.html.haml b/app/views/discussions/_notes.html.haml
index ab28ee8808c..c5bf454ccfe 100644
--- a/app/views/discussions/_notes.html.haml
+++ b/app/views/discussions/_notes.html.haml
@@ -1,7 +1,15 @@
-.panel.panel-default
- .notes{ data: { discussion_id: discussion.id } }
- %ul.notes.timeline
- = render partial: "projects/notes/note", collection: discussion.notes, as: :note
+%ul.notes{ data: { discussion_id: discussion.id } }
+ = render partial: "projects/notes/note", collection: discussion.notes, as: :note
- .discussion-reply-holder
+.discussion-reply-holder
+ - if discussion.diff_discussion?
+ - line_type = local_assigns.fetch(:line_type, nil)
+
+ .btn-group-justified.discussion-with-resolve-btn{ role: "group" }
+ .btn-group{ role: "group" }
+ = link_to_reply_discussion(discussion, line_type)
+ .btn-group{ role: "group" }
+ = render "discussions/resolve_all", discussion: discussion
+ = render "discussions/jump_to_next", discussion: discussion
+ - else
= link_to_reply_discussion(discussion)
diff --git a/app/views/discussions/_parallel_diff_discussion.html.haml b/app/views/discussions/_parallel_diff_discussion.html.haml
index dcab08cd8ed..f1072ce0feb 100644
--- a/app/views/discussions/_parallel_diff_discussion.html.haml
+++ b/app/views/discussions/_parallel_diff_discussion.html.haml
@@ -1,34 +1,21 @@
-%tr.notes_holder
+- expanded = discussion_left.try(:expanded?) || discussion_right.try(:expanded?)
+%tr.notes_holder{class: ('hide' unless expanded)}
- if discussion_left
%td.notes_line.old
%td.notes_content.parallel.old
- %ul.notes{ data: { discussion_id: discussion_left.id } }
- = render partial: "projects/notes/note", collection: discussion_left.notes, as: :note
-
- .discussion-reply-holder
- .btn-group-justified.discussion-with-resolve-btn{ role: "group" }
- .btn-group{ role: "group" }
- = link_to_reply_discussion(discussion_left, 'old')
- .btn-group{ role: "group" }
- = render "discussions/resolve_all", discussion: discussion_left
- = render "discussions/jump_to_next", discussion: discussion_left
+ .content{class: ('hide' unless discussion_left.expanded?)}
+ = render "discussions/notes", discussion: discussion_left, line_type: 'old'
- else
%td.notes_line.old= ""
- %td.notes_content.parallel.old= ""
+ %td.notes_content.parallel.old
+ .content
- if discussion_right
%td.notes_line.new
%td.notes_content.parallel.new
- %ul.notes{ data: { discussion_id: discussion_right.id } }
- = render partial: "projects/notes/note", collection: discussion_right.notes, as: :note
-
- .discussion-reply-holder
- .btn-group-justified.discussion-with-resolve-btn{ role: "group" }
- .btn-group{ role: "group" }
- = link_to_reply_discussion(discussion_right, 'new')
- .btn-group{ role: "group" }
- = render "discussions/resolve_all", discussion: discussion_right
- = render "discussions/jump_to_next", discussion: discussion_right
+ .content{class: ('hide' unless discussion_right.expanded?)}
+ = render "discussions/notes", discussion: discussion_right, line_type: 'new'
- else
%td.notes_line.new= ""
- %td.notes_content.parallel.new= ""
+ %td.notes_content.parallel.new
+ .content