mirror of
https://github.com/wekan/wekan.git
synced 2025-09-22 01:50:48 +02:00
Update boardBody.js
This commit is contained in:
parent
399f63cef6
commit
be8374d100
1 changed files with 38 additions and 26 deletions
|
@ -420,8 +420,11 @@ BlazeComponent.extendComponent({
|
||||||
select: function (startDate) {
|
select: function (startDate) {
|
||||||
const currentBoard = Utils.getCurrentBoard();
|
const currentBoard = Utils.getCurrentBoard();
|
||||||
const currentUser = ReactiveCache.getCurrentUser();
|
const currentUser = ReactiveCache.getCurrentUser();
|
||||||
const $modal = $(`
|
const modalElement = document.createElement('div');
|
||||||
<div class="modal fade" tabindex="-1" role="dialog">
|
modalElement.classList.add('modal', 'fade');
|
||||||
|
modalElement.setAttribute('tabindex', '-1');
|
||||||
|
modalElement.setAttribute('role', 'dialog');
|
||||||
|
modalElement.innerHTML = `
|
||||||
<div class="modal-dialog justify-content-center align-items-center" role="document">
|
<div class="modal-dialog justify-content-center align-items-center" role="document">
|
||||||
<div class="modal-content">
|
<div class="modal-content">
|
||||||
<div class="modal-header">
|
<div class="modal-header">
|
||||||
|
@ -438,14 +441,13 @@ BlazeComponent.extendComponent({
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
`;
|
||||||
`);
|
const createCardButton = modalElement.querySelector('#create-card-button');
|
||||||
$modal.modal('show');
|
createCardButton.addEventListener('click', function () {
|
||||||
$modal.find('#create-card-button').click(function() {
|
const myTitle = modalElement.querySelector('#card-title-input').value;
|
||||||
const myTitle = $modal.find('#card-title-input').val();
|
|
||||||
if (myTitle) {
|
if (myTitle) {
|
||||||
const firstList = currentBoard.draggableLists().fetch()[0];
|
const firstList = currentBoard.draggableLists()[0];
|
||||||
const firstSwimlane = currentBoard.swimlanes().fetch()[0];
|
const firstSwimlane = currentBoard.swimlanes()[0];
|
||||||
Meteor.call('createCardWithDueDate', currentBoard._id, firstList._id, myTitle, startDate.toDate(), firstSwimlane._id, function(error, result) {
|
Meteor.call('createCardWithDueDate', currentBoard._id, firstList._id, myTitle, startDate.toDate(), firstSwimlane._id, function(error, result) {
|
||||||
if (error) {
|
if (error) {
|
||||||
console.log(error);
|
console.log(error);
|
||||||
|
@ -453,10 +455,20 @@ BlazeComponent.extendComponent({
|
||||||
console.log("Card Created", result);
|
console.log("Card Created", result);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
$modal.modal('hide');
|
closeModal();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
},
|
document.body.appendChild(modalElement);
|
||||||
|
const openModal = function() {
|
||||||
|
modalElement.style.display = 'flex';
|
||||||
|
};
|
||||||
|
const closeModal = function() {
|
||||||
|
modalElement.style.display = 'none';
|
||||||
|
};
|
||||||
|
const closeButton = modalElement.querySelector('[data-dismiss="modal"]');
|
||||||
|
closeButton.addEventListener('click', closeModal);
|
||||||
|
openModal();
|
||||||
|
}
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
isViewCalendar() {
|
isViewCalendar() {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue