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
0d626bda
Commit
0d626bda
authored
Jan 18, 2018
by
Kushal Pandya
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix issue reordering for swapping of items
parent
ba1c613d
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
21 deletions
+7
-21
app/assets/javascripts/issuable/related_issues/components/related_issues_block.vue
...suable/related_issues/components/related_issues_block.vue
+7
-21
No files found.
app/assets/javascripts/issuable/related_issues/components/related_issues_block.vue
View file @
0d626bda
...
...
@@ -103,33 +103,18 @@ export default {
toggleAddRelatedIssuesForm
()
{
eventHub
.
$emit
(
'
toggleAddRelatedIssuesForm
'
);
},
getBeforeAfterId
(
newIndex
,
lastIndex
)
{
let
beforeId
=
null
;
let
afterId
=
null
;
if
(
newIndex
===
0
)
{
// newIndex is 0, item was moved to top => send only afterId
afterId
=
this
.
relatedIssues
[
newIndex
].
epic_issue_id
;
}
else
if
(
newIndex
===
lastIndex
)
{
// newIndex is lastIndex, item was moved to bottom => send only beforeId
beforeId
=
this
.
relatedIssues
[
newIndex
].
epic_issue_id
;
}
else
{
// leave default
beforeId
=
this
.
relatedIssues
[
newIndex
-
1
].
epic_issue_id
;
afterId
=
this
.
relatedIssues
[
newIndex
].
epic_issue_id
;
}
getBeforeAfterId
(
itemEl
)
{
const
prevItemEl
=
itemEl
.
previousElementSibling
;
const
nextItemEl
=
itemEl
.
nextElementSibling
;
return
{
beforeId
,
afterId
,
beforeId
:
prevItemEl
&&
parseInt
(
prevItemEl
.
dataset
.
epicIssueId
,
0
)
,
afterId
:
nextItemEl
&&
parseInt
(
nextItemEl
.
dataset
.
epicIssueId
,
0
)
,
};
},
reordered
(
event
)
{
this
.
removeDraggingCursor
();
const
{
beforeId
,
afterId
,
}
=
this
.
getBeforeAfterId
(
event
.
newIndex
,
this
.
relatedIssues
.
length
-
1
);
const
{
beforeId
,
afterId
}
=
this
.
getBeforeAfterId
(
event
.
item
);
this
.
$emit
(
'
saveReorder
'
,
{
issueId
:
parseInt
(
event
.
item
.
dataset
.
key
,
10
),
...
...
@@ -240,6 +225,7 @@ issue-count-badge-add-button btn btn-sm btn-default"
card: canReorder
}"
:data-key="issue.id"
:data-epic-issue-id="issue.epic_issue_id"
>
<issue-item
event-namespace=
"relatedIssue"
...
...
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