mirror of
https://github.com/wekan/wekan.git
synced 2025-04-23 13:37:09 -04:00
Import members: added UI
This commit is contained in:
parent
c6b12dc5ad
commit
027aacb50e
3 changed files with 42 additions and 10 deletions
|
@ -5,3 +5,11 @@ template(name="importPopup")
|
|||
p: label(for='import-textarea') {{_ getLabel}}
|
||||
textarea#import-textarea.js-import-json(placeholder="{{_ 'import-json-placeholder'}}" autofocus)
|
||||
input.primary.wide(type="submit" value="{{_ 'import'}}")
|
||||
|
||||
template(name="mapMembersPopup")
|
||||
p {{_ 'import-members-map'}}
|
||||
ul
|
||||
each members
|
||||
li.item {{ fullName }} > world
|
||||
form
|
||||
input.primary.wide(type="submit" value="{{_ 'import'}}")
|
||||
|
|
|
@ -13,32 +13,44 @@ const ImportPopup = BlazeComponent.extendComponent({
|
|||
|
||||
events() {
|
||||
return [{
|
||||
'submit': (evt) => {
|
||||
submit(evt) {
|
||||
evt.preventDefault();
|
||||
const dataJson = $(evt.currentTarget).find('.js-import-json').val();
|
||||
let dataObject;
|
||||
try {
|
||||
dataObject = JSON.parse(dataJson);
|
||||
this.setError('');
|
||||
} catch (e) {
|
||||
this.setError('error-json-malformed');
|
||||
return;
|
||||
}
|
||||
Meteor.call(this.getMethodName(), dataObject, this.getAdditionalData(),
|
||||
(error, response) => {
|
||||
if (error) {
|
||||
this.setError(error.error);
|
||||
} else {
|
||||
Filter.addException(response);
|
||||
this.onFinish(response);
|
||||
if(dataObject.members.length > 0) {
|
||||
this.data().toImport = dataObject;
|
||||
members.forEach(
|
||||
// todo if there is a Wekan user with same name, add it as a field 'wekanUser'
|
||||
);
|
||||
this.data().members = dataObject.members;
|
||||
// we bind to preserve data context
|
||||
Popup.open('mapMembers').bind(this)(evt);
|
||||
} else {
|
||||
Meteor.call(this.getMethodName(), dataObject, this.getAdditionalData(),
|
||||
(error, response) => {
|
||||
if (error) {
|
||||
this.setError(error.error);
|
||||
} else {
|
||||
Filter.addException(response);
|
||||
this.onFinish(response);
|
||||
}
|
||||
}
|
||||
}
|
||||
);
|
||||
);
|
||||
}
|
||||
},
|
||||
}];
|
||||
},
|
||||
|
||||
onCreated() {
|
||||
this.error = new ReactiveVar('');
|
||||
this.dataToImport = '';
|
||||
},
|
||||
|
||||
setError(error) {
|
||||
|
@ -88,3 +100,13 @@ ImportPopup.extendComponent({
|
|||
},
|
||||
}).register('boardImportBoardPopup');
|
||||
|
||||
BlazeComponent.extendComponent({
|
||||
events() {
|
||||
return [{
|
||||
'submit': (evt) => {
|
||||
evt.preventDefault();
|
||||
console.log(this.data());
|
||||
},
|
||||
}];
|
||||
},
|
||||
}).register('mapMembersPopup');
|
||||
|
|
|
@ -141,6 +141,7 @@
|
|||
"import-card": "Import a Trello card",
|
||||
"import-card-trello-instruction": "Go to a Trello card, select 'Share and more...' then 'Export JSON' and copy the resulting text",
|
||||
"import-json-placeholder": "Paste your valid JSON data here",
|
||||
"import-members-map": "Map the Trello members you want to import to Wekan members",
|
||||
"info": "Infos",
|
||||
"initials": "Initials",
|
||||
"joined": "joined",
|
||||
|
@ -164,6 +165,7 @@
|
|||
"lists": "Lists",
|
||||
"log-out": "Log Out",
|
||||
"loginPopup-title": "Log In",
|
||||
"mapMembersPopup-title": "Map members",
|
||||
"memberMenuPopup-title": "Member Settings",
|
||||
"members": "Members",
|
||||
"menu": "Menu",
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue