diff options
author | Sean McGivern <sean@mcgivern.me.uk> | 2018-01-09 14:57:31 +0000 |
---|---|---|
committer | Tiago Botelho <tiagonbotelho@hotmail.com> | 2018-01-19 14:45:36 +0000 |
commit | 75662f09ab8fb85a1d6b2055d74a68e1d5ac84f3 (patch) | |
tree | 17c285174256d3bcade936565f267b545498248d | |
parent | b5ac9ea0632dc73344c00701b499158105c77140 (diff) | |
download | gitlab-ce-75662f09ab8fb85a1d6b2055d74a68e1d5ac84f3.tar.gz |
Merge branch 'changes-dropdown-ellipsis' into 'master'
Fix changes dropdown ellipsis working across browsers
Closes #41561 and #41684
See merge request gitlab-org/gitlab-ce!16281
-rw-r--r-- | app/assets/stylesheets/pages/diff.scss | 1 | ||||
-rw-r--r-- | app/helpers/diff_helper.rb | 8 | ||||
-rw-r--r-- | changelogs/unreleased/changes-dropdown-ellipsis.yml | 5 | ||||
-rw-r--r-- | spec/helpers/diff_helper_spec.rb | 10 |
4 files changed, 23 insertions, 1 deletions
diff --git a/app/assets/stylesheets/pages/diff.scss b/app/assets/stylesheets/pages/diff.scss index 33ac3640654..06765cf9582 100644 --- a/app/assets/stylesheets/pages/diff.scss +++ b/app/assets/stylesheets/pages/diff.scss @@ -666,7 +666,6 @@ } .diff-changed-file-path { - direction: rtl; color: $gl-text-color-tertiary; } diff --git a/app/helpers/diff_helper.rb b/app/helpers/diff_helper.rb index 1ce487e6592..0f5fc2823a3 100644 --- a/app/helpers/diff_helper.rb +++ b/app/helpers/diff_helper.rb @@ -226,4 +226,12 @@ module DiffHelper diffs.overflow? end + + def diff_file_path_text(diff_file, max: 60) + path = diff_file.new_path + + return path unless path.size > max && max > 3 + + "...#{path[-(max - 3)..-1]}" + end end diff --git a/changelogs/unreleased/changes-dropdown-ellipsis.yml b/changelogs/unreleased/changes-dropdown-ellipsis.yml new file mode 100644 index 00000000000..7e3f378cc33 --- /dev/null +++ b/changelogs/unreleased/changes-dropdown-ellipsis.yml @@ -0,0 +1,5 @@ +--- +title: Fixed chanages dropdown ellipsis positioning +merge_request: +author: +type: fixed diff --git a/spec/helpers/diff_helper_spec.rb b/spec/helpers/diff_helper_spec.rb index f9c31ac61d8..15cbe36ae76 100644 --- a/spec/helpers/diff_helper_spec.rb +++ b/spec/helpers/diff_helper_spec.rb @@ -266,4 +266,14 @@ describe DiffHelper do end end end + + context '#diff_file_path_text' do + it 'returns full path by default' do + expect(diff_file_path_text(diff_file)).to eq(diff_file.new_path) + end + + it 'returns truncated path' do + expect(diff_file_path_text(diff_file, max: 10)).to eq("...open.rb") + end + end end |