Skip to content

Commit

Permalink
Merge pull request #155 from agileseason/151-fix-drop-issue-into-the-…
Browse files Browse the repository at this point in the history
…column-header

Fix issue position when drop into the column header
  • Loading branch information
blackchestnut committed Feb 18, 2023
2 parents ec40bcf + 4aaf3ed commit cd8db70
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 5 deletions.
15 changes: 14 additions & 1 deletion src/components/app_drop.vue
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,16 @@
import * as Sentry from '@sentry/browser';
const COLUMN_TOP_CLASSES = {
'column-drag': true,
'header': true,
'issues-count': true,
'name-wrapper': true,
'name': true,
'issue-new': true,
'column-settings': true
};
export default {
props: {
transferData: {
Expand All @@ -35,7 +45,10 @@ export default {
try {
const transferData = JSON.parse(payload);
this.$emit('drop', transferData);
this.$emit( 'drop', {
...transferData,
isColumnTop: !!COLUMN_TOP_CLASSES[e.toElement.className]
});
} catch (e) {
Sentry.setContext('transferData', { payload });
Sentry.captureException(e);
Expand Down
2 changes: 2 additions & 0 deletions src/components/board/column.vue
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
:transferData="{ type: 'column', enterColumnIndex: columnIndex }"
>
<AppDrag
class='column-drag'
:transferData="{ type: 'column', fromColumnIndex: columnIndex }"
:is-read-only='isReadOnly'
>
Expand Down Expand Up @@ -431,6 +432,7 @@ export default {
background-image: url('../../assets/icons/dots-hover.svg')
.body
border-radius: 4px
height: calc(100vh - 80px)
overflow-y: scroll
Expand Down
5 changes: 3 additions & 2 deletions src/mixins/moving_issues_and_columns.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,13 @@ export default {
this.moveIssue(transferData)
}
},
moveIssue({ fromColumnIndex, fromIssueIndex }) {
moveIssue({ fromColumnIndex, fromIssueIndex, isColumnTop }) {
this.moveColumnIssue({
fromColumnIndex,
toColumnIndex: this.columnIndex,
fromIssueIndex: fromIssueIndex,
toIssueIndex: this.issueIndex
toIssueIndex: this.issueIndex,
isColumnTop
});
},
moveColumn({ fromColumnIndex }) {
Expand Down
9 changes: 7 additions & 2 deletions src/store/modules/board.js
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ export default {

async moveIssue(
{ commit, getters, state, dispatch },
{ fromColumnIndex, toColumnIndex, fromIssueIndex, toIssueIndex }
{ fromColumnIndex, toColumnIndex, fromIssueIndex, toIssueIndex, isColumnTop }
) {
if (fromColumnIndex === undefined) { return; }
if (toColumnIndex === undefined) { return; }
Expand All @@ -110,9 +110,14 @@ export default {
// Однозначно, куда был перемещен тикет по данным параметрам
// не представляется возмоным. Есть только 2а варианта:
// 1) Пример ниже для перемещения в самый низ.
toIssueIndex = state.columns[toColumnIndex].issues.length + 1;
// toIssueIndex = state.columns[toColumnIndex].issues.length + 1;
// 2) Пример ниже для перемещения в самый верх.
// toIssueIndex = 0;
if (isColumnTop) {
toIssueIndex = 0;
} else {
toIssueIndex = state.columns[toColumnIndex].issues.length + 1;
}
}

const fromIssues = state.columns[fromColumnIndex].issues;
Expand Down

0 comments on commit cd8db70

Please sign in to comment.