diff options
Diffstat (limited to 'client/components/import/import.js')
-rw-r--r-- | client/components/import/import.js | 28 |
1 files changed, 15 insertions, 13 deletions
diff --git a/client/components/import/import.js b/client/components/import/import.js index 00918aac..c6957fa9 100644 --- a/client/components/import/import.js +++ b/client/components/import/import.js @@ -1,20 +1,21 @@ -/** - * Abstract root for all import popup screens. - * Descendants must define: - * - getMethodName(): return the Meteor method to call for import, passing json data decoded as object - * and additional data (see below) - * - getAdditionalData(): return object containing additional data passed to Meteor method - * (like list ID and position for a card import) - * - getLabel(): i18n key for the text displayed in the popup, usually to explain how to get the data out of the - * source system. - */ +/// Abstract root for all import popup screens. +/// Descendants must define: +/// - getMethodName(): return the Meteor method to call for import, passing json +/// data decoded as object and additional data (see below); +/// - getAdditionalData(): return object containing additional data passed to +/// Meteor method (like list ID and position for a card import); +/// - getLabel(): i18n key for the text displayed in the popup, usually to +/// explain how to get the data out of the source system. const ImportPopup = BlazeComponent.extendComponent({ - template() {return 'importPopup';}, + template() { + return 'importPopup'; + }, + events() { return [{ 'submit': (evt) => { evt.preventDefault(); - const dataJson = $(evt.currentTarget).find('textarea').val(); + const dataJson = $(evt.currentTarget).find('.js-import-json').val(); let dataObject; try { dataObject = JSON.parse(dataJson); @@ -52,7 +53,8 @@ const ImportPopup = BlazeComponent.extendComponent({ ImportPopup.extendComponent({ getAdditionalData() { const listId = this.data()._id; - const firstCardDom = $(`#js-list-${this.currentData()._id} .js-minicard:first`).get(0); + const selector = `#js-list-${this.currentData()._id} .js-minicard:first`; + const firstCardDom = $(selector).get(0); const sortIndex = Utils.calculateIndex(null, firstCardDom).base; const result = {listId, sortIndex}; return result; |