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
dd35de1a
Commit
dd35de1a
authored
Mar 08, 2016
by
Phil Hughes
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Uses a publicly facing URL so that it allows labels & milestones to be visible when not logged in
parent
730af552
Changes
5
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
40 additions
and
40 deletions
+40
-40
app/assets/javascripts/api.js.coffee
app/assets/javascripts/api.js.coffee
+0
-26
app/assets/javascripts/gl_dropdown.js.coffee
app/assets/javascripts/gl_dropdown.js.coffee
+0
-1
app/assets/javascripts/labels_select.js.coffee
app/assets/javascripts/labels_select.js.coffee
+17
-4
app/assets/javascripts/milestone_select.js.coffee
app/assets/javascripts/milestone_select.js.coffee
+20
-6
app/views/shared/issuable/_filter.html.haml
app/views/shared/issuable/_filter.html.haml
+3
-3
No files found.
app/assets/javascripts/api.js.coffee
View file @
dd35de1a
...
@@ -5,7 +5,6 @@
...
@@ -5,7 +5,6 @@
group_projects_path
:
"/api/:version/groups/:id/projects.json"
group_projects_path
:
"/api/:version/groups/:id/projects.json"
projects_path
:
"/api/:version/projects.json"
projects_path
:
"/api/:version/projects.json"
labels_path
:
"/api/:version/projects/:id/labels"
labels_path
:
"/api/:version/projects/:id/labels"
milestones_path
:
"/api/:version/projects/:id/milestones"
group
:
(
group_id
,
callback
)
->
group
:
(
group_id
,
callback
)
->
url
=
Api
.
buildUrl
(
Api
.
group_path
)
url
=
Api
.
buildUrl
(
Api
.
group_path
)
...
@@ -63,18 +62,6 @@
...
@@ -63,18 +62,6 @@
).
done
(
projects
)
->
).
done
(
projects
)
->
callback
(
projects
)
callback
(
projects
)
projectLabels
:
(
project_id
,
callback
)
->
url
=
Api
.
buildUrl
(
Api
.
labels_path
)
url
=
url
.
replace
(
':id'
,
project_id
)
$
.
ajax
(
url
:
url
data
:
private_token
:
gon
.
api_token
dataType
:
"json"
).
done
(
labels
)
->
callback
(
labels
)
newLabel
:
(
project_id
,
data
,
callback
)
->
newLabel
:
(
project_id
,
data
,
callback
)
->
url
=
Api
.
buildUrl
(
Api
.
labels_path
)
url
=
Api
.
buildUrl
(
Api
.
labels_path
)
url
=
url
.
replace
(
':id'
,
project_id
)
url
=
url
.
replace
(
':id'
,
project_id
)
...
@@ -88,19 +75,6 @@
...
@@ -88,19 +75,6 @@
).
done
(
label
)
->
).
done
(
label
)
->
callback
(
label
)
callback
(
label
)
milestones
:
(
project_id
,
callback
)
->
url
=
Api
.
buildUrl
(
Api
.
milestones_path
)
url
=
url
.
replace
(
':id'
,
project_id
)
$
.
ajax
(
url
:
url
data
:
private_token
:
gon
.
api_token
dataType
:
"json"
).
done
(
milestones
)
->
callback
(
milestones
)
# Return group projects list. Filtered by query
# Return group projects list. Filtered by query
groupProjects
:
(
group_id
,
query
,
callback
)
->
groupProjects
:
(
group_id
,
query
,
callback
)
->
url
=
Api
.
buildUrl
(
Api
.
group_projects_path
)
url
=
Api
.
buildUrl
(
Api
.
group_projects_path
)
...
...
app/assets/javascripts/gl_dropdown.js.coffee
View file @
dd35de1a
...
@@ -220,7 +220,6 @@ class GitLabDropdown
...
@@ -220,7 +220,6 @@ class GitLabDropdown
if
@
renderedData
if
@
renderedData
selectedObject
=
@
renderedData
[
selectedIndex
]
selectedObject
=
@
renderedData
[
selectedIndex
]
value
=
if
@
options
.
id
then
@
options
.
id
(
selectedObject
,
el
)
else
selectedObject
.
id
value
=
if
@
options
.
id
then
@
options
.
id
(
selectedObject
,
el
)
else
selectedObject
.
id
console
.
log
value
if
@
options
.
multiSelect
if
@
options
.
multiSelect
fieldName
=
"
#{
fieldName
}
[]"
fieldName
=
"
#{
fieldName
}
[]"
...
...
app/assets/javascripts/labels_select.js.coffee
View file @
dd35de1a
...
@@ -2,6 +2,7 @@ class @LabelsSelect
...
@@ -2,6 +2,7 @@ class @LabelsSelect
constructor
:
->
constructor
:
->
$
(
'.js-label-select'
).
each
(
i
,
dropdown
)
->
$
(
'.js-label-select'
).
each
(
i
,
dropdown
)
->
projectId
=
$
(
dropdown
).
data
(
'project-id'
)
projectId
=
$
(
dropdown
).
data
(
'project-id'
)
labelUrl
=
$
(
dropdown
).
data
(
"labels"
)
selectedLabel
=
$
(
dropdown
).
data
(
'selected'
)
selectedLabel
=
$
(
dropdown
).
data
(
'selected'
)
newLabelField
=
$
(
'#new_label_name'
)
newLabelField
=
$
(
'#new_label_name'
)
newColorField
=
$
(
'#new_label_color'
)
newColorField
=
$
(
'#new_label_color'
)
...
@@ -32,13 +33,25 @@ class @LabelsSelect
...
@@ -32,13 +33,25 @@ class @LabelsSelect
$
(
dropdown
).
glDropdown
(
$
(
dropdown
).
glDropdown
(
data
:
(
term
,
callback
)
->
data
:
(
term
,
callback
)
->
Api
.
projectLabels
8
,
callback
# We have to fetch the JS version of the labels list because there is no
# public facing JSON url for labels
$
.
ajax
(
url
:
labelUrl
).
done
(
data
)
->
html
=
$
(
data
)
data
=
[]
html
.
find
(
'.label-row a'
).
each
->
data
.
push
(
title
:
$
(
@
).
text
().
trim
()
)
callback
data
renderRow
:
(
label
)
->
renderRow
:
(
label
)
->
selected
=
if
label
.
nam
e
is
selectedLabel
then
"is-active"
else
""
selected
=
if
label
.
titl
e
is
selectedLabel
then
"is-active"
else
""
"<li>
"<li>
<a href='#' class='
#{
selected
}
'>
<a href='#' class='
#{
selected
}
'>
#{
label
.
nam
e
}
#{
label
.
titl
e
}
</a>
</a>
</li>"
</li>"
filterable
:
true
filterable
:
true
...
@@ -47,7 +60,7 @@ class @LabelsSelect
...
@@ -47,7 +60,7 @@ class @LabelsSelect
selectable
:
true
selectable
:
true
fieldName
:
$
(
dropdown
).
data
(
'field-name'
)
fieldName
:
$
(
dropdown
).
data
(
'field-name'
)
id
:
(
label
)
->
id
:
(
label
)
->
label
.
nam
e
label
.
titl
e
clicked
:
->
clicked
:
->
if
$
(
dropdown
).
hasClass
"js-filter-submit"
if
$
(
dropdown
).
hasClass
"js-filter-submit"
$
(
dropdown
).
parents
(
'form'
).
submit
()
$
(
dropdown
).
parents
(
'form'
).
submit
()
...
...
app/assets/javascripts/milestone_select.js.coffee
View file @
dd35de1a
...
@@ -2,18 +2,29 @@ class @MilestoneSelect
...
@@ -2,18 +2,29 @@ class @MilestoneSelect
constructor
:
->
constructor
:
->
$
(
'.js-milestone-select'
).
each
(
i
,
dropdown
)
->
$
(
'.js-milestone-select'
).
each
(
i
,
dropdown
)
->
projectId
=
$
(
dropdown
).
data
(
'project-id'
)
projectId
=
$
(
dropdown
).
data
(
'project-id'
)
milestonesUrl
=
$
(
dropdown
).
data
(
'milestones'
)
selectedMilestone
=
$
(
dropdown
).
data
(
'selected'
)
selectedMilestone
=
$
(
dropdown
).
data
(
'selected'
)
showNo
=
$
(
dropdown
).
data
(
'show-no'
)
showNo
=
$
(
dropdown
).
data
(
'show-no'
)
showAny
=
$
(
dropdown
).
data
(
'show-any'
)
showAny
=
$
(
dropdown
).
data
(
'show-any'
)
useId
=
$
(
dropdown
).
data
(
'use-id'
)
$
(
dropdown
).
glDropdown
(
$
(
dropdown
).
glDropdown
(
data
:
(
term
,
callback
)
->
data
:
(
term
,
callback
)
->
Api
.
milestones
projectId
,
(
data
)
->
$
.
ajax
(
data
=
$
.
map
data
,
(
milestone
)
->
url
:
milestonesUrl
return
milestone
if
milestone
.
state
isnt
"closed"
).
done
(
data
)
->
html
=
$
(
data
)
data
=
[]
html
.
find
(
'.milestone strong a'
).
each
->
link
=
$
(
@
).
attr
(
"href"
).
split
(
"/"
)
data
.
push
(
id
:
link
[
link
.
length
-
1
]
title
:
$
(
@
).
text
().
trim
()
)
if
showNo
if
showNo
data
.
unshift
(
data
.
unshift
(
id
:
"0"
title
:
'No milestone'
title
:
'No milestone'
)
)
...
@@ -34,10 +45,13 @@ class @MilestoneSelect
...
@@ -34,10 +45,13 @@ class @MilestoneSelect
text
:
(
milestone
)
->
text
:
(
milestone
)
->
milestone
.
title
milestone
.
title
id
:
(
milestone
)
->
id
:
(
milestone
)
->
if
!
useId
if
milestone
.
title
isnt
"Any milestone"
if
milestone
.
title
isnt
"Any milestone"
milestone
.
title
milestone
.
title
else
else
""
""
else
milestone
.
id
isSelected
:
(
milestone
)
->
isSelected
:
(
milestone
)
->
milestone
.
title
is
selectedMilestone
milestone
.
title
is
selectedMilestone
clicked
:
->
clicked
:
->
...
...
app/views/shared/issuable/_filter.html.haml
View file @
dd35de1a
...
@@ -22,7 +22,7 @@
...
@@ -22,7 +22,7 @@
-
if
params
[
:milestone_title
]
-
if
params
[
:milestone_title
]
=
hidden_field_tag
(
:milestone_title
,
params
[
:milestone_title
])
=
hidden_field_tag
(
:milestone_title
,
params
[
:milestone_title
])
=
dropdown_tag
(
"Milestone"
,
title:
"Filter by milestone"
,
toggle_class:
'js-milestone-select js-filter-submit'
,
filter:
true
,
dropdown_class:
"dropdown-menu-selectable"
,
=
dropdown_tag
(
"Milestone"
,
title:
"Filter by milestone"
,
toggle_class:
'js-milestone-select js-filter-submit'
,
filter:
true
,
dropdown_class:
"dropdown-menu-selectable"
,
placeholder:
"Search milestones"
,
footer_content:
true
,
data:
{
show_no:
true
,
show_any:
true
,
field_name:
"milestone_title"
,
selected:
params
[
:milestone_title
],
project_id:
@project
.
id
})
do
placeholder:
"Search milestones"
,
footer_content:
true
,
data:
{
show_no:
true
,
show_any:
true
,
field_name:
"milestone_title"
,
selected:
params
[
:milestone_title
],
project_id:
@project
.
id
,
milestones:
namespace_project_milestones_path
(
@project
.
namespace
,
@project
,
:js
)
})
do
%ul
.dropdown-footer-list
%ul
.dropdown-footer-list
-
if
can?
current_user
,
:admin_milestone
,
@project
-
if
can?
current_user
,
:admin_milestone
,
@project
%li
%li
...
@@ -39,7 +39,7 @@
...
@@ -39,7 +39,7 @@
-
if
params
[
:label_name
]
-
if
params
[
:label_name
]
=
hidden_field_tag
(
:label_name
,
params
[
:label_name
])
=
hidden_field_tag
(
:label_name
,
params
[
:label_name
])
.dropdown
.dropdown
%button
.dropdown-menu-toggle.js-label-select.js-filter-submit
{
type:
"button"
,
data:
{
toggle:
"dropdown"
,
field_name:
"label_name"
,
selected:
params
[
:label_name
],
project_id:
@project
.
id
}}
%button
.dropdown-menu-toggle.js-label-select.js-filter-submit
{
type:
"button"
,
data:
{
toggle:
"dropdown"
,
field_name:
"label_name"
,
selected:
params
[
:label_name
],
project_id:
@project
.
id
,
labels:
namespace_project_labels_path
(
@project
.
namespace
,
@project
,
:js
)
}}
%span
.dropdown-toggle-text
%span
.dropdown-toggle-text
Label
Label
=
icon
(
'chevron-down'
)
=
icon
(
'chevron-down'
)
...
@@ -106,7 +106,7 @@
...
@@ -106,7 +106,7 @@
placeholder:
"Search authors"
,
data:
{
first_user:
true
,
current_user:
true
,
project_id:
@project
.
id
,
field_name:
"update[assignee_id]"
})
placeholder:
"Search authors"
,
data:
{
first_user:
true
,
current_user:
true
,
project_id:
@project
.
id
,
field_name:
"update[assignee_id]"
})
.filter-item.inline
.filter-item.inline
=
dropdown_tag
(
"Milestone"
,
title:
"Assign milestone"
,
toggle_class:
'js-milestone-select'
,
filter:
true
,
dropdown_class:
"dropdown-menu-selectable"
,
=
dropdown_tag
(
"Milestone"
,
title:
"Assign milestone"
,
toggle_class:
'js-milestone-select'
,
filter:
true
,
dropdown_class:
"dropdown-menu-selectable"
,
placeholder:
"Search milestones"
,
data:
{
show_no:
true
,
field_name:
"update[milestone_id]"
,
project_id:
@project
.
id
})
placeholder:
"Search milestones"
,
data:
{
show_no:
true
,
field_name:
"update[milestone_id]"
,
project_id:
@project
.
id
,
milestones:
namespace_project_milestones_path
(
@project
.
namespace
,
@project
,
:js
),
use_id:
true
})
=
hidden_field_tag
'update[issues_ids]'
,
[]
=
hidden_field_tag
'update[issues_ids]'
,
[]
=
hidden_field_tag
:state_event
,
params
[
:state_event
]
=
hidden_field_tag
:state_event
,
params
[
:state_event
]
.filter-item.inline
.filter-item.inline
...
...
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