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,7 +12,8 @@ ...@@ -12,7 +12,8 @@
%ul.notes{ rel: note1.discussion_id } %ul.notes{ rel: note1.discussion_id }
= render notes1 = render notes1
= link_to_reply_diff(note1) .discussion-reply-holder
= link_to_reply_diff(note1)
- else - else
%td= "" %td= ""
%td= "" %td= ""
...@@ -26,7 +27,8 @@ ...@@ -26,7 +27,8 @@
%ul.notes{ rel: note2.discussion_id } %ul.notes{ rel: note2.discussion_id }
= render notes2 = render notes2
= link_to_reply_diff(note2) .discussion-reply-holder
= link_to_reply_diff(note2)
- else - else
%td= "" %td= ""
%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,9 +257,7 @@ class ProjectMergeRequests < Spinach::FeatureSteps ...@@ -257,9 +257,7 @@ 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
......
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