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
3ae2d90b
Commit
3ae2d90b
authored
Jan 31, 2018
by
Phil Hughes
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Converted milestone_select.js to axios
parent
d58ff943
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
58 additions
and
61 deletions
+58
-61
app/assets/javascripts/milestone_select.js
app/assets/javascripts/milestone_select.js
+58
-61
No files found.
app/assets/javascripts/milestone_select.js
View file @
3ae2d90b
...
@@ -2,6 +2,7 @@
...
@@ -2,6 +2,7 @@
/* global Issuable */
/* global Issuable */
/* global ListMilestone */
/* global ListMilestone */
import
_
from
'
underscore
'
;
import
_
from
'
underscore
'
;
import
axios
from
'
./lib/utils/axios_utils
'
;
import
{
timeFor
}
from
'
./lib/utils/datetime_utility
'
;
import
{
timeFor
}
from
'
./lib/utils/datetime_utility
'
;
export
default
class
MilestoneSelect
{
export
default
class
MilestoneSelect
{
...
@@ -52,48 +53,47 @@ export default class MilestoneSelect {
...
@@ -52,48 +53,47 @@ export default class MilestoneSelect {
}
}
return
$dropdown
.
glDropdown
({
return
$dropdown
.
glDropdown
({
showMenuAbove
:
showMenuAbove
,
showMenuAbove
:
showMenuAbove
,
data
:
(
term
,
callback
)
=>
$
.
ajax
({
data
:
(
term
,
callback
)
=>
axios
.
get
(
milestonesUrl
)
url
:
milestonesUrl
.
then
(({
data
})
=>
{
}).
done
((
data
)
=>
{
const
extraOptions
=
[];
const
extraOptions
=
[];
if
(
showAny
)
{
if
(
showAny
)
{
extraOptions
.
push
({
extraOptions
.
push
({
id
:
0
,
id
:
0
,
name
:
''
,
name
:
''
,
title
:
'
Any Milestone
'
title
:
'
Any Milestone
'
});
});
}
}
if
(
showNo
)
{
if
(
showNo
)
{
extraOptions
.
push
({
extraOptions
.
push
({
id
:
-
1
,
id
:
-
1
,
name
:
'
No Milestone
'
,
name
:
'
No Milestone
'
,
title
:
'
No Milestone
'
title
:
'
No Milestone
'
});
});
}
}
if
(
showUpcoming
)
{
if
(
showUpcoming
)
{
extraOptions
.
push
({
extraOptions
.
push
({
id
:
-
2
,
id
:
-
2
,
name
:
'
#upcoming
'
,
name
:
'
#upcoming
'
,
title
:
'
Upcoming
'
title
:
'
Upcoming
'
});
});
}
}
if
(
showStarted
)
{
if
(
showStarted
)
{
extraOptions
.
push
({
extraOptions
.
push
({
id
:
-
3
,
id
:
-
3
,
name
:
'
#started
'
,
name
:
'
#started
'
,
title
:
'
Started
'
title
:
'
Started
'
});
});
}
}
if
(
extraOptions
.
length
)
{
if
(
extraOptions
.
length
)
{
extraOptions
.
push
(
'
divider
'
);
extraOptions
.
push
(
'
divider
'
);
}
}
callback
(
extraOptions
.
concat
(
data
));
callback
(
extraOptions
.
concat
(
data
));
if
(
showMenuAbove
)
{
if
(
showMenuAbove
)
{
$dropdown
.
data
(
'
glDropdown
'
).
positionMenuAbove
();
$dropdown
.
data
(
'
glDropdown
'
).
positionMenuAbove
();
}
}
$
(
`[data-milestone-id="
${
selectedMilestone
}
"] > a`
).
addClass
(
'
is-active
'
);
$
(
`[data-milestone-id="
${
selectedMilestone
}
"] > a`
).
addClass
(
'
is-active
'
);
}),
}),
renderRow
:
milestone
=>
`
renderRow
:
milestone
=>
`
<li data-milestone-id="
${
milestone
.
name
}
">
<li data-milestone-id="
${
milestone
.
name
}
">
<a href='#' class='dropdown-menu-milestone-link'>
<a href='#' class='dropdown-menu-milestone-link'>
...
@@ -200,26 +200,23 @@ export default class MilestoneSelect {
...
@@ -200,26 +200,23 @@ export default class MilestoneSelect {
data
[
abilityName
].
milestone_id
=
selected
!=
null
?
selected
:
null
;
data
[
abilityName
].
milestone_id
=
selected
!=
null
?
selected
:
null
;
$loading
.
removeClass
(
'
hidden
'
).
fadeIn
();
$loading
.
removeClass
(
'
hidden
'
).
fadeIn
();
$dropdown
.
trigger
(
'
loading.gl.dropdown
'
);
$dropdown
.
trigger
(
'
loading.gl.dropdown
'
);
return
$
.
ajax
({
return
axios
.
put
(
issueUpdateURL
,
data
)
type
:
'
PUT
'
,
.
then
(({
data
})
=>
{
url
:
issueUpdateURL
,
$dropdown
.
trigger
(
'
loaded.gl.dropdown
'
);
data
:
data
$loading
.
fadeOut
();
}).
done
((
data
)
=>
{
$selectBox
.
hide
();
$dropdown
.
trigger
(
'
loaded.gl.dropdown
'
);
$value
.
css
(
'
display
'
,
''
);
$loading
.
fadeOut
();
if
(
data
.
milestone
!=
null
)
{
$selectBox
.
hide
();
data
.
milestone
.
full_path
=
this
.
currentProject
.
full_path
;
$value
.
css
(
'
display
'
,
''
);
data
.
milestone
.
remaining
=
timeFor
(
data
.
milestone
.
due_date
);
if
(
data
.
milestone
!=
null
)
{
data
.
milestone
.
name
=
data
.
milestone
.
title
;
data
.
milestone
.
full_path
=
this
.
currentProject
.
full_path
;
$value
.
html
(
milestoneLinkTemplate
(
data
.
milestone
));
data
.
milestone
.
remaining
=
timeFor
(
data
.
milestone
.
due_date
);
return
$sidebarCollapsedValue
.
find
(
'
span
'
).
html
(
collapsedSidebarLabelTemplate
(
data
.
milestone
));
data
.
milestone
.
name
=
data
.
milestone
.
title
;
}
else
{
$value
.
html
(
milestoneLinkTemplate
(
data
.
milestone
));
$value
.
html
(
milestoneLinkNoneTemplate
);
return
$sidebarCollapsedValue
.
find
(
'
span
'
).
html
(
collapsedSidebarLabelTemplate
(
data
.
milestone
));
return
$sidebarCollapsedValue
.
find
(
'
span
'
).
text
(
'
No
'
);
}
else
{
}
$value
.
html
(
milestoneLinkNoneTemplate
);
});
return
$sidebarCollapsedValue
.
find
(
'
span
'
).
text
(
'
No
'
);
}
});
}
}
}
}
});
});
...
...
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