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
e0d7d84c
Commit
e0d7d84c
authored
Oct 04, 2017
by
Simon Knox
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
use milestone_select to select milestone
parent
9cc341e2
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
86 additions
and
71 deletions
+86
-71
app/assets/javascripts/boards/components/board_form.vue
app/assets/javascripts/boards/components/board_form.vue
+0
-1
app/assets/javascripts/boards/components/milestone_select.vue
...assets/javascripts/boards/components/milestone_select.vue
+74
-65
app/assets/javascripts/milestone_select.js
app/assets/javascripts/milestone_select.js
+12
-5
No files found.
app/assets/javascripts/boards/components/board_form.vue
View file @
e0d7d84c
...
...
@@ -59,7 +59,6 @@
<board-milestone-select
:board=
"board"
:milestone-path=
"milestonePath"
v-model=
"board.milestone_id"
title=
"Milestone"
default-text=
"Any milestone"
:can-edit=
"canAdminBoard"
...
...
app/assets/javascripts/boards/components/milestone_select.vue
View file @
e0d7d84c
<
script
>
/* global BoardService */
/* global BoardService
, MilestoneSelect
*/
import
loadingIcon
from
'
~/vue_shared/components/loading_icon.vue
'
;
import
extraMilestones
from
'
../mixins/extra_milestones
'
;
...
...
@@ -14,10 +14,6 @@ export default {
type
:
String
,
required
:
true
,
},
value
:
{
type
:
Number
,
required
:
false
,
},
defaultText
:
{
type
:
String
,
required
:
true
,
...
...
@@ -45,94 +41,107 @@ export default {
},
computed
:
{
milestoneTitle
()
{
return
this
.
board
.
milestone
?
this
.
board
.
milestone
.
title
:
this
.
defaultText
;
return
this
.
board
.
milestone
?
this
.
board
.
milestone
.
title
:
''
;
},
},
methods
:
{
selectMilestone
(
milestone
)
{
this
.
$set
(
this
.
board
,
'
milestone
'
,
milestone
);
this
.
$emit
(
'
input
'
,
milestone
.
id
);
this
.
close
();
},
open
()
{
this
.
isOpen
=
true
;
},
close
()
{
this
.
isOpen
=
false
;
},
toggle
()
{
this
.
isOpen
=
!
this
.
isOpen
;
},
},
mounted
()
{
this
.
$http
.
get
(
this
.
milestonePath
)
.
then
(
resp
=>
resp
.
json
())
.
then
((
data
)
=>
{
this
.
milestones
=
data
;
this
.
loading
=
false
;
})
.
catch
(()
=>
{
this
.
loading
=
false
;
new
MilestoneSelect
(
null
,
this
.
$refs
.
dropdownButton
,
{
handleClick
:
this
.
selectMilestone
,
});
},
};
</
script
>
<
template
>
<div
class=
"
dropdown milestone"
:class=
"
{ open: isOpen }
">
<div
class=
"
block milestone
"
>
<div
class=
"title append-bottom-10"
>
{{
title
}}
Milestone
<a
v-if=
"canEdit"
class=
"edit-link pull-right"
href=
"#"
@
click.prevent=
"toggle"
>
Edit
</a>
</div>
<div
class=
"value"
>
<span
class=
"no-value"
v-if=
"!board.milestone"
>
None
</span>
<span
class=
"bold has-tooltip"
v-if=
"board.milestone"
>
{{
board
.
milestone
.
title
}}
</span>
</div>
<div
class=
"dropdown-menu dropdown-menu-wide"
class=
"selectbox"
style=
"display: none;"
>
<ul
ref=
"list"
<input
:value=
"board.milestone.id"
name=
"milestone_id"
type=
"hidden"
v-if=
"board.milestone"
>
<li
v-for=
"milestone in extraMilestones"
:key=
"milestone.id"
<div
class=
"dropdown"
>
<button
ref=
"dropdownButton"
:data-selected=
"milestoneTitle"
class=
"dropdown-menu-toggle wide"
:data-milestones=
"milestonePath"
:data-show-no=
"true"
:data-show-any=
"true"
:data-show-started=
"true"
:data-show-upcoming=
"true"
data-toggle=
"dropdown"
:data-use-id=
"true"
type=
"button"
>
<a
href=
"#"
@
click.prevent.stop=
"selectMilestone(milestone)"
>
Milestone
<i
class=
"fa fa-check
"
v-if=
"milestone.id === value"
></i>
{{
milestone
.
title
}}
</a
>
</
li
>
<
li
class=
"divider"
></li
>
<li
v-if=
"loading"
>
<loading-icon
/>
</li
>
<li
v-else
v-for=
"milestone in milestones
"
:key=
"milestone.id
"
class=
"dropdown-menu-item
"
aria-hidden=
"true
"
data-hidden=
"true"
class=
"fa fa-chevron-down"
/
>
</
button
>
<
div
class=
"dropdown-menu dropdown-select dropdown-menu-selectable"
>
<div
class=
"dropdown-input"
>
<input
type=
"search"
class=
"dropdown-input-field
"
placeholder=
"Search milestones
"
autocomplete=
"off
"
>
<a
href=
"#"
@
click.prevent.stop=
"selectMilestone(milestone)"
>
<i
class=
"fa fa-check"
v-if=
"milestone.id === value"
></i>
{{
milestone
.
title
}}
</a>
</li>
</ul>
aria-hidden=
"true"
data-hidden=
"true"
class=
"fa fa-search dropdown-input-search"
/>
<i
role=
"button"
aria-hidden=
"true"
data-hidden=
"true"
class=
"fa fa-times dropdown-input-clear js-dropdown-input-clear"
/>
</div>
<div
class=
"dropdown-content"
/>
<div
class=
"dropdown-loading"
>
<loading-icon
/>
</div>
</div>
</div>
<div
class=
"value"
>
{{
milestoneTitle
}}
</div>
</div>
</
template
>
app/assets/javascripts/milestone_select.js
View file @
e0d7d84c
...
...
@@ -5,7 +5,7 @@ import _ from 'underscore';
(
function
()
{
this
.
MilestoneSelect
=
(
function
()
{
function
MilestoneSelect
(
currentProject
,
els
)
{
function
MilestoneSelect
(
currentProject
,
els
,
options
=
{}
)
{
var
_this
,
$els
;
if
(
currentProject
!=
null
)
{
_this
=
this
;
...
...
@@ -158,18 +158,25 @@ import _ from 'underscore';
},
isSelectable
:
function
()
{
if
(
$
(
'
html
'
).
hasClass
(
'
issue-boards-page
'
)
&&
!
$dropdown
.
hasClass
(
'
js-issue-board-sidebar
'
)
&&
!
$dropdown
.
closest
(
'
.add-issues-modal
'
).
length
&&
gl
.
issueBoards
.
BoardsStore
.
state
.
currentBoard
.
milestone_id
)
{
!
$dropdown
.
closest
(
'
.add-issues-modal
'
).
length
&&
gl
.
issueBoards
.
BoardsStore
.
state
.
currentBoard
.
milestone_id
&&
!
options
.
handleClick
)
{
return
false
;
}
return
true
;
},
clicked
:
function
(
options
)
{
const
{
$el
,
e
}
=
options
;
let
selected
=
options
.
selectedObj
;
clicked
:
function
(
clickEvent
)
{
const
{
$el
,
e
}
=
clickEvent
;
let
selected
=
clickEvent
.
selectedObj
;
var
data
,
isIssueIndex
,
isMRIndex
,
isSelecting
,
page
,
boardsStore
;
if
(
!
selected
)
return
;
if
(
options
.
handleClick
)
{
options
.
handleClick
(
selected
);
return
;
}
page
=
$
(
'
body
'
).
data
(
'
page
'
);
isIssueIndex
=
page
===
'
projects:issues:index
'
;
isMRIndex
=
(
page
===
page
&&
page
===
'
projects:merge_requests:index
'
);
...
...
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