summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--.meteor/versions3
-rw-r--r--client/components/import/import.jade5
-rw-r--r--client/components/import/import.js5
-rw-r--r--client/components/import/import.styl10
-rw-r--r--i18n/en.i18n.json5
-rw-r--r--models/import.js35
6 files changed, 48 insertions, 15 deletions
diff --git a/.meteor/versions b/.meteor/versions
index e5de3720..44934cf3 100644
--- a/.meteor/versions
+++ b/.meteor/versions
@@ -12,6 +12,7 @@ babel-runtime@0.1.4
base64@1.0.4
binary-heap@1.0.4
blaze@2.1.3
+blaze-html-templates@1.0.1
blaze-tools@1.0.4
boilerplate-generator@1.0.5-cdn-url
caching-compiler@1.0.0
@@ -124,7 +125,7 @@ seriousm:emoji-continued@1.4.0
service-configuration@1.0.5
session@1.1.1
sha@1.0.4
-softwarerero:accounts-t9n@1.1.4
+softwarerero:accounts-t9n@1.1.6
spacebars@1.0.7
spacebars-compiler@1.0.7
srp@1.0.4
diff --git a/client/components/import/import.jade b/client/components/import/import.jade
index 0f53e4d2..74b6ca13 100644
--- a/client/components/import/import.jade
+++ b/client/components/import/import.jade
@@ -8,7 +8,7 @@ template(name="importPopup")
if membersMapping
div
a.show-mapping
- | {{_ 'show-mapping'}}
+ | {{_ 'import-show-user-mapping'}}
input.primary.wide(type="submit" value="{{_ 'import'}}")
template(name="mapMembersPopup")
@@ -35,7 +35,8 @@ template(name="mapMembersPopup")
template(name="mapMembersAddPopup")
.select-member
- p Hello world
+ p
+ | {{_ 'import-user-select'}}
.js-map-member
+esInput(index="users")
ul.pop-over-list
diff --git a/client/components/import/import.js b/client/components/import/import.js
index b42fcc5d..9de649f2 100644
--- a/client/components/import/import.js
+++ b/client/components/import/import.js
@@ -29,13 +29,12 @@ const ImportPopup = BlazeComponent.extendComponent({
},
onShowMapping(evt) {
- // todo xxx make it work - currently we don't find the text
- // this._storeText(evt);
+ this._storeText(evt);
Popup.open('mapMembers')(evt);
},
_storeText(evt) {
- const dataJson = $(evt.currentTarget).find('.js-import-json').val();
+ const dataJson = this.$('.js-import-json').val();
Session.set('import.text', dataJson);
return dataJson;
},
diff --git a/client/components/import/import.styl b/client/components/import/import.styl
index 4934cbcc..3c6cfdf3 100644
--- a/client/components/import/import.styl
+++ b/client/components/import/import.styl
@@ -1,8 +1,9 @@
.map-members
+ .mapping:first-of-type
+ border-top: solid 1px #999
.mapping
- margin-bottom: 10px
- margin-top: 10px
- border-bottom: solid
+ padding: 10px 0
+ border-bottom: solid 1px #999
.source
display: inline-block
width: 80%
@@ -11,3 +12,6 @@
width: 35px
.member
float: none
+
+a.show-mapping
+ text-decoration underline
diff --git a/i18n/en.i18n.json b/i18n/en.i18n.json
index 14cd9f24..e6fd4ccc 100644
--- a/i18n/en.i18n.json
+++ b/i18n/en.i18n.json
@@ -114,6 +114,7 @@
"disambiguateMultiLabelPopup-title": "Disambiguate Label Action",
"disambiguateMultiMemberPopup-title": "Disambiguate Member Action",
"discard": "Discard",
+ "done": "Done",
"download": "Download",
"edit": "Edit",
"edit-avatar": "Change Avatar",
@@ -141,7 +142,9 @@
"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",
+ "import-members-map": "Your imported board has some members. Please map the members you want to import to Wekan users",
+ "import-show-user-mapping": "Review members mapping",
+ "import-user-select": "Pick the Wekan user you want to use as this member",
"info": "Infos",
"initials": "Initials",
"joined": "joined",
diff --git a/models/import.js b/models/import.js
index ab23f0a9..f4e93d5d 100644
--- a/models/import.js
+++ b/models/import.js
@@ -92,6 +92,24 @@ class TrelloCreator {
stars: 0,
title: trelloBoard.name,
};
+ // now add other members
+ if(trelloBoard.memberships) {
+ trelloBoard.memberships.forEach((trelloMembership) => {
+ const trelloId = trelloMembership.idMember;
+ // do we have a mapping?
+ if(this.members[trelloId]) {
+ const wekanId = this.members[trelloId];
+ // do we already have it in our list?
+ if(!boardToCreate.members.find((wekanMember) => {return (wekanMember.userId === wekanId);})) {
+ boardToCreate.members.push({
+ userId: wekanId,
+ isAdmin: false,
+ isActive: true,
+ });
+ }
+ }
+ });
+ }
trelloBoard.labels.forEach((label) => {
const labelToCreate = {
_id: Random.id(6),
@@ -197,10 +215,16 @@ class TrelloCreator {
if(card.idMembers) {
const wekanMembers = [];
// we can't just map, as some members may not have been mapped
- card.idMembers.forEach((id) => {
- if(this.members[id]) {
- wekanMembers.push(this.members[id]);
+ card.idMembers.forEach((trelloId) => {
+ if(this.members[trelloId]) {
+ const wekanId = this.members[trelloId];
+ // we may map multiple Trello members to the same wekan user
+ // in which case we risk adding the same user multiple times
+ if(!wekanMembers.find((wId) => {return (wId === wekanId);})){
+ wekanMembers.push(wekanId);
+ }
}
+ return true;
});
if(wekanMembers.length>0) {
cardToCreate.members = wekanMembers;
@@ -317,8 +341,9 @@ Meteor.methods({
// 1. check all parameters are ok from a syntax point of view
try {
- // we don't use additional data - this should be an empty object
- check(data, {});
+ check(data, {
+ membersMapping: Match.Optional(Object),
+ });
trelloCreator.checkActions(trelloBoard.actions);
trelloCreator.checkBoard(trelloBoard);
trelloCreator.checkLabels(trelloBoard.labels);