-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Update the listname after dropped to list and reload page
- Loading branch information
1 parent
d0ee1ad
commit fcfc0bb
Showing
2 changed files
with
28 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,30 @@ | ||
import { genericUpdate } from '../../helpers/api.js' | ||
|
||
export function dragFrom(ev) { | ||
ev.dataTransfer.setData("text", ev.target.id); | ||
} | ||
|
||
export function dropTo(ev, cardContainerType) { | ||
ev.preventDefault(); | ||
|
||
var data = ev.dataTransfer.getData("text"); | ||
let listNameEle; | ||
|
||
// Runs only if a card is dropped upon a card. | ||
if (!ev.target.id) { | ||
let parentTarget = document.getElementById(cardContainerType); | ||
listNameEle = parentTarget; | ||
parentTarget.appendChild(document.getElementById(data)); | ||
} else { | ||
listNameEle = ev.target; | ||
ev.target.appendChild(document.getElementById(data)); | ||
} | ||
|
||
let listName = listNameEle?.id.replace('card', ''); | ||
updateCardStatusType(data, listName) | ||
} | ||
|
||
function updateCardStatusType(data, listName) { | ||
genericUpdate(data, { listName }) | ||
|
||
window.location.reload(); | ||
} |