Import board: added UI

This commit is contained in:
Xavier Priour 2015-10-15 14:01:13 +02:00
parent 15ebfa63c6
commit 468694a84c
9 changed files with 119 additions and 55 deletions

View file

@ -49,45 +49,6 @@ Template.listActionPopup.events({
},
});
BlazeComponent.extendComponent({
events() {
return [{
'submit': (evt) => {
evt.preventDefault();
const jsonData = $(evt.currentTarget).find('textarea').val();
const firstCardDom = $(`#js-list-${this.currentData()._id} .js-minicard:first`).get(0);
const sortIndex = Utils.calculateIndex(null, firstCardDom).base;
let trelloCard;
try {
trelloCard = JSON.parse(jsonData);
} catch (e) {
this.setError('error-json-malformed');
return;
}
Meteor.call('importTrelloCard', trelloCard, this.currentData()._id, sortIndex,
(error, response) => {
if (error) {
this.setError(error.error);
} else {
Filter.addException(response);
Popup.close();
}
}
);
},
}];
},
onCreated() {
this.error = new ReactiveVar('');
},
setError(error) {
this.error.set(error);
},
}).register('listImportCardPopup');
Template.listMoveCardsPopup.events({
'click .js-select-list'() {
const fromList = Template.parentData(2).data;