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
e8d52499
Commit
e8d52499
authored
Mar 18, 2016
by
Phil Hughes
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixed some CS styling issues
Fixed bug where wouldn't work on MR index
parent
16d02de5
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
85 additions
and
74 deletions
+85
-74
app/assets/javascripts/issues.js.coffee
app/assets/javascripts/issues.js.coffee
+11
-9
app/assets/javascripts/labels_select.js.coffee
app/assets/javascripts/labels_select.js.coffee
+33
-30
app/assets/javascripts/milestone_select.js.coffee
app/assets/javascripts/milestone_select.js.coffee
+22
-19
app/assets/javascripts/users_select.js.coffee
app/assets/javascripts/users_select.js.coffee
+19
-16
No files found.
app/assets/javascripts/issues.js.coffee
View file @
e8d52499
...
@@ -46,21 +46,23 @@
...
@@ -46,21 +46,23 @@
,
500
)
,
500
)
filterResults
:
(
form
)
=>
filterResults
:
(
form
)
=>
$
(
'.issues-holder'
).
css
(
"opacity"
,
'0.5'
)
$
(
'.issues-holder, .merge-requests-holder'
).
css
(
"opacity"
,
'0.5'
)
form_action
=
form
.
attr
(
'action'
)
formAction
=
form
.
attr
(
'action'
)
form_data
=
form
.
serialize
()
formData
=
form
.
serialize
()
issues_url
=
form_action
+
(
"
#{
if
form_action
.
indexOf
(
"?"
)
<
0
then
'?'
else
'&'
}
"
)
+
form_data
issuesUrl
=
formAction
issuesUrl
+=
(
"
#{
if
formAction
.
indexOf
(
"?"
)
<
0
then
'?'
else
'&'
}
"
)
issuesUrl
+=
formData
$
.
ajax
$
.
ajax
type
:
"GET"
type
:
"GET"
url
:
form
_a
ction
url
:
form
A
ction
data
:
form
_d
ata
data
:
form
D
ata
complete
:
->
complete
:
->
$
(
'.issues-holder'
).
css
(
"opacity"
,
'1.0'
)
$
(
'.issues-holder
, .merge-requests-holder
'
).
css
(
"opacity"
,
'1.0'
)
success
:
(
data
)
->
success
:
(
data
)
->
$
(
'.issues-holder'
).
html
(
data
.
html
)
$
(
'.issues-holder
, .merge-requests-holder
'
).
html
(
data
.
html
)
# Change url so if user reload a page - search results are saved
# Change url so if user reload a page - search results are saved
history
.
replaceState
{
page
:
issues
_url
},
document
.
title
,
issues_u
rl
history
.
replaceState
{
page
:
issues
Url
},
document
.
title
,
issuesU
rl
Issues
.
reload
()
Issues
.
reload
()
dataType
:
"json"
dataType
:
"json"
...
...
app/assets/javascripts/labels_select.js.coffee
View file @
e8d52499
class
@
LabelsSelect
class
@
LabelsSelect
constructor
:
->
constructor
:
->
$
(
'.js-label-select'
).
each
(
i
,
dropdown
)
->
$
(
'.js-label-select'
).
each
(
i
,
dropdown
)
->
projectId
=
$
(
dropdown
).
data
(
'project-id'
)
$dropdown
=
$
(
dropdown
)
labelUrl
=
$
(
dropdown
).
data
(
"labels"
)
projectId
=
$dropdown
.
data
(
'project-id'
)
selectedLabel
=
$
(
dropdown
).
data
(
'selected'
)
labelUrl
=
$dropdown
.
data
(
'labels'
)
selectedLabel
=
$dropdown
.
data
(
'selected'
)
if
selectedLabel
if
selectedLabel
selectedLabel
=
selectedLabel
.
split
(
","
)
selectedLabel
=
selectedLabel
.
split
(
','
)
newLabelField
=
$
(
'#new_label_name'
)
newLabelField
=
$
(
'#new_label_name'
)
newColorField
=
$
(
'#new_label_color'
)
newColorField
=
$
(
'#new_label_color'
)
showNo
=
$
(
dropdown
)
.
data
(
'show-no'
)
showNo
=
$
dropdown
.
data
(
'show-no'
)
showAny
=
$
(
dropdown
)
.
data
(
'show-any'
)
showAny
=
$
dropdown
.
data
(
'show-any'
)
defaultLabel
=
$
(
dropdown
)
.
text
().
trim
()
defaultLabel
=
$
dropdown
.
text
().
trim
()
if
newLabelField
.
length
if
newLabelField
.
length
$
(
'.suggest-colors-dropdown a'
).
on
"click"
,
(
e
)
->
$
(
'.suggest-colors-dropdown a'
).
on
'click'
,
(
e
)
->
e
.
preventDefault
()
e
.
preventDefault
()
e
.
stopPropagation
()
e
.
stopPropagation
()
newColorField
.
val
$
(
this
).
data
(
"color"
)
newColorField
.
val
$
(
this
).
data
(
'color'
)
$
(
'.js-dropdown-label-color-preview'
)
$
(
'.js-dropdown-label-color-preview'
)
.
css
'background-color'
,
$
(
this
).
data
(
"color"
)
.
css
'background-color'
,
$
(
this
).
data
(
'color'
)
.
addClass
'is-active'
.
addClass
'is-active'
$
(
'.js-new-label-btn'
).
on
"click"
,
(
e
)
->
$
(
'.js-new-label-btn'
).
on
'click'
,
(
e
)
->
e
.
preventDefault
()
e
.
preventDefault
()
e
.
stopPropagation
()
e
.
stopPropagation
()
if
newLabelField
.
val
()
isnt
""
&&
newColorField
.
val
()
isnt
""
if
newLabelField
.
val
()
isnt
''
and
newColorField
.
val
()
isnt
''
$
(
'.js-new-label-btn'
).
disable
()
$
(
'.js-new-label-btn'
).
disable
()
# Create new label with API
# Create new label with API
...
@@ -34,9 +35,9 @@ class @LabelsSelect
...
@@ -34,9 +35,9 @@ class @LabelsSelect
color
:
newColorField
.
val
()
color
:
newColorField
.
val
()
},
(
label
)
->
},
(
label
)
->
$
(
'.js-new-label-btn'
).
enable
()
$
(
'.js-new-label-btn'
).
enable
()
$
(
'.dropdown-menu-back'
,
$
(
dropdown
).
parent
()).
trigger
"click"
$
(
'.dropdown-menu-back'
,
$
dropdown
.
parent
()).
trigger
'click'
$
(
dropdown
)
.
glDropdown
(
$
dropdown
.
glDropdown
(
data
:
(
term
,
callback
)
->
data
:
(
term
,
callback
)
->
# We have to fetch the JS version of the labels list because there is no
# We have to fetch the JS version of the labels list because there is no
# public facing JSON url for labels
# public facing JSON url for labels
...
@@ -58,23 +59,23 @@ class @LabelsSelect
...
@@ -58,23 +59,23 @@ class @LabelsSelect
if
showAny
if
showAny
data
.
unshift
(
data
.
unshift
(
a
ny
:
true
isA
ny
:
true
title
:
'Any Label'
title
:
'Any Label'
)
)
if
data
.
length
>
2
if
data
.
length
>
2
data
.
splice
2
,
0
,
"divider"
data
.
splice
2
,
0
,
'divider'
callback
data
callback
data
renderRow
:
(
label
)
->
renderRow
:
(
label
)
->
if
$
.
isArray
(
selectedLabel
)
if
$
.
isArray
(
selectedLabel
)
selected
=
""
selected
=
''
$
.
each
selectedLabel
,
(
i
,
selectedLbl
)
->
$
.
each
selectedLabel
,
(
i
,
selectedLbl
)
->
selectedLbl
=
selectedLbl
.
trim
()
selectedLbl
=
selectedLbl
.
trim
()
if
selected
is
""
&&
label
.
title
is
selectedLbl
if
selected
is
''
and
label
.
title
is
selectedLbl
selected
=
"is-active"
selected
=
'is-active'
else
else
selected
=
if
label
.
title
is
selectedLabel
then
"is-active"
else
""
selected
=
if
label
.
title
is
selectedLabel
then
'is-active'
else
''
"<li>
"<li>
<a href='#' class='
#{
selected
}
'>
<a href='#' class='
#{
selected
}
'>
...
@@ -86,21 +87,23 @@ class @LabelsSelect
...
@@ -86,21 +87,23 @@ class @LabelsSelect
fields
:
[
'title'
]
fields
:
[
'title'
]
selectable
:
true
selectable
:
true
toggleLabel
:
(
selected
)
->
toggleLabel
:
(
selected
)
->
if
selected
&&
selected
.
title
isnt
"Any Label"
if
selected
and
selected
.
title
isnt
'Any Label'
selected
.
title
selected
.
title
else
else
defaultLabel
defaultLabel
fieldName
:
$
(
dropdown
)
.
data
(
'field-name'
)
fieldName
:
$
dropdown
.
data
(
'field-name'
)
id
:
(
label
)
->
id
:
(
label
)
->
if
label
.
a
ny
?
if
label
.
isA
ny
?
""
''
else
else
label
.
title
label
.
title
clicked
:
->
clicked
:
->
page
=
$
(
"body"
).
data
"page"
page
=
$
(
'body'
).
data
'page'
isIssueIndex
=
page
is
'projects:issues:index'
isMRIndex
=
page
is
page
is
'projects:merge_requests:index'
if
$
(
dropdown
).
hasClass
(
"js-filter-submit"
)
&&
page
is
"projects:issues:index"
if
$
dropdown
.
hasClass
(
'js-filter-submit'
)
and
(
isIssueIndex
or
isMRIndex
)
Issues
.
filterResults
$
(
dropdown
).
parents
(
"form"
)
Issues
.
filterResults
$
dropdown
.
closest
(
'form'
)
else
if
$
(
dropdown
).
hasClass
"js-filter-submit"
else
if
$
dropdown
.
hasClass
'js-filter-submit'
$
(
dropdown
).
parents
(
"form"
).
submit
()
$
dropdown
.
closest
(
'form'
).
submit
()
)
)
app/assets/javascripts/milestone_select.js.coffee
View file @
e8d52499
class
@
MilestoneSelect
class
@
MilestoneSelect
constructor
:
->
constructor
:
->
$
(
'.js-milestone-select'
).
each
(
i
,
dropdown
)
->
$
(
'.js-milestone-select'
).
each
(
i
,
dropdown
)
->
projectId
=
$
(
dropdown
).
data
(
'project-id'
)
$dropdown
=
$
(
dropdown
)
milestonesUrl
=
$
(
dropdown
).
data
(
'milestones'
)
projectId
=
$dropdown
.
data
(
'project-id'
)
selectedMilestone
=
$
(
dropdown
).
data
(
'selected'
)
milestonesUrl
=
$dropdown
.
data
(
'milestones'
)
showNo
=
$
(
dropdown
).
data
(
'show-no'
)
selectedMilestone
=
$dropdown
.
data
(
'selected'
)
showAny
=
$
(
dropdown
).
data
(
'show-any'
)
showNo
=
$dropdown
.
data
(
'show-no'
)
useId
=
$
(
dropdown
).
data
(
'use-id'
)
showAny
=
$dropdown
.
data
(
'show-any'
)
defaultLabel
=
$
(
dropdown
).
text
().
trim
()
useId
=
$dropdown
.
data
(
'use-id'
)
defaultLabel
=
$dropdown
.
text
().
trim
()
$
(
dropdown
)
.
glDropdown
(
$
dropdown
.
glDropdown
(
data
:
(
term
,
callback
)
->
data
:
(
term
,
callback
)
->
$
.
ajax
(
$
.
ajax
(
url
:
milestonesUrl
url
:
milestonesUrl
...
@@ -17,7 +18,7 @@ class @MilestoneSelect
...
@@ -17,7 +18,7 @@ class @MilestoneSelect
html
=
$
(
data
)
html
=
$
(
data
)
data
=
[]
data
=
[]
html
.
find
(
'.milestone strong a'
).
each
->
html
.
find
(
'.milestone strong a'
).
each
->
link
=
$
(
@
).
attr
(
"href"
).
split
(
"/"
)
link
=
$
(
@
).
attr
(
'href'
).
split
(
'/'
)
data
.
push
(
data
.
push
(
id
:
link
[
link
.
length
-
1
]
id
:
link
[
link
.
length
-
1
]
title
:
$
(
@
).
text
().
trim
()
title
:
$
(
@
).
text
().
trim
()
...
@@ -25,7 +26,7 @@ class @MilestoneSelect
...
@@ -25,7 +26,7 @@ class @MilestoneSelect
if
showNo
if
showNo
data
.
unshift
(
data
.
unshift
(
id
:
"0"
id
:
'0'
title
:
'No Milestone'
title
:
'No Milestone'
)
)
...
@@ -36,7 +37,7 @@ class @MilestoneSelect
...
@@ -36,7 +37,7 @@ class @MilestoneSelect
)
)
if
data
.
length
>
2
if
data
.
length
>
2
data
.
splice
2
,
0
,
"divider"
data
.
splice
2
,
0
,
'divider'
callback
(
data
)
callback
(
data
)
filterable
:
true
filterable
:
true
...
@@ -44,11 +45,11 @@ class @MilestoneSelect
...
@@ -44,11 +45,11 @@ class @MilestoneSelect
fields
:
[
'title'
]
fields
:
[
'title'
]
selectable
:
true
selectable
:
true
toggleLabel
:
(
selected
)
->
toggleLabel
:
(
selected
)
->
if
selected
&&
selected
.
i
d
if
selected
&&
'id'
of
selecte
d
selected
.
title
selected
.
title
else
else
defaultLabel
defaultLabel
fieldName
:
$
(
dropdown
)
.
data
(
'field-name'
)
fieldName
:
$
dropdown
.
data
(
'field-name'
)
text
:
(
milestone
)
->
text
:
(
milestone
)
->
milestone
.
title
milestone
.
title
id
:
(
milestone
)
->
id
:
(
milestone
)
->
...
@@ -56,16 +57,18 @@ class @MilestoneSelect
...
@@ -56,16 +57,18 @@ class @MilestoneSelect
if
!
milestone
.
isAny
?
if
!
milestone
.
isAny
?
milestone
.
title
milestone
.
title
else
else
""
''
else
else
milestone
.
id
milestone
.
id
isSelected
:
(
milestone
)
->
isSelected
:
(
milestone
)
->
milestone
.
title
is
selectedMilestone
milestone
.
title
is
selectedMilestone
clicked
:
->
clicked
:
->
page
=
$
(
"body"
).
data
"page"
page
=
$
(
'body'
).
data
'page'
isIssueIndex
=
page
is
'projects:issues:index'
isMRIndex
=
page
is
page
is
'projects:merge_requests:index'
if
$
(
dropdown
).
hasClass
(
"js-filter-submit"
)
&&
page
is
"projects:issues:index"
if
$
dropdown
.
hasClass
(
'js-filter-submit'
)
and
(
isIssueIndex
or
isMRIndex
)
Issues
.
filterResults
$
(
dropdown
).
parents
(
"form"
)
Issues
.
filterResults
$
dropdown
.
closest
(
'form'
)
else
if
$
(
dropdown
).
hasClass
"js-filter-submit"
else
if
$
dropdown
.
hasClass
'js-filter-submit'
$
(
dropdown
).
parents
(
"form"
).
submit
()
$
dropdown
.
closest
(
'form'
).
submit
()
)
)
app/assets/javascripts/users_select.js.coffee
View file @
e8d52499
...
@@ -4,15 +4,16 @@ class @UsersSelect
...
@@ -4,15 +4,16 @@ class @UsersSelect
@
userPath
=
"/autocomplete/users/:id.json"
@
userPath
=
"/autocomplete/users/:id.json"
$
(
'.js-user-search'
).
each
(
i
,
dropdown
)
=>
$
(
'.js-user-search'
).
each
(
i
,
dropdown
)
=>
@
projectId
=
$
(
dropdown
).
data
(
'project-id'
)
$dropdown
=
$
(
dropdown
)
@
showCurrentUser
=
$
(
dropdown
).
data
(
'current-user'
)
@
projectId
=
$dropdown
.
data
(
'project-id'
)
showNullUser
=
$
(
dropdown
).
data
(
'null-user'
)
@
showCurrentUser
=
$dropdown
.
data
(
'current-user'
)
showAnyUser
=
$
(
dropdown
).
data
(
'any-user'
)
showNullUser
=
$dropdown
.
data
(
'null-user'
)
firstUser
=
$
(
dropdown
).
data
(
'first-user'
)
showAnyUser
=
$dropdown
.
data
(
'any-user'
)
selectedId
=
$
(
dropdown
).
data
(
'selected'
)
firstUser
=
$dropdown
.
data
(
'first-user'
)
defaultLabel
=
$
(
dropdown
).
text
().
trim
()
selectedId
=
$dropdown
.
data
(
'selected'
)
defaultLabel
=
$dropdown
.
text
().
trim
()
$
(
dropdown
).
glDropdown
(
$dropdown
.
glDropdown
(
data
:
(
term
,
callback
)
=>
data
:
(
term
,
callback
)
=>
@
users
term
,
(
users
)
=>
@
users
term
,
(
users
)
=>
if
term
.
length
is
0
if
term
.
length
is
0
...
@@ -53,19 +54,21 @@ class @UsersSelect
...
@@ -53,19 +54,21 @@ class @UsersSelect
search
:
search
:
fields
:
[
'name'
,
'username'
]
fields
:
[
'name'
,
'username'
]
selectable
:
true
selectable
:
true
fieldName
:
$
(
dropdown
)
.
data
(
'field-name'
)
fieldName
:
$
dropdown
.
data
(
'field-name'
)
toggleLabel
:
(
selected
)
->
toggleLabel
:
(
selected
)
->
if
selected
&&
selected
.
id
?
if
selected
&&
selected
.
id
?
selected
.
name
selected
.
name
else
else
defaultLabel
defaultLabel
clicked
:
->
clicked
:
->
page
=
$
(
"body"
).
data
"page"
page
=
$
(
'body'
).
data
'page'
isIssueIndex
=
page
is
'projects:issues:index'
if
$
(
dropdown
).
hasClass
(
"js-filter-submit"
)
&&
page
is
"projects:issues:index"
isMRIndex
=
page
is
page
is
'projects:merge_requests:index'
Issues
.
filterResults
$
(
dropdown
).
parents
(
"form"
)
else
if
$
(
dropdown
).
hasClass
"js-filter-submit"
if
$dropdown
.
hasClass
(
'js-filter-submit'
)
and
(
isIssueIndex
or
isMRIndex
)
$
(
dropdown
).
parents
(
"form"
).
submit
()
Issues
.
filterResults
$dropdown
.
closest
(
'form'
)
else
if
$dropdown
.
hasClass
'js-filter-submit'
$dropdown
.
closest
(
'form'
).
submit
()
renderRow
:
(
user
)
->
renderRow
:
(
user
)
->
username
=
if
user
.
username
then
"@
#{
user
.
username
}
"
else
""
username
=
if
user
.
username
then
"@
#{
user
.
username
}
"
else
""
avatar
=
if
user
.
avatar_url
then
user
.
avatar_url
else
false
avatar
=
if
user
.
avatar_url
then
user
.
avatar_url
else
false
...
...
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