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
0
Merge Requests
0
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
Tatuya Kamada
gitlab-ce
Commits
931274ba
Commit
931274ba
authored
Jul 13, 2016
by
Phil Hughes
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added tooltip to label value in collapsed sidebar
Closes #19398
parent
e5840a4d
Changes
5
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
83 additions
and
3 deletions
+83
-3
CHANGELOG
CHANGELOG
+2
-0
app/assets/javascripts/labels_select.js
app/assets/javascripts/labels_select.js
+28
-2
app/helpers/issuables_helper.rb
app/helpers/issuables_helper.rb
+14
-0
app/views/shared/issuable/_sidebar.html.haml
app/views/shared/issuable/_sidebar.html.haml
+1
-1
spec/features/issues/issue_sidebar_spec.rb
spec/features/issues/issue_sidebar_spec.rb
+38
-0
No files found.
CHANGELOG
View file @
931274ba
...
@@ -300,6 +300,8 @@ v 8.10.0
...
@@ -300,6 +300,8 @@ v 8.10.0
- Reduce size of HTML used by diff comment forms
- Reduce size of HTML used by diff comment forms
- Protected branches have a "Developers can Merge" setting. !4892 (original implementation by Mathias Vestergaard)
- Protected branches have a "Developers can Merge" setting. !4892 (original implementation by Mathias Vestergaard)
- Fix user creation with stronger minimum password requirements. !4054 (nathan-pmt)
- Fix user creation with stronger minimum password requirements. !4054 (nathan-pmt)
- Added tooltip listing label names to the labels value in the collapsed issuable sidebar
- Fix user creation with stronger minimum password requirements !4054 (nathan-pmt)
- Only show New Snippet button to users that can create snippets.
- Only show New Snippet button to users that can create snippets.
- PipelinesFinder uses git cache data
- PipelinesFinder uses git cache data
- Track a user who created a pipeline
- Track a user who created a pipeline
...
...
app/assets/javascripts/labels_select.js
View file @
931274ba
...
@@ -4,7 +4,7 @@
...
@@ -4,7 +4,7 @@
var
_this
;
var
_this
;
_this
=
this
;
_this
=
this
;
$
(
'
.js-label-select
'
).
each
(
function
(
i
,
dropdown
)
{
$
(
'
.js-label-select
'
).
each
(
function
(
i
,
dropdown
)
{
var
$block
,
$colorPreview
,
$dropdown
,
$form
,
$loading
,
$selectbox
,
$sidebarCollapsedValue
,
$value
,
abilityName
,
defaultLabel
,
enableLabelCreateButton
,
issueURLSplit
,
issueUpdateURL
,
labelHTMLTemplate
,
labelNoneHTMLTemplate
,
labelUrl
,
projectId
,
saveLabelData
,
selectedLabel
,
showAny
,
showNo
;
var
$block
,
$colorPreview
,
$dropdown
,
$form
,
$loading
,
$selectbox
,
$sidebarCollapsedValue
,
$value
,
abilityName
,
defaultLabel
,
enableLabelCreateButton
,
issueURLSplit
,
issueUpdateURL
,
labelHTMLTemplate
,
labelNoneHTMLTemplate
,
labelUrl
,
projectId
,
saveLabelData
,
selectedLabel
,
showAny
,
showNo
,
$sidebarLabelTooltip
;
$dropdown
=
$
(
dropdown
);
$dropdown
=
$
(
dropdown
);
projectId
=
$dropdown
.
data
(
'
project-id
'
);
projectId
=
$dropdown
.
data
(
'
project-id
'
);
labelUrl
=
$dropdown
.
data
(
'
labels
'
);
labelUrl
=
$dropdown
.
data
(
'
labels
'
);
...
@@ -21,6 +21,7 @@
...
@@ -21,6 +21,7 @@
$block
=
$selectbox
.
closest
(
'
.block
'
);
$block
=
$selectbox
.
closest
(
'
.block
'
);
$form
=
$dropdown
.
closest
(
'
form
'
);
$form
=
$dropdown
.
closest
(
'
form
'
);
$sidebarCollapsedValue
=
$block
.
find
(
'
.sidebar-collapsed-icon span
'
);
$sidebarCollapsedValue
=
$block
.
find
(
'
.sidebar-collapsed-icon span
'
);
$sidebarLabelTooltip
=
$block
.
find
(
'
.js-sidebar-labels-tooltip
'
);
$value
=
$block
.
find
(
'
.value
'
);
$value
=
$block
.
find
(
'
.value
'
);
$loading
=
$block
.
find
(
'
.block-loading
'
).
fadeOut
();
$loading
=
$block
.
find
(
'
.block-loading
'
).
fadeOut
();
if
(
issueUpdateURL
!=
null
)
{
if
(
issueUpdateURL
!=
null
)
{
...
@@ -52,7 +53,7 @@
...
@@ -52,7 +53,7 @@
dataType
:
'
JSON
'
,
dataType
:
'
JSON
'
,
data
:
data
data
:
data
}).
done
(
function
(
data
)
{
}).
done
(
function
(
data
)
{
var
labelCount
,
template
;
var
labelCount
,
template
,
labelTooltipTitle
;
$loading
.
fadeOut
();
$loading
.
fadeOut
();
$dropdown
.
trigger
(
'
loaded.gl.dropdown
'
);
$dropdown
.
trigger
(
'
loaded.gl.dropdown
'
);
$selectbox
.
hide
();
$selectbox
.
hide
();
...
@@ -66,6 +67,31 @@
...
@@ -66,6 +67,31 @@
}
}
$value
.
removeAttr
(
'
style
'
).
html
(
template
);
$value
.
removeAttr
(
'
style
'
).
html
(
template
);
$sidebarCollapsedValue
.
text
(
labelCount
);
$sidebarCollapsedValue
.
text
(
labelCount
);
if
(
data
.
labels
.
length
)
{
labelTooltipTitle
=
_
.
chain
(
data
.
labels
)
.
map
(
function
(
label
,
i
)
{
if
(
i
<
5
)
{
return
label
.
title
;
}
})
.
compact
()
.
values
();
if
(
data
.
labels
.
length
>
5
)
{
labelTooltipTitle
.
push
(
'
and
'
+
(
data
.
labels
.
length
-
5
)
+
'
more
'
);
}
labelTooltipTitle
=
labelTooltipTitle
.
join
(
'
,
'
);
}
else
{
labelTooltipTitle
=
''
;
$sidebarLabelTooltip
.
tooltip
(
'
destroy
'
);
}
$sidebarLabelTooltip
.
attr
(
'
title
'
,
labelTooltipTitle
)
.
tooltip
(
'
fixTitle
'
);
$
(
'
.has-tooltip
'
,
$value
).
tooltip
({
$
(
'
.has-tooltip
'
,
$value
).
tooltip
({
container
:
'
body
'
container
:
'
body
'
});
});
...
...
app/helpers/issuables_helper.rb
View file @
931274ba
...
@@ -72,6 +72,20 @@ module IssuablesHelper
...
@@ -72,6 +72,20 @@ module IssuablesHelper
end
end
end
end
def
issuable_labels_tooltip
(
labels
)
max_labels
=
5
label_size
=
labels
.
size
label_names
=
labels
.
each_with_index
.
map
do
|
label
,
i
|
label
.
name
unless
i
>=
max_labels
end
if
label_size
>
max_labels
label_names
<<
"and
#{
label_size
-
max_labels
}
more"
end
label_names
.
compact
.
join
(
', '
)
end
private
private
def
sidebar_gutter_collapsed?
def
sidebar_gutter_collapsed?
...
...
app/views/shared/issuable/_sidebar.html.haml
View file @
931274ba
...
@@ -109,7 +109,7 @@
...
@@ -109,7 +109,7 @@
-
if
issuable
.
project
.
labels
.
any?
-
if
issuable
.
project
.
labels
.
any?
.block.labels
.block.labels
.sidebar-collapsed-icon
.sidebar-collapsed-icon
.js-sidebar-labels-tooltip
{
title:
issuable_labels_tooltip
(
issuable
.
labels_array
),
data:
{
placement:
"left"
,
container:
"body"
}
}
=
icon
(
'tags'
)
=
icon
(
'tags'
)
%span
%span
=
issuable
.
labels_array
.
size
=
issuable
.
labels_array
.
size
...
...
spec/features/issues/issue_sidebar_spec.rb
View file @
931274ba
...
@@ -73,6 +73,44 @@ feature 'Issue Sidebar', feature: true do
...
@@ -73,6 +73,44 @@ feature 'Issue Sidebar', feature: true do
end
end
end
end
context
'update labels'
,
js:
true
do
before
do
project
.
team
<<
[
user
,
:developer
]
visit_issue
(
project
,
issue
)
end
context
'more than 5'
do
before
do
create
(
:label
,
project:
project
,
title:
'a'
)
create
(
:label
,
project:
project
,
title:
'b'
)
create
(
:label
,
project:
project
,
title:
'c'
)
create
(
:label
,
project:
project
,
title:
'd'
)
create
(
:label
,
project:
project
,
title:
'e'
)
create
(
:label
,
project:
project
,
title:
'f'
)
end
it
'should update the tooltip for collapsed sidebar'
do
page
.
within
(
'.block.labels'
)
do
find
(
'.edit-link'
).
click
page
.
within
(
'.dropdown-menu-labels'
)
do
click_link
'a'
click_link
'b'
click_link
'c'
click_link
'd'
click_link
'e'
click_link
'f'
end
find
(
'.edit-link'
).
click
sleep
1
expect
(
find
(
'.js-sidebar-labels-tooltip'
,
visible:
false
)[
'data-original-title'
]).
to
eq
(
'a, b, c, d, e, and 1 more'
)
end
end
end
end
def
visit_issue
(
project
,
issue
)
def
visit_issue
(
project
,
issue
)
visit
namespace_project_issue_path
(
project
.
namespace
,
project
,
issue
)
visit
namespace_project_issue_path
(
project
.
namespace
,
project
,
issue
)
end
end
...
...
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