Commit 674cbe15 authored by Dmitriy Zaporozhets's avatar Dmitriy Zaporozhets

Fix diff comments toggle button

Signed-off-by: default avatarDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
parent 907548a0
...@@ -143,6 +143,14 @@ $ -> ...@@ -143,6 +143,14 @@ $ ->
$(@).next('table').show() $(@).next('table').show()
$(@).remove() $(@).remove()
# Show/hide comments on diff
$("body").on "click", ".js-toggle-diff-comments", (e) ->
$(@).find('i').
toggleClass('icon-chevron-down').
toggleClass('icon-chevron-up')
$(@).closest(".diff-file").find(".notes_holder").toggle()
e.preventDefault()
(($) -> (($) ->
# Disable an element and add the 'disabled' Bootstrap class # Disable an element and add the 'disabled' Bootstrap class
$.fn.extend disable: -> $.fn.extend disable: ->
......
...@@ -45,7 +45,7 @@ ...@@ -45,7 +45,7 @@
- file = project.repository.blob_at(@commit.id, diff.new_path) - file = project.repository.blob_at(@commit.id, diff.new_path)
- file = project.repository.blob_at(@commit.parent_id, diff.old_path) unless file - file = project.repository.blob_at(@commit.parent_id, diff.old_path) unless file
- next unless file - next unless file
.diff-file.js-toggle-container{id: "diff-#{i}"} .diff-file{id: "diff-#{i}"}
.diff-header{id: "file-path-#{hexdigest(diff.new_path || diff.old_path)}"} .diff-header{id: "file-path-#{hexdigest(diff.new_path || diff.old_path)}"}
- if diff.deleted_file - if diff.deleted_file
%span= diff.old_path %span= diff.old_path
...@@ -61,7 +61,7 @@ ...@@ -61,7 +61,7 @@
%span.file-mode= "#{diff.a_mode}#{diff.b_mode}" %span.file-mode= "#{diff.a_mode}#{diff.b_mode}"
.diff-btn-group .diff-btn-group
= link_to "#", class: "js-toggle-button btn btn-small" do = link_to "#", class: "js-toggle-diff-comments btn btn-small" do
%i.icon-chevron-down %i.icon-chevron-down
Diff comments Diff comments
&nbsp; &nbsp;
......
...@@ -12,6 +12,7 @@ ...@@ -12,6 +12,7 @@
%ul.notes{ rel: note1.discussion_id } %ul.notes{ rel: note1.discussion_id }
= render notes1 = render notes1
.discussion-reply-holder
= link_to_reply_diff(note1) = link_to_reply_diff(note1)
- else - else
%td= "" %td= ""
...@@ -26,6 +27,7 @@ ...@@ -26,6 +27,7 @@
%ul.notes{ rel: note2.discussion_id } %ul.notes{ rel: note2.discussion_id }
= render notes2 = render notes2
.discussion-reply-holder
= link_to_reply_diff(note2) = link_to_reply_diff(note2)
- else - else
%td= "" %td= ""
......
...@@ -18,4 +18,4 @@ ...@@ -18,4 +18,4 @@
%span.discussion-last-update %span.discussion-last-update
#{time_ago_with_tooltip(last_note.updated_at, 'bottom', 'discussion_updated_ago')} #{time_ago_with_tooltip(last_note.updated_at, 'bottom', 'discussion_updated_ago')}
.discussion-body.js-toggle-content .discussion-body.js-toggle-content
= render "projects/notes/discussion_diff", discussion_notes: discussion_notes, note: note = render "projects/notes/discussions/diff", discussion_notes: discussion_notes, note: note
...@@ -18,7 +18,7 @@ ...@@ -18,7 +18,7 @@
#{time_ago_with_tooltip(last_note.updated_at, 'bottom', 'discussion_updated_ago')} #{time_ago_with_tooltip(last_note.updated_at, 'bottom', 'discussion_updated_ago')}
.discussion-body.js-toggle-content .discussion-body.js-toggle-content
- if note.for_diff_line? - if note.for_diff_line?
= render "projects/notes/discussion_diff", discussion_notes: discussion_notes, note: note = render "projects/notes/discussions/diff", discussion_notes: discussion_notes, note: note
- else - else
.panel.panel-default .panel.panel-default
.notes{ rel: discussion_notes.first.discussion_id } .notes{ rel: discussion_notes.first.discussion_id }
......
...@@ -17,4 +17,4 @@ ...@@ -17,4 +17,4 @@
%span.discussion-last-update %span.discussion-last-update
#{time_ago_with_tooltip(last_note.updated_at, 'bottom', 'discussion_updated_ago')} #{time_ago_with_tooltip(last_note.updated_at, 'bottom', 'discussion_updated_ago')}
.discussion-body.js-toggle-content.hide .discussion-body.js-toggle-content.hide
= render "projects/notes/discussion_diff", discussion_notes: discussion_notes, note: note = render "projects/notes/discussions/diff", discussion_notes: discussion_notes, note: note
...@@ -131,8 +131,8 @@ class ProjectMergeRequests < Spinach::FeatureSteps ...@@ -131,8 +131,8 @@ class ProjectMergeRequests < Spinach::FeatureSteps
end end
step 'I should see a discussion has started on line 185' do step 'I should see a discussion has started on line 185' do
page.should have_content "#{current_user.name} started a discussion on this merge request diff" page.should have_content "#{current_user.name} started a discussion"
page.should have_content "app/assets/stylesheets/tree.scss:L185" page.should have_content "app/assets/stylesheets/tree.scss"
page.should have_content "Line is wrong" page.should have_content "Line is wrong"
end end
...@@ -257,10 +257,8 @@ class ProjectMergeRequests < Spinach::FeatureSteps ...@@ -257,10 +257,8 @@ class ProjectMergeRequests < Spinach::FeatureSteps
click_button "Add Comment" click_button "Add Comment"
end end
within ".note-text" do
page.should have_content message page.should have_content message
end end
end
def init_diff_note_first_file def init_diff_note_first_file
find('a[data-line-code="a5cc2925ca8258af241be7e5b0381edf30266302_12_12"]').click find('a[data-line-code="a5cc2925ca8258af241be7e5b0381edf30266302_12_12"]').click
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment