Commit 125fba58 authored by Martin Wortschack's avatar Martin Wortschack

Merge branch '208287-design-change-show-unchanged-lines-ui' into 'master'

Change diff unfold buttons ordering and make it more clear

See merge request gitlab-org/gitlab!39060
parents fd27d412 65fa4f15
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
import { mapState, mapActions } from 'vuex'; import { mapState, mapActions } from 'vuex';
import { GlIcon } from '@gitlab/ui'; import { GlIcon } from '@gitlab/ui';
import { deprecatedCreateFlash as createFlash } from '~/flash'; import { deprecatedCreateFlash as createFlash } from '~/flash';
import { s__ } from '~/locale'; import { s__, sprintf } from '~/locale';
import glFeatureFlagsMixin from '~/vue_shared/mixins/gl_feature_flags_mixin'; import glFeatureFlagsMixin from '~/vue_shared/mixins/gl_feature_flags_mixin';
import { UNFOLD_COUNT, INLINE_DIFF_VIEW_TYPE, PARALLEL_DIFF_VIEW_TYPE } from '../constants'; import { UNFOLD_COUNT, INLINE_DIFF_VIEW_TYPE, PARALLEL_DIFF_VIEW_TYPE } from '../constants';
import * as utils from '../store/utils'; import * as utils from '../store/utils';
...@@ -18,11 +18,16 @@ const lineNumberByViewType = (viewType, diffLine) => { ...@@ -18,11 +18,16 @@ const lineNumberByViewType = (viewType, diffLine) => {
[PARALLEL_DIFF_VIEW_TYPE]: line => (line?.right || line?.left)?.new_line, [PARALLEL_DIFF_VIEW_TYPE]: line => (line?.right || line?.left)?.new_line,
}; };
const numberGetter = numberGetters[viewType]; const numberGetter = numberGetters[viewType];
return numberGetter && numberGetter(diffLine); return numberGetter && numberGetter(diffLine);
}; };
const i18n = {
showMore: sprintf(s__('Diffs|Show %{unfoldCount} lines'), { unfoldCount: UNFOLD_COUNT }),
showAll: s__('Diffs|Show all unchanged lines'),
};
export default { export default {
i18n,
directives: { directives: {
tooltip, tooltip,
}, },
...@@ -232,32 +237,27 @@ export default { ...@@ -232,32 +237,27 @@ export default {
</script> </script>
<template> <template>
<td :colspan="colspan" class="text-center"> <td :colspan="colspan" class="text-center gl-font-regular">
<div class="content js-line-expansion-content"> <div class="content js-line-expansion-content">
<a <a
v-if="canExpandUp" v-if="canExpandDown"
v-tooltip class="gl-mx-2 gl-cursor-pointer js-unfold-down gl-display-inline-block gl-py-4"
class="cursor-pointer js-unfold unfold-icon d-inline-block pt-2 pb-2" @click="handleExpandLines(EXPAND_DOWN)"
data-placement="top"
data-container="body"
:title="__('Expand up')"
@click="handleExpandLines(EXPAND_UP)"
> >
<gl-icon :size="12" name="expand-up" aria-hidden="true" /> <gl-icon :size="12" name="expand-down" aria-hidden="true" />
<span>{{ $options.i18n.showMore }}</span>
</a> </a>
<a class="mx-2 cursor-pointer js-unfold-all" @click="handleExpandLines()"> <a class="gl-mx-2 cursor-pointer js-unfold-all" @click="handleExpandLines()">
<span>{{ s__('Diffs|Show unchanged lines') }}</span> <gl-icon :size="12" name="expand" aria-hidden="true" />
<span>{{ $options.i18n.showAll }}</span>
</a> </a>
<a <a
v-if="canExpandDown" v-if="canExpandUp"
v-tooltip class="gl-mx-2 gl-cursor-pointer js-unfold gl-display-inline-block gl-py-4"
class="cursor-pointer js-unfold-down has-tooltip unfold-icon d-inline-block pt-2 pb-2" @click="handleExpandLines(EXPAND_UP)"
data-placement="top"
data-container="body"
:title="__('Expand down')"
@click="handleExpandLines(EXPAND_DOWN)"
> >
<gl-icon :size="12" name="expand-down" aria-hidden="true" /> <gl-icon :size="12" name="expand-up" aria-hidden="true" />
<span>{{ $options.i18n.showMore }}</span>
</a> </a>
</div> </div>
</td> </td>
......
---
title: Re-order diff unfold buttons so that “show more lines above” appears first
merge_request: 39060
author:
type: changed
...@@ -8601,7 +8601,10 @@ msgstr "" ...@@ -8601,7 +8601,10 @@ msgstr ""
msgid "Diffs|No file name available" msgid "Diffs|No file name available"
msgstr "" msgstr ""
msgid "Diffs|Show unchanged lines" msgid "Diffs|Show %{unfoldCount} lines"
msgstr ""
msgid "Diffs|Show all unchanged lines"
msgstr "" msgstr ""
msgid "Diffs|Something went wrong while fetching diff lines." msgid "Diffs|Something went wrong while fetching diff lines."
...@@ -10112,9 +10115,6 @@ msgstr "" ...@@ -10112,9 +10115,6 @@ msgstr ""
msgid "Expand approvers" msgid "Expand approvers"
msgstr "" msgstr ""
msgid "Expand down"
msgstr ""
msgid "Expand dropdown" msgid "Expand dropdown"
msgstr "" msgstr ""
...@@ -10124,9 +10124,6 @@ msgstr "" ...@@ -10124,9 +10124,6 @@ msgstr ""
msgid "Expand sidebar" msgid "Expand sidebar"
msgstr "" msgstr ""
msgid "Expand up"
msgstr ""
msgid "Expected documents: %{expected_documents}" msgid "Expected documents: %{expected_documents}"
msgstr "" msgstr ""
......
...@@ -87,7 +87,7 @@ describe('DiffExpansionCell', () => { ...@@ -87,7 +87,7 @@ describe('DiffExpansionCell', () => {
const findExpandUp = () => vm.$el.querySelector(EXPAND_UP_CLASS); const findExpandUp = () => vm.$el.querySelector(EXPAND_UP_CLASS);
const findExpandDown = () => vm.$el.querySelector(EXPAND_DOWN_CLASS); const findExpandDown = () => vm.$el.querySelector(EXPAND_DOWN_CLASS);
const findExpandAll = () => getByText(vm.$el, 'Show unchanged lines'); const findExpandAll = () => getByText(vm.$el, 'Show all unchanged lines');
describe('top row', () => { describe('top row', () => {
it('should have "expand up" and "show all" option', () => { it('should have "expand up" and "show all" option', () => {
......
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