Commit 7413edd4 authored by Dmitriy Zaporozhets's avatar Dmitriy Zaporozhets

Merge branch 'improve-diffs' into 'master'

Improve diffs UI

* replace big button with simple toggle for diff comments
* replace diff stats button with link

See merge request !399
parents e7e329d3 1cf13817
...@@ -6,6 +6,7 @@ v 7.10.0 (unreleased) ...@@ -6,6 +6,7 @@ v 7.10.0 (unreleased)
- Add a service to support external wikis (Hannes Rosenögger) - Add a service to support external wikis (Hannes Rosenögger)
- List new commits for newly pushed branch in activity view. - List new commits for newly pushed branch in activity view.
- Add changelog, license and contribution guide links to project sidebar. - Add changelog, license and contribution guide links to project sidebar.
- Improve diff UI
v 7.9.0 (unreleased) v 7.9.0 (unreleased)
- Add HipChat integration documentation (Stan Hu) - Add HipChat integration documentation (Stan Hu)
......
...@@ -169,9 +169,7 @@ $ -> ...@@ -169,9 +169,7 @@ $ ->
# Show/hide comments on diff # Show/hide comments on diff
$("body").on "click", ".js-toggle-diff-comments", (e) -> $("body").on "click", ".js-toggle-diff-comments", (e) ->
$(@).find('i'). $(@).toggleClass('active')
toggleClass('fa fa-chevron-down').
toggleClass('fa fa-chevron-up')
$(@).closest(".diff-file").find(".notes_holder").toggle() $(@).closest(".diff-file").find(".notes_holder").toggle()
e.preventDefault() e.preventDefault()
......
.row .row.prepend-top-20.append-bottom-10
.col-md-8 .col-md-8
= render 'projects/diffs/stats', diffs: diffs = render 'projects/diffs/stats', diffs: diffs
.col-md-4 .col-md-4
......
...@@ -22,9 +22,8 @@ ...@@ -22,9 +22,8 @@
.diff-btn-group .diff-btn-group
- if blob.text? - if blob.text?
= link_to '#', class: 'js-toggle-diff-comments btn btn-sm' do = link_to '#', class: 'js-toggle-diff-comments btn btn-sm active has_tooltip', title: "Toggle comments for this file" do
%i.fa.fa-chevron-down %i.fa.fa-comments
Show/Hide comments
   
- if @merge_request && @merge_request.source_project - if @merge_request && @merge_request.source_project
......
.js-toggle-container .js-toggle-container
.commit-stat-summary .commit-stat-summary
Showing Showing
%strong.cdark #{pluralize(diffs.count, "changed file")} = link_to '#', class: 'js-toggle-button' do
%strong #{pluralize(diffs.count, "changed file")}
- if current_controller?(:commit) - if current_controller?(:commit)
- unless @commit.has_zero_stats? - unless @commit.has_zero_stats?
with with
%strong.cgreen #{@commit.stats.additions} additions %strong.cgreen #{@commit.stats.additions} additions
and and
%strong.cred #{@commit.stats.deletions} deletions %strong.cred #{@commit.stats.deletions} deletions
 
= link_to '#', class: 'btn btn-sm js-toggle-button' do
Show diff stats
%i.fa.fa-chevron-down
.file-stats.js-toggle-content.hide .file-stats.js-toggle-content.hide
%ul.bordered-list %ul.bordered-list
- diffs.each_with_index do |diff, i| - diffs.each_with_index do |diff, i|
......
...@@ -209,13 +209,13 @@ class Spinach::Features::ProjectMergeRequests < Spinach::FeatureSteps ...@@ -209,13 +209,13 @@ class Spinach::Features::ProjectMergeRequests < Spinach::FeatureSteps
step 'I click link "Hide inline discussion" of the second file' do step 'I click link "Hide inline discussion" of the second file' do
within '.files [id^=diff]:nth-child(2)' do within '.files [id^=diff]:nth-child(2)' do
click_link 'Show/Hide comments' find('.js-toggle-diff-comments').click
end end
end end
step 'I click link "Show inline discussion" of the second file' do step 'I click link "Show inline discussion" of the second file' do
within '.files [id^=diff]:nth-child(2)' do within '.files [id^=diff]:nth-child(2)' do
click_link 'Show/Hide comments' find('.js-toggle-diff-comments').click
end end
end end
......
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