Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
gitlab-ce
Commits
2bfac09d
Commit
2bfac09d
authored
Oct 08, 2020
by
Pedro Moreira da Silva
Committed by
Phil Hughes
Oct 08, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Migrate MR widget squash tooltips to GitLab UI
parent
3dc10a64
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
32 additions
and
14 deletions
+32
-14
app/assets/javascripts/vue_merge_request_widget/components/states/squash_before_merge.vue
..._request_widget/components/states/squash_before_merge.vue
+19
-12
app/assets/javascripts/vue_merge_request_widget/i18n.js
app/assets/javascripts/vue_merge_request_widget/i18n.js
+7
-0
locale/gitlab.pot
locale/gitlab.pot
+3
-0
spec/frontend/vue_mr_widget/components/states/mr_widget_squash_before_merge_spec.js
...t/components/states/mr_widget_squash_before_merge_spec.js
+3
-2
No files found.
app/assets/javascripts/vue_merge_request_widget/components/states/squash_before_merge.vue
View file @
2bfac09d
<
script
>
import
{
GlIcon
}
from
'
@gitlab/ui
'
;
import
tooltip
from
'
~/vue_shared/directives/tooltip
'
;
import
{
__
}
from
'
~/locale
'
;
import
{
GlIcon
,
GlTooltipDirective
}
from
'
@gitlab/ui
'
;
import
{
SQUASH_BEFORE_MERGE
}
from
'
../../i18n
'
;
export
default
{
components
:
{
GlIcon
,
},
directives
:
{
tooltip
,
GlTooltip
:
GlTooltipDirective
,
},
i18n
:
{
...
SQUASH_BEFORE_MERGE
,
},
props
:
{
value
:
{
...
...
@@ -28,7 +30,10 @@ export default {
},
computed
:
{
tooltipTitle
()
{
return
this
.
isDisabled
?
__
(
'
Required in this project.
'
)
:
false
;
return
this
.
isDisabled
?
this
.
$options
.
i18n
.
tooltipTitle
:
null
;
},
tooltipFocusable
()
{
return
this
.
isDisabled
?
'
0
'
:
null
;
},
},
};
...
...
@@ -37,10 +42,11 @@ export default {
<
template
>
<div
class=
"inline"
>
<label
v-tooltip
v-
gl-
tooltip
:class=
"
{ 'gl-text-gray-400': isDisabled }"
:tabindex="tooltipFocusable"
data-testid="squashLabel"
:
data-
title="tooltipTitle"
:title="tooltipTitle"
>
<input
:checked=
"value"
...
...
@@ -50,19 +56,20 @@ export default {
class=
"qa-squash-checkbox js-squash-checkbox"
@
change=
"$emit('input', $event.target.checked)"
/>
{{
__
(
'
Squash commits
'
)
}}
{{
$options
.
i18n
.
checkboxLabel
}}
</label>
<a
v-if=
"helpPath"
v-tooltip
v-
gl-
tooltip
:href=
"helpPath"
data-title=
"About this feature"
data-placement=
"bottom"
:title=
"$options.i18n.helpLabel"
target=
"_blank"
rel=
"noopener noreferrer nofollow"
data-container=
"body"
>
<gl-icon
name=
"question"
/>
<span
class=
"sr-only"
>
{{
$options
.
i18n
.
helpLabel
}}
</span>
</a>
</div>
</
template
>
app/assets/javascripts/vue_merge_request_widget/i18n.js
0 → 100644
View file @
2bfac09d
import
{
__
}
from
'
~/locale
'
;
export
const
SQUASH_BEFORE_MERGE
=
{
tooltipTitle
:
__
(
'
Required in this project.
'
),
checkboxLabel
:
__
(
'
Squash commits
'
),
helpLabel
:
__
(
'
What is squashing?
'
),
};
locale/gitlab.pot
View file @
2bfac09d
...
...
@@ -28968,6 +28968,9 @@ msgstr ""
msgid "What describes you best?"
msgstr ""
msgid "What is squashing?"
msgstr ""
msgid "What's new at GitLab"
msgstr ""
...
...
spec/frontend/vue_mr_widget/components/states/mr_widget_squash_before_merge_spec.js
View file @
2bfac09d
import
{
createLocalVue
,
shallowMount
}
from
'
@vue/test-utils
'
;
import
SquashBeforeMerge
from
'
~/vue_merge_request_widget/components/states/squash_before_merge.vue
'
;
import
{
SQUASH_BEFORE_MERGE
}
from
'
~/vue_merge_request_widget/i18n
'
;
const
localVue
=
createLocalVue
();
...
...
@@ -85,7 +86,7 @@ describe('Squash before merge component', () => {
});
describe
(
'
tooltip
'
,
()
=>
{
const
tooltipTitle
=
()
=>
findLabel
().
element
.
dataset
.
title
;
const
tooltipTitle
=
()
=>
findLabel
().
attributes
(
'
title
'
)
;
it
(
'
does not render when isDisabled is false
'
,
()
=>
{
createComponent
({
...
...
@@ -101,7 +102,7 @@ describe('Squash before merge component', () => {
isDisabled
:
true
,
});
expect
(
tooltipTitle
()).
toBe
(
'
Required in this project.
'
);
expect
(
tooltipTitle
()).
toBe
(
SQUASH_BEFORE_MERGE
.
tooltipTitle
);
});
});
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment