Update boardBody.js

This commit is contained in:
DimDz 2023-07-20 14:30:42 +03:00 committed by GitHub
parent 399f63cef6
commit be8374d100
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -417,35 +417,37 @@ BlazeComponent.extendComponent({
revertFunc(); revertFunc();
} }
}, },
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');
<div class="modal-dialog justify-content-center align-items-center" role="document"> modalElement.setAttribute('tabindex', '-1');
<div class="modal-content"> modalElement.setAttribute('role', 'dialog');
<div class="modal-header"> modalElement.innerHTML = `
<h5 class="modal-title">${TAPi18n.__('r-create-card')}</h5> <div class="modal-dialog justify-content-center align-items-center" role="document">
<button type="button" class="close" data-dismiss="modal" aria-label="Close"> <div class="modal-content">
<span aria-hidden="true">&times;</span> <div class="modal-header">
</button> <h5 class="modal-title">${TAPi18n.__('r-create-card')}</h5>
</div> <button type="button" class="close" data-dismiss="modal" aria-label="Close">
<div class="modal-body text-center"> <span aria-hidden="true">&times;</span>
<input type="text" class="form-control" id="card-title-input" placeholder=""> </button>
</div> </div>
<div class="modal-footer"> <div class="modal-body text-center">
<button type="button" class="btn btn-primary" id="create-card-button">${TAPi18n.__('add-card')}</button> <input type="text" class="form-control" id="card-title-input" placeholder="">
</div> </div>
</div> <div class="modal-footer">
<button type="button" class="btn btn-primary" id="create-card-button">${TAPi18n.__('add-card')}</button>
</div> </div>
</div> </div>
`); </div>
$modal.modal('show'); `;
$modal.find('#create-card-button').click(function() { const createCardButton = modalElement.querySelector('#create-card-button');
const myTitle = $modal.find('#card-title-input').val(); createCardButton.addEventListener('click', function () {
const myTitle = modalElement.querySelector('#card-title-input').value;
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() {