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
4077ce2f
Commit
4077ce2f
authored
Mar 13, 2020
by
Florie Guibert
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix scoped label right text on update sidebar
parent
982edbcd
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
51 additions
and
6 deletions
+51
-6
app/assets/javascripts/labels_select.js
app/assets/javascripts/labels_select.js
+7
-2
app/assets/stylesheets/pages/issuable.scss
app/assets/stylesheets/pages/issuable.scss
+0
-4
spec/frontend/labels_select_spec.js
spec/frontend/labels_select_spec.js
+44
-0
No files found.
app/assets/javascripts/labels_select.js
View file @
4077ce2f
...
@@ -495,6 +495,10 @@ export default class LabelsSelect {
...
@@ -495,6 +495,10 @@ export default class LabelsSelect {
].
join
(
''
),
].
join
(
''
),
);
);
const
rightLabelTextColor
=
({
label
,
escapeStr
})
=>
{
return
escapeStr
(
label
.
text_color
===
'
#FFFFFF
'
?
label
.
color
:
label
.
text_color
);
};
const
infoIconTemplate
=
_
.
template
(
const
infoIconTemplate
=
_
.
template
(
[
[
'
<a href="<%= scopedLabelsDocumentationLink %>" class="gl-link gl-label-icon" target="_blank" rel="noopener">
'
,
'
<a href="<%= scopedLabelsDocumentationLink %>" class="gl-link gl-label-icon" target="_blank" rel="noopener">
'
,
...
@@ -510,7 +514,7 @@ export default class LabelsSelect {
...
@@ -510,7 +514,7 @@ export default class LabelsSelect {
spanOpenTag
,
spanOpenTag
,
'
<%- label.title.slice(0, label.title.lastIndexOf("::")) %>
'
,
'
<%- label.title.slice(0, label.title.lastIndexOf("::")) %>
'
,
'
</span>
'
,
'
</span>
'
,
'
<span class="gl-label-text" style="color: <%=
escapeStr(label.color
) %>;">
'
,
'
<span class="gl-label-text" style="color: <%=
rightLabelTextColor({ label, escapeStr }
) %>;">
'
,
'
<%- label.title.slice(label.title.lastIndexOf("::") + 2) %>
'
,
'
<%- label.title.slice(label.title.lastIndexOf("::") + 2) %>
'
,
'
</span>
'
,
'
</span>
'
,
'
</a>
'
,
'
</a>
'
,
...
@@ -536,7 +540,7 @@ export default class LabelsSelect {
...
@@ -536,7 +540,7 @@ export default class LabelsSelect {
'
<% _.each(labels, function(label){ %>
'
,
'
<% _.each(labels, function(label){ %>
'
,
'
<% if (isScopedLabel(label) && enableScopedLabels) { %>
'
,
'
<% if (isScopedLabel(label) && enableScopedLabels) { %>
'
,
'
<span class="d-inline-block position-relative scoped-label-wrapper">
'
,
'
<span class="d-inline-block position-relative scoped-label-wrapper">
'
,
'
<%= scopedLabelTemplate({ label, issueUpdateURL, isScopedLabel, enableScopedLabels, infoIconTemplate, scopedLabelsDocumentationLink, tooltipTitleTemplate, escapeStr, linkAttrs:
\'
data-html="true"
\'
}) %>
'
,
'
<%= scopedLabelTemplate({ label, issueUpdateURL, isScopedLabel, enableScopedLabels,
rightLabelTextColor,
infoIconTemplate, scopedLabelsDocumentationLink, tooltipTitleTemplate, escapeStr, linkAttrs:
\'
data-html="true"
\'
}) %>
'
,
'
</span>
'
,
'
</span>
'
,
'
<% } else { %>
'
,
'
<% } else { %>
'
,
'
<%= labelTemplate({ label, issueUpdateURL, isScopedLabel, enableScopedLabels, tooltipTitleTemplate, escapeStr, linkAttrs: "" }) %>
'
,
'
<%= labelTemplate({ label, issueUpdateURL, isScopedLabel, enableScopedLabels, tooltipTitleTemplate, escapeStr, linkAttrs: "" }) %>
'
,
...
@@ -548,6 +552,7 @@ export default class LabelsSelect {
...
@@ -548,6 +552,7 @@ export default class LabelsSelect {
return
tpl
({
return
tpl
({
...
tplData
,
...
tplData
,
labelTemplate
,
labelTemplate
,
rightLabelTextColor
,
infoIconTemplate
,
infoIconTemplate
,
scopedLabelTemplate
,
scopedLabelTemplate
,
tooltipTitleTemplate
,
tooltipTitleTemplate
,
...
...
app/assets/stylesheets/pages/issuable.scss
View file @
4077ce2f
...
@@ -158,10 +158,6 @@
...
@@ -158,10 +158,6 @@
a
:not
(
.btn
)
{
a
:not
(
.btn
)
{
color
:
inherit
;
color
:
inherit
;
.gl-label-text
:hover
{
color
:
inherit
;
}
&
:hover
{
&
:hover
{
color
:
$blue-800
;
color
:
$blue-800
;
...
...
spec/frontend/labels_select_spec.js
View file @
4077ce2f
...
@@ -23,6 +23,16 @@ const mockScopedLabels = [
...
@@ -23,6 +23,16 @@ const mockScopedLabels = [
},
},
];
];
const
mockScopedLabels2
=
[
{
id
:
28
,
title
:
'
Foo::Bar2
'
,
description
:
'
Foobar2
'
,
color
:
'
#FFFFFF
'
,
text_color
:
'
#000000
'
,
},
];
describe
(
'
LabelsSelect
'
,
()
=>
{
describe
(
'
LabelsSelect
'
,
()
=>
{
describe
(
'
getLabelTemplate
'
,
()
=>
{
describe
(
'
getLabelTemplate
'
,
()
=>
{
describe
(
'
when normal label is present
'
,
()
=>
{
describe
(
'
when normal label is present
'
,
()
=>
{
...
@@ -108,11 +118,45 @@ describe('LabelsSelect', () => {
...
@@ -108,11 +118,45 @@ describe('LabelsSelect', () => {
expect
(
$labelEl
.
find
(
'
span.gl-label-text
'
).
attr
(
'
style
'
)).
toBe
(
expect
(
$labelEl
.
find
(
'
span.gl-label-text
'
).
attr
(
'
style
'
)).
toBe
(
`background-color:
${
label
.
color
}
; color:
${
label
.
text_color
}
;`
,
`background-color:
${
label
.
color
}
; color:
${
label
.
text_color
}
;`
,
);
);
expect
(
$labelEl
.
find
(
'
span.gl-label-text
'
)
.
last
()
.
attr
(
'
style
'
),
).
toBe
(
`color:
${
label
.
color
}
;`
);
});
});
it
(
'
generated label item has a badge class
'
,
()
=>
{
it
(
'
generated label item has a badge class
'
,
()
=>
{
expect
(
$labelEl
.
find
(
'
span
'
).
hasClass
(
'
gl-label-text
'
)).
toEqual
(
true
);
expect
(
$labelEl
.
find
(
'
span
'
).
hasClass
(
'
gl-label-text
'
)).
toEqual
(
true
);
});
});
});
});
describe
(
'
when scoped label is present, with text color not white
'
,
()
=>
{
const
label
=
mockScopedLabels2
[
0
];
let
$labelEl
;
beforeEach
(()
=>
{
$labelEl
=
$
(
LabelsSelect
.
getLabelTemplate
({
labels
:
mockScopedLabels2
,
issueUpdateURL
:
mockUrl
,
enableScopedLabels
:
true
,
scopedLabelsDocumentationLink
:
'
docs-link
'
,
}),
);
});
it
(
'
generated label item template has correct label styles
'
,
()
=>
{
expect
(
$labelEl
.
find
(
'
span.gl-label-text
'
).
attr
(
'
style
'
)).
toBe
(
`background-color:
${
label
.
color
}
; color:
${
label
.
text_color
}
;`
,
);
expect
(
$labelEl
.
find
(
'
span.gl-label-text
'
)
.
last
()
.
attr
(
'
style
'
),
).
toBe
(
`color:
${
label
.
text_color
}
;`
);
});
});
});
});
});
});
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