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
Boxiang Sun
gitlab-ce
Commits
20408363
Commit
20408363
authored
Oct 04, 2016
by
Fatih Acet
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix dropdown title when No Label selected.
parent
88857a2c
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
41 additions
and
23 deletions
+41
-23
app/assets/javascripts/labels_select.js
app/assets/javascripts/labels_select.js
+40
-21
app/assets/javascripts/milestone_select.js
app/assets/javascripts/milestone_select.js
+1
-2
No files found.
app/assets/javascripts/labels_select.js
View file @
20408363
...
@@ -79,7 +79,8 @@
...
@@ -79,7 +79,8 @@
if
(
data
.
labels
.
length
)
{
if
(
data
.
labels
.
length
)
{
template
=
labelHTMLTemplate
(
data
);
template
=
labelHTMLTemplate
(
data
);
labelCount
=
data
.
labels
.
length
;
labelCount
=
data
.
labels
.
length
;
}
else
{
}
else
{
template
=
labelNoneHTMLTemplate
;
template
=
labelNoneHTMLTemplate
;
}
}
$value
.
removeAttr
(
'
style
'
).
html
(
template
);
$value
.
removeAttr
(
'
style
'
).
html
(
template
);
...
@@ -96,7 +97,8 @@
...
@@ -96,7 +97,8 @@
}
}
labelTooltipTitle
=
labelTitles
.
join
(
'
,
'
);
labelTooltipTitle
=
labelTitles
.
join
(
'
,
'
);
}
else
{
}
else
{
labelTooltipTitle
=
''
;
labelTooltipTitle
=
''
;
$sidebarLabelTooltip
.
tooltip
(
'
destroy
'
);
$sidebarLabelTooltip
.
tooltip
(
'
destroy
'
);
}
}
...
@@ -200,14 +202,16 @@
...
@@ -200,14 +202,16 @@
return
color
+
"
"
+
percentFirst
+
"
%,
"
+
color
+
"
"
+
percentSecond
+
"
%
"
;
return
color
+
"
"
+
percentFirst
+
"
%,
"
+
color
+
"
"
+
percentSecond
+
"
%
"
;
}).
join
(
'
,
'
);
}).
join
(
'
,
'
);
color
=
"
linear-gradient(
"
+
color
+
"
)
"
;
color
=
"
linear-gradient(
"
+
color
+
"
)
"
;
}
else
{
}
else
{
if
(
label
.
color
!=
null
)
{
if
(
label
.
color
!=
null
)
{
color
=
label
.
color
[
0
];
color
=
label
.
color
[
0
];
}
}
}
}
if
(
color
)
{
if
(
color
)
{
colorEl
=
"
<span class='dropdown-label-box' style='background:
"
+
color
+
"
'></span>
"
;
colorEl
=
"
<span class='dropdown-label-box' style='background:
"
+
color
+
"
'></span>
"
;
}
else
{
}
else
{
colorEl
=
''
;
colorEl
=
''
;
}
}
// We need to identify which items are actually labels
// We need to identify which items are actually labels
...
@@ -227,23 +231,29 @@
...
@@ -227,23 +231,29 @@
filterable
:
true
,
filterable
:
true
,
selected
:
$dropdown
.
data
(
'
selected
'
)
||
[],
selected
:
$dropdown
.
data
(
'
selected
'
)
||
[],
toggleLabel
:
function
(
selected
,
el
)
{
toggleLabel
:
function
(
selected
,
el
)
{
var
isSelected
=
el
!==
null
?
el
.
hasClass
(
'
is-active
'
)
:
false
,
var
isSelected
=
el
!==
null
?
el
.
hasClass
(
'
is-active
'
)
:
false
;
title
=
selected
.
title
;
var
title
=
selected
.
title
;
var
selectedLabels
=
this
.
selected
;
if
(
isSelected
)
{
if
(
selected
.
id
===
0
)
{
this
.
selected
=
[];
return
'
No Label
'
;
}
else
if
(
isSelected
)
{
this
.
selected
.
push
(
title
);
this
.
selected
.
push
(
title
);
}
else
{
}
else
{
var
index
=
this
.
selected
.
indexOf
(
title
);
var
index
=
this
.
selected
.
indexOf
(
title
);
this
.
selected
.
splice
(
index
,
1
);
this
.
selected
.
splice
(
index
,
1
);
}
}
var
selectedLabels
=
this
.
selected
;
if
(
selectedLabels
.
length
===
1
)
{
if
(
selectedLabels
.
length
===
1
)
{
return
selectedLabels
;
return
selectedLabels
;
}
else
if
(
selectedLabels
.
length
>
1
)
{
}
else
if
(
selectedLabels
.
length
)
{
return
selectedLabels
[
0
]
+
"
+
"
+
(
selectedLabels
.
length
-
1
)
+
"
more
"
;
return
selectedLabels
[
0
]
+
"
+
"
+
(
selectedLabels
.
length
-
1
)
+
"
more
"
;
}
else
{
}
else
{
return
defaultLabel
;
return
defaultLabel
;
}
}
},
},
...
@@ -257,7 +267,8 @@
...
@@ -257,7 +267,8 @@
if
(
$dropdown
.
hasClass
(
"
js-filter-submit
"
)
&&
(
label
.
isAny
==
null
))
{
if
(
$dropdown
.
hasClass
(
"
js-filter-submit
"
)
&&
(
label
.
isAny
==
null
))
{
return
label
.
title
;
return
label
.
title
;
}
else
{
}
else
{
return
label
.
id
;
return
label
.
id
;
}
}
},
},
...
@@ -281,9 +292,11 @@
...
@@ -281,9 +292,11 @@
if
(
$dropdown
.
hasClass
(
'
js-filter-submit
'
)
&&
(
isIssueIndex
||
isMRIndex
))
{
if
(
$dropdown
.
hasClass
(
'
js-filter-submit
'
)
&&
(
isIssueIndex
||
isMRIndex
))
{
selectedLabels
=
$dropdown
.
closest
(
'
form
'
).
find
(
"
input:hidden[name='
"
+
(
$dropdown
.
data
(
'
fieldName
'
))
+
"
']
"
);
selectedLabels
=
$dropdown
.
closest
(
'
form
'
).
find
(
"
input:hidden[name='
"
+
(
$dropdown
.
data
(
'
fieldName
'
))
+
"
']
"
);
Issuable
.
filterResults
(
$dropdown
.
closest
(
'
form
'
));
Issuable
.
filterResults
(
$dropdown
.
closest
(
'
form
'
));
}
else
if
(
$dropdown
.
hasClass
(
'
js-filter-submit
'
))
{
}
else
if
(
$dropdown
.
hasClass
(
'
js-filter-submit
'
))
{
$dropdown
.
closest
(
'
form
'
).
submit
();
$dropdown
.
closest
(
'
form
'
).
submit
();
}
else
{
}
else
{
if
(
!
$dropdown
.
hasClass
(
'
js-filter-bulk-update
'
))
{
if
(
!
$dropdown
.
hasClass
(
'
js-filter-bulk-update
'
))
{
saveLabelData
();
saveLabelData
();
}
}
...
@@ -317,9 +330,11 @@
...
@@ -317,9 +330,11 @@
if
(
page
===
'
projects:boards:show
'
)
{
if
(
page
===
'
projects:boards:show
'
)
{
if
(
label
.
isAny
)
{
if
(
label
.
isAny
)
{
gl
.
issueBoards
.
BoardsStore
.
state
.
filters
[
'
label_name
'
]
=
[];
gl
.
issueBoards
.
BoardsStore
.
state
.
filters
[
'
label_name
'
]
=
[];
}
else
if
(
$el
.
hasClass
(
'
is-active
'
))
{
}
else
if
(
$el
.
hasClass
(
'
is-active
'
))
{
gl
.
issueBoards
.
BoardsStore
.
state
.
filters
[
'
label_name
'
].
push
(
label
.
title
);
gl
.
issueBoards
.
BoardsStore
.
state
.
filters
[
'
label_name
'
].
push
(
label
.
title
);
}
else
{
}
else
{
var
filters
=
gl
.
issueBoards
.
BoardsStore
.
state
.
filters
[
'
label_name
'
];
var
filters
=
gl
.
issueBoards
.
BoardsStore
.
state
.
filters
[
'
label_name
'
];
filters
=
filters
.
filter
(
function
(
filteredLabel
)
{
filters
=
filters
.
filter
(
function
(
filteredLabel
)
{
return
filteredLabel
!==
label
.
title
;
return
filteredLabel
!==
label
.
title
;
...
@@ -330,17 +345,21 @@
...
@@ -330,17 +345,21 @@
gl
.
issueBoards
.
BoardsStore
.
updateFiltersUrl
();
gl
.
issueBoards
.
BoardsStore
.
updateFiltersUrl
();
e
.
preventDefault
();
e
.
preventDefault
();
return
;
return
;
}
else
if
(
$dropdown
.
hasClass
(
'
js-filter-submit
'
)
&&
(
isIssueIndex
||
isMRIndex
))
{
}
else
if
(
$dropdown
.
hasClass
(
'
js-filter-submit
'
)
&&
(
isIssueIndex
||
isMRIndex
))
{
if
(
!
$dropdown
.
hasClass
(
'
js-multiselect
'
))
{
if
(
!
$dropdown
.
hasClass
(
'
js-multiselect
'
))
{
selectedLabel
=
label
.
title
;
selectedLabel
=
label
.
title
;
return
Issuable
.
filterResults
(
$dropdown
.
closest
(
'
form
'
));
return
Issuable
.
filterResults
(
$dropdown
.
closest
(
'
form
'
));
}
}
}
else
if
(
$dropdown
.
hasClass
(
'
js-filter-submit
'
))
{
}
else
if
(
$dropdown
.
hasClass
(
'
js-filter-submit
'
))
{
return
$dropdown
.
closest
(
'
form
'
).
submit
();
return
$dropdown
.
closest
(
'
form
'
).
submit
();
}
else
{
}
else
{
if
(
$dropdown
.
hasClass
(
'
js-multiselect
'
))
{
if
(
$dropdown
.
hasClass
(
'
js-multiselect
'
))
{
}
else
{
}
else
{
return
saveLabelData
();
return
saveLabelData
();
}
}
}
}
...
...
app/assets/javascripts/milestone_select.js
View file @
20408363
...
@@ -35,8 +35,7 @@
...
@@ -35,8 +35,7 @@
return
$
.
ajax
({
return
$
.
ajax
({
url
:
milestonesUrl
url
:
milestonesUrl
}).
done
(
function
(
data
)
{
}).
done
(
function
(
data
)
{
var
extraOptions
;
var
extraOptions
=
[];
extraOptions
=
[];
if
(
showAny
)
{
if
(
showAny
)
{
extraOptions
.
push
({
extraOptions
.
push
({
id
:
0
,
id
:
0
,
...
...
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