diff options
author | Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com> | 2014-06-25 11:40:33 +0300 |
---|---|---|
committer | Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com> | 2014-06-25 11:40:33 +0300 |
commit | 674cbe1534442f2149a3b787a24b5db3cb581d55 (patch) | |
tree | 1e2b0c0767e8ffddba8831c634fa1d57d8f9c1d0 | |
parent | 907548a0fbf3c048536c2012bdbdbd10b604c067 (diff) | |
download | gitlab-ce-674cbe1534442f2149a3b787a24b5db3cb581d55.tar.gz |
Fix diff comments toggle button
Signed-off-by: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
-rw-r--r-- | app/assets/javascripts/application.js.coffee | 8 | ||||
-rw-r--r-- | app/views/projects/commits/_diffs.html.haml | 4 | ||||
-rw-r--r-- | app/views/projects/notes/_diff_notes_with_reply_parallel.html.haml | 6 | ||||
-rw-r--r-- | app/views/projects/notes/discussions/_active.html.haml | 2 | ||||
-rw-r--r-- | app/views/projects/notes/discussions/_commit.html.haml | 2 | ||||
-rw-r--r-- | app/views/projects/notes/discussions/_diff.html.haml (renamed from app/views/projects/notes/_discussion_diff.html.haml) | 0 | ||||
-rw-r--r-- | app/views/projects/notes/discussions/_outdated.html.haml | 2 | ||||
-rw-r--r-- | features/steps/project/merge_requests.rb | 8 |
8 files changed, 20 insertions, 12 deletions
diff --git a/app/assets/javascripts/application.js.coffee b/app/assets/javascripts/application.js.coffee index 9bcd8f0a171..5b124554c38 100644 --- a/app/assets/javascripts/application.js.coffee +++ b/app/assets/javascripts/application.js.coffee @@ -143,6 +143,14 @@ $ -> $(@).next('table').show() $(@).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 $.fn.extend disable: -> diff --git a/app/views/projects/commits/_diffs.html.haml b/app/views/projects/commits/_diffs.html.haml index a62f50776fa..fcdb40468d9 100644 --- a/app/views/projects/commits/_diffs.html.haml +++ b/app/views/projects/commits/_diffs.html.haml @@ -45,7 +45,7 @@ - file = project.repository.blob_at(@commit.id, diff.new_path) - file = project.repository.blob_at(@commit.parent_id, diff.old_path) 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)}"} - if diff.deleted_file %span= diff.old_path @@ -61,7 +61,7 @@ %span.file-mode= "#{diff.a_mode} → #{diff.b_mode}" .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 Diff comments diff --git a/app/views/projects/notes/_diff_notes_with_reply_parallel.html.haml b/app/views/projects/notes/_diff_notes_with_reply_parallel.html.haml index 279b04e5047..8adf903a9a1 100644 --- a/app/views/projects/notes/_diff_notes_with_reply_parallel.html.haml +++ b/app/views/projects/notes/_diff_notes_with_reply_parallel.html.haml @@ -12,7 +12,8 @@ %ul.notes{ rel: note1.discussion_id } = render notes1 - = link_to_reply_diff(note1) + .discussion-reply-holder + = link_to_reply_diff(note1) - else %td= "" %td= "" @@ -26,7 +27,8 @@ %ul.notes{ rel: note2.discussion_id } = render notes2 - = link_to_reply_diff(note2) + .discussion-reply-holder + = link_to_reply_diff(note2) - else %td= "" %td= "" diff --git a/app/views/projects/notes/discussions/_active.html.haml b/app/views/projects/notes/discussions/_active.html.haml index c242e68ee73..ef296b35dd5 100644 --- a/app/views/projects/notes/discussions/_active.html.haml +++ b/app/views/projects/notes/discussions/_active.html.haml @@ -18,4 +18,4 @@ %span.discussion-last-update #{time_ago_with_tooltip(last_note.updated_at, 'bottom', 'discussion_updated_ago')} .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 diff --git a/app/views/projects/notes/discussions/_commit.html.haml b/app/views/projects/notes/discussions/_commit.html.haml index f8ec4e972e0..78460974a9b 100644 --- a/app/views/projects/notes/discussions/_commit.html.haml +++ b/app/views/projects/notes/discussions/_commit.html.haml @@ -18,7 +18,7 @@ #{time_ago_with_tooltip(last_note.updated_at, 'bottom', 'discussion_updated_ago')} .discussion-body.js-toggle-content - 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 .panel.panel-default .notes{ rel: discussion_notes.first.discussion_id } diff --git a/app/views/projects/notes/_discussion_diff.html.haml b/app/views/projects/notes/discussions/_diff.html.haml index 26c5494f466..26c5494f466 100644 --- a/app/views/projects/notes/_discussion_diff.html.haml +++ b/app/views/projects/notes/discussions/_diff.html.haml diff --git a/app/views/projects/notes/discussions/_outdated.html.haml b/app/views/projects/notes/discussions/_outdated.html.haml index 51ee0cc9d3f..67c29be8ac1 100644 --- a/app/views/projects/notes/discussions/_outdated.html.haml +++ b/app/views/projects/notes/discussions/_outdated.html.haml @@ -17,4 +17,4 @@ %span.discussion-last-update #{time_ago_with_tooltip(last_note.updated_at, 'bottom', 'discussion_updated_ago')} .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 diff --git a/features/steps/project/merge_requests.rb b/features/steps/project/merge_requests.rb index c98f160ad2e..b0a6e530e8a 100644 --- a/features/steps/project/merge_requests.rb +++ b/features/steps/project/merge_requests.rb @@ -131,8 +131,8 @@ class ProjectMergeRequests < Spinach::FeatureSteps end 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 "app/assets/stylesheets/tree.scss:L185" + page.should have_content "#{current_user.name} started a discussion" + page.should have_content "app/assets/stylesheets/tree.scss" page.should have_content "Line is wrong" end @@ -257,9 +257,7 @@ class ProjectMergeRequests < Spinach::FeatureSteps click_button "Add Comment" end - within ".note-text" do - page.should have_content message - end + page.should have_content message end def init_diff_note_first_file |