mirror of
https://github.com/wekan/wekan.git
synced 2025-12-16 23:40:13 +01:00
Change the board import layout from a popup to a full page
This commit also removes the “import a single Trello card” as we couldn’t figure out some reasonable use case. We also create a new publication on the server to provide the minimal user profile informations required to display an avatar.
This commit is contained in:
parent
67e7b6a139
commit
a13fad749e
13 changed files with 201 additions and 203 deletions
|
|
@ -106,7 +106,6 @@ globals:
|
||||||
CSSEvents: true
|
CSSEvents: true
|
||||||
EscapeActions: true
|
EscapeActions: true
|
||||||
Filter: true
|
Filter: true
|
||||||
Filter: true
|
|
||||||
Mixins: true
|
Mixins: true
|
||||||
Modal: true
|
Modal: true
|
||||||
MultiSelection: true
|
MultiSelection: true
|
||||||
|
|
|
||||||
|
|
@ -9,8 +9,8 @@ This patch release fixes two bugs on Sandstorm:
|
||||||
|
|
||||||
This release features:
|
This release features:
|
||||||
|
|
||||||
* Trello boards and cards importation, including card history, assigned members,
|
* Trello boards importation, including card history, assigned members, labels,
|
||||||
labels, comments, and attachments;
|
comments, and attachments;
|
||||||
* Invite new users to a board using a email address;
|
* Invite new users to a board using a email address;
|
||||||
* Autocompletion in the minicard editor. Start with <kbd>@</kbd> to start a
|
* Autocompletion in the minicard editor. Start with <kbd>@</kbd> to start a
|
||||||
board member autocompletion, or <kbd>#</kbd> for a label;
|
board member autocompletion, or <kbd>#</kbd> for a label;
|
||||||
|
|
|
||||||
|
|
@ -175,7 +175,7 @@ template(name="createBoardPopup")
|
||||||
input.primary.wide(type="submit" value="{{_ 'create'}}")
|
input.primary.wide(type="submit" value="{{_ 'create'}}")
|
||||||
span.quiet
|
span.quiet
|
||||||
| {{_ 'or'}}
|
| {{_ 'or'}}
|
||||||
a.js-import {{_ 'import-board'}}
|
a(href="{{pathFor 'import'}}") {{_ 'import-board'}}
|
||||||
|
|
||||||
|
|
||||||
template(name="boardChangeTitlePopup")
|
template(name="boardChangeTitlePopup")
|
||||||
|
|
|
||||||
|
|
@ -1,2 +0,0 @@
|
||||||
a.js-import
|
|
||||||
text-decoration underline
|
|
||||||
|
|
@ -1,39 +1,52 @@
|
||||||
template(name="importPopup")
|
template(name="importHeaderBar")
|
||||||
if error.get
|
h1
|
||||||
.warning {{_ error.get}}
|
a.back-btn(href="{{pathFor 'home'}}")
|
||||||
|
i.fa.fa-chevron-left
|
||||||
|
| {{_ 'import-board-title'}}
|
||||||
|
|
||||||
|
template(name="import")
|
||||||
|
.wrapper
|
||||||
|
if error.get
|
||||||
|
.warning {{_ error.get}}
|
||||||
|
+Template.dynamic(template=currentTemplate)
|
||||||
|
|
||||||
|
template(name="importTextarea")
|
||||||
form
|
form
|
||||||
p: label(for='import-textarea') {{_ getLabel}}
|
p: label(for='import-textarea') {{_ 'import-board-trello-instruction'}}
|
||||||
textarea#import-textarea.js-import-json(placeholder="{{_ 'import-json-placeholder'}}" autofocus)
|
textarea.js-import-json(placeholder="{{_ 'import-json-placeholder'}}" autofocus)
|
||||||
| {{jsonText}}
|
| {{jsonText}}
|
||||||
if membersMapping
|
|
||||||
div
|
|
||||||
a.show-mapping
|
|
||||||
| {{_ 'import-show-user-mapping'}}
|
|
||||||
input.primary.wide(type="submit" value="{{_ 'import'}}")
|
input.primary.wide(type="submit" value="{{_ 'import'}}")
|
||||||
|
|
||||||
template(name="mapMembersPopup")
|
template(name="importMapMembers")
|
||||||
|
h2 {{_ 'import-map-members'}}
|
||||||
.map-members
|
.map-members
|
||||||
p {{_ 'import-members-map'}}
|
p {{_ 'import-members-map'}}
|
||||||
.mapping-list
|
.mapping-list
|
||||||
each members
|
each members
|
||||||
.mapping
|
a.mapping-item.js-select-member(class="{{#if wekan}}filled{{/if}}")
|
||||||
a.source
|
.profile-source
|
||||||
div.full-name
|
.full-name= fullName
|
||||||
= fullName
|
.username
|
||||||
div.username
|
|
||||||
| ({{username}})
|
| ({{username}})
|
||||||
.wekan
|
.wekan
|
||||||
if wekan
|
if wekan
|
||||||
+userAvatar(userId=wekan._id)
|
+userAvatar(userId=wekan._id)
|
||||||
else
|
else
|
||||||
a.member.add-member.js-add-members
|
a.member.add-member
|
||||||
i.fa.fa-plus
|
i.fa.fa-plus
|
||||||
|
//-
|
||||||
|
Due to the way the flewbox layout is working, we need to set some
|
||||||
|
invisible items so that the last row items have a consistent width.
|
||||||
|
See http://jsfiddle.net/Ln4h3c4n/ for an minimal example of the issue.
|
||||||
|
.mapping-item.ghost-item
|
||||||
|
.mapping-item.ghost-item
|
||||||
|
.mapping-item.ghost-item
|
||||||
|
.mapping-item.ghost-item
|
||||||
|
.mapping-item.ghost-item
|
||||||
form
|
form
|
||||||
input.primary.wide(type="submit" value="{{_ 'done'}}")
|
input.primary.wide(type="submit" value="{{_ 'done'}}")
|
||||||
|
|
||||||
template(name="addMemberPopup")
|
template(name="importMapMembersAddPopup")
|
||||||
|
|
||||||
template(name="mapMembersAddPopup")
|
|
||||||
.select-member
|
.select-member
|
||||||
p
|
p
|
||||||
| {{_ 'import-user-select'}}
|
| {{_ 'import-user-select'}}
|
||||||
|
|
|
||||||
|
|
@ -1,68 +1,46 @@
|
||||||
/// Abstract root for all import popup screens.
|
BlazeComponent.extendComponent({
|
||||||
/// 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({
|
|
||||||
jsonText() {
|
|
||||||
return Session.get('import.text');
|
|
||||||
},
|
|
||||||
|
|
||||||
membersMapping() {
|
|
||||||
return Session.get('import.membersToMap');
|
|
||||||
},
|
|
||||||
|
|
||||||
onCreated() {
|
onCreated() {
|
||||||
this.error = new ReactiveVar('');
|
this.error = new ReactiveVar('');
|
||||||
this.dataToImport = '';
|
this.steps = ['importTextarea', 'importMapMembers'];
|
||||||
|
this._currentStepIndex = new ReactiveVar(0);
|
||||||
|
this.importedData = new ReactiveVar();
|
||||||
|
this.membersToMap = new ReactiveVar([]);
|
||||||
},
|
},
|
||||||
|
|
||||||
onFinish() {
|
currentTemplate() {
|
||||||
Popup.close();
|
return this.steps[this._currentStepIndex.get()];
|
||||||
},
|
},
|
||||||
|
|
||||||
onShowMapping(evt) {
|
nextStep() {
|
||||||
this._storeText(evt);
|
const nextStepIndex = this._currentStepIndex.get() + 1;
|
||||||
Popup.open('mapMembers')(evt);
|
if (nextStepIndex >= this.steps.length) {
|
||||||
|
this.finishImport();
|
||||||
|
} else {
|
||||||
|
this._currentStepIndex.set(nextStepIndex);
|
||||||
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
onSubmit(evt){
|
importData(evt) {
|
||||||
evt.preventDefault();
|
evt.preventDefault();
|
||||||
const dataJson = this._storeText(evt);
|
const dataJson = this.find('.js-import-json').value;
|
||||||
let dataObject;
|
|
||||||
try {
|
try {
|
||||||
dataObject = JSON.parse(dataJson);
|
const dataObject = JSON.parse(dataJson);
|
||||||
this.setError('');
|
this.setError('');
|
||||||
|
this.importedData.set(dataObject);
|
||||||
|
this._prepareAdditionalData(dataObject);
|
||||||
|
this.nextStep();
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
this.setError('error-json-malformed');
|
this.setError('error-json-malformed');
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
if(this._hasAllNeededData(dataObject)) {
|
|
||||||
this._import(dataObject);
|
|
||||||
} else {
|
|
||||||
this._prepareAdditionalData(dataObject);
|
|
||||||
Popup.open(this._screenAdditionalData())(evt);
|
|
||||||
|
|
||||||
}
|
|
||||||
},
|
|
||||||
|
|
||||||
events() {
|
|
||||||
return [{
|
|
||||||
submit: this.onSubmit,
|
|
||||||
'click .show-mapping': this.onShowMapping,
|
|
||||||
}];
|
|
||||||
},
|
},
|
||||||
|
|
||||||
setError(error) {
|
setError(error) {
|
||||||
this.error.set(error);
|
this.error.set(error);
|
||||||
},
|
},
|
||||||
|
|
||||||
_import(dataObject) {
|
finishImport() {
|
||||||
const additionalData = this.getAdditionalData();
|
const additionalData = {};
|
||||||
const membersMapping = this.membersMapping();
|
const membersMapping = this.membersToMap.get();
|
||||||
if (membersMapping) {
|
if (membersMapping) {
|
||||||
const mappingById = {};
|
const mappingById = {};
|
||||||
membersMapping.forEach((member) => {
|
membersMapping.forEach((member) => {
|
||||||
|
|
@ -72,99 +50,75 @@ const ImportPopup = BlazeComponent.extendComponent({
|
||||||
});
|
});
|
||||||
additionalData.membersMapping = mappingById;
|
additionalData.membersMapping = mappingById;
|
||||||
}
|
}
|
||||||
Session.set('import.membersToMap', null);
|
this.membersToMap.set([]);
|
||||||
Session.set('import.text', null);
|
Meteor.call('importTrelloBoard', this.importedData.get(), additionalData,
|
||||||
Meteor.call(this.getMethodName(), dataObject, additionalData,
|
(err, res) => {
|
||||||
(error, response) => {
|
if (err) {
|
||||||
if (error) {
|
this.setError(err.error);
|
||||||
this.setError(error.error);
|
|
||||||
} else {
|
} else {
|
||||||
// ensure will display what we just imported
|
Utils.goBoardId(res);
|
||||||
Filter.addException(response);
|
|
||||||
this.onFinish(response);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
|
|
||||||
_hasAllNeededData(dataObject) {
|
|
||||||
// import has no members or they are already mapped
|
|
||||||
return dataObject.members.length === 0 || this.membersMapping();
|
|
||||||
},
|
|
||||||
|
|
||||||
_prepareAdditionalData(dataObject) {
|
_prepareAdditionalData(dataObject) {
|
||||||
// we will work on the list itself (an ordered array of objects)
|
// we will work on the list itself (an ordered array of objects) when a
|
||||||
// when a mapping is done, we add a 'wekan' field to the object representing the imported member
|
// mapping is done, we add a 'wekan' field to the object representing the
|
||||||
|
// imported member
|
||||||
const membersToMap = dataObject.members;
|
const membersToMap = dataObject.members;
|
||||||
// auto-map based on username
|
// auto-map based on username
|
||||||
membersToMap.forEach((importedMember) => {
|
membersToMap.forEach((importedMember) => {
|
||||||
const wekanUser = Users.findOne({username: importedMember.username});
|
const wekanUser = Users.findOne({ username: importedMember.username });
|
||||||
if(wekanUser) {
|
if (wekanUser) {
|
||||||
importedMember.wekan = wekanUser;
|
importedMember.wekan = wekanUser;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
// store members data and mapping in Session
|
// store members data and mapping in Session
|
||||||
// (we go deep and 2-way, so storing in data context is not a viable option)
|
// (we go deep and 2-way, so storing in data context is not a viable option)
|
||||||
Session.set('import.membersToMap', membersToMap);
|
this.membersToMap.set(membersToMap);
|
||||||
return membersToMap;
|
return membersToMap;
|
||||||
},
|
},
|
||||||
|
|
||||||
_screenAdditionalData() {
|
_screenAdditionalData() {
|
||||||
return 'mapMembers';
|
return 'mapMembers';
|
||||||
},
|
},
|
||||||
|
}).register('import');
|
||||||
|
|
||||||
_storeText() {
|
BlazeComponent.extendComponent({
|
||||||
const dataJson = this.$('.js-import-json').val();
|
template() {
|
||||||
Session.set('import.text', dataJson);
|
return 'importTextarea';
|
||||||
return dataJson;
|
|
||||||
},
|
|
||||||
});
|
|
||||||
|
|
||||||
ImportPopup.extendComponent({
|
|
||||||
getAdditionalData() {
|
|
||||||
const listId = this.currentData()._id;
|
|
||||||
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;
|
|
||||||
},
|
},
|
||||||
|
|
||||||
getMethodName() {
|
events() {
|
||||||
return 'importTrelloCard';
|
return [{
|
||||||
|
submit(evt) {
|
||||||
|
return this.parentComponent().importData(evt);
|
||||||
|
},
|
||||||
|
}];
|
||||||
|
},
|
||||||
|
}).register('importTextarea');
|
||||||
|
|
||||||
|
BlazeComponent.extendComponent({
|
||||||
|
onCreated() {
|
||||||
|
this.autorun(() => {
|
||||||
|
this.parentComponent().membersToMap.get().forEach(({ wekan }) => {
|
||||||
|
if (wekan !== undefined) {
|
||||||
|
const userId = wekan._id;
|
||||||
|
this.subscribe('user-miniprofile', userId);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
getLabel() {
|
|
||||||
return 'import-card-trello-instruction';
|
|
||||||
},
|
|
||||||
}).register('listImportCardPopup');
|
|
||||||
|
|
||||||
ImportPopup.extendComponent({
|
|
||||||
getAdditionalData() {
|
|
||||||
const result = {};
|
|
||||||
return result;
|
|
||||||
},
|
|
||||||
|
|
||||||
getMethodName() {
|
|
||||||
return 'importTrelloBoard';
|
|
||||||
},
|
|
||||||
|
|
||||||
getLabel() {
|
|
||||||
return 'import-board-trello-instruction';
|
|
||||||
},
|
|
||||||
|
|
||||||
onFinish(response) {
|
|
||||||
Utils.goBoardId(response);
|
|
||||||
},
|
|
||||||
}).register('boardImportBoardPopup');
|
|
||||||
|
|
||||||
const ImportMapMembers = BlazeComponent.extendComponent({
|
|
||||||
members() {
|
members() {
|
||||||
return Session.get('import.membersToMap');
|
return this.parentComponent().membersToMap.get();
|
||||||
},
|
},
|
||||||
|
|
||||||
_refreshMembers(listOfMembers) {
|
_refreshMembers(listOfMembers) {
|
||||||
Session.set('import.membersToMap', listOfMembers);
|
return this.parentComponent().membersToMap.set(listOfMembers);
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Will look into the list of members to import for the specified memberId,
|
* Will look into the list of members to import for the specified memberId,
|
||||||
* then set its property to the supplied value.
|
* then set its property to the supplied value.
|
||||||
|
|
@ -202,15 +156,17 @@ const ImportMapMembers = BlazeComponent.extendComponent({
|
||||||
// Session.get gives us a copy, we have to set it back so it sticks
|
// Session.get gives us a copy, we have to set it back so it sticks
|
||||||
this._refreshMembers(listOfMembers);
|
this._refreshMembers(listOfMembers);
|
||||||
},
|
},
|
||||||
|
|
||||||
setSelectedMember(memberId) {
|
setSelectedMember(memberId) {
|
||||||
return this._setPropertyForMember('selected', true, memberId, true);
|
return this._setPropertyForMember('selected', true, memberId, true);
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* returns the member with specified id,
|
* returns the member with specified id,
|
||||||
* or the selected member if memberId is not specified
|
* or the selected member if memberId is not specified
|
||||||
*/
|
*/
|
||||||
getMember(memberId = null) {
|
getMember(memberId = null) {
|
||||||
const allMembers = Session.get('import.membersToMap');
|
const allMembers = this.members();
|
||||||
let finder = null;
|
let finder = null;
|
||||||
if(memberId) {
|
if(memberId) {
|
||||||
finder = (user) => user.id === memberId;
|
finder = (user) => user.id === memberId;
|
||||||
|
|
@ -219,15 +175,20 @@ const ImportMapMembers = BlazeComponent.extendComponent({
|
||||||
}
|
}
|
||||||
return allMembers.find(finder);
|
return allMembers.find(finder);
|
||||||
},
|
},
|
||||||
|
|
||||||
mapSelectedMember(wekan) {
|
mapSelectedMember(wekan) {
|
||||||
return this._setPropertyForMember('wekan', wekan, null);
|
return this._setPropertyForMember('wekan', wekan, null);
|
||||||
},
|
},
|
||||||
|
|
||||||
unmapMember(memberId){
|
unmapMember(memberId){
|
||||||
return this._setPropertyForMember('wekan', null, memberId);
|
return this._setPropertyForMember('wekan', null, memberId);
|
||||||
},
|
},
|
||||||
});
|
|
||||||
|
|
||||||
ImportMapMembers.extendComponent({
|
onSubmit(evt) {
|
||||||
|
evt.preventDefault();
|
||||||
|
this.parentComponent().nextStep();
|
||||||
|
},
|
||||||
|
|
||||||
onMapMember(evt) {
|
onMapMember(evt) {
|
||||||
const memberToMap = this.currentData();
|
const memberToMap = this.currentData();
|
||||||
if(memberToMap.wekan) {
|
if(memberToMap.wekan) {
|
||||||
|
|
@ -235,33 +196,31 @@ ImportMapMembers.extendComponent({
|
||||||
this.unmapMember(memberToMap.id);
|
this.unmapMember(memberToMap.id);
|
||||||
} else {
|
} else {
|
||||||
this.setSelectedMember(memberToMap.id);
|
this.setSelectedMember(memberToMap.id);
|
||||||
Popup.open('mapMembersAdd')(evt);
|
Popup.open('importMapMembersAdd')(evt);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
onSubmit(evt) {
|
|
||||||
evt.preventDefault();
|
|
||||||
Popup.back();
|
|
||||||
},
|
|
||||||
events() {
|
events() {
|
||||||
return [{
|
return [{
|
||||||
'submit': this.onSubmit,
|
'submit': this.onSubmit,
|
||||||
'click .mapping': this.onMapMember,
|
'click .js-select-member': this.onMapMember,
|
||||||
}];
|
}];
|
||||||
},
|
},
|
||||||
}).register('mapMembersPopup');
|
}).register('importMapMembers');
|
||||||
|
|
||||||
|
BlazeComponent.extendComponent({
|
||||||
|
onRendered() {
|
||||||
|
this.find('.js-map-member input').focus();
|
||||||
|
},
|
||||||
|
|
||||||
ImportMapMembers.extendComponent({
|
|
||||||
onSelectUser(){
|
onSelectUser(){
|
||||||
this.mapSelectedMember(this.currentData());
|
Popup.getOpenerComponent().mapSelectedMember(this.currentData());
|
||||||
Popup.back();
|
Popup.back();
|
||||||
},
|
},
|
||||||
|
|
||||||
events() {
|
events() {
|
||||||
return [{
|
return [{
|
||||||
'click .js-select-import': this.onSelectUser,
|
'click .js-select-import': this.onSelectUser,
|
||||||
}];
|
}];
|
||||||
},
|
},
|
||||||
onRendered() {
|
}).register('importMapMembersAddPopup');
|
||||||
// todo XXX why do I not get the focus??
|
|
||||||
this.find('.js-map-member input').focus();
|
|
||||||
},
|
|
||||||
}).register('mapMembersAddPopup');
|
|
||||||
|
|
|
||||||
42
client/components/import/import.styl
vendored
42
client/components/import/import.styl
vendored
|
|
@ -1,17 +1,47 @@
|
||||||
@import 'nib'
|
@import 'nib'
|
||||||
|
|
||||||
.map-members
|
.map-members
|
||||||
.mapping:first-of-type
|
&:after
|
||||||
border-top: solid 1px #999
|
content: "";
|
||||||
.mapping
|
flex: auto;
|
||||||
padding: 10px 0
|
|
||||||
border-bottom: solid 1px #999
|
.mapping-list
|
||||||
.source
|
display: flex
|
||||||
|
flex-wrap: wrap
|
||||||
|
margin: 0 -4px
|
||||||
|
|
||||||
|
.mapping-item
|
||||||
|
max-width: 300px
|
||||||
|
min-width: 200px
|
||||||
|
padding: 6px
|
||||||
|
margin: 5px
|
||||||
|
flex:1
|
||||||
|
background: white
|
||||||
|
border-radius: 3px
|
||||||
|
box-shadow: 0 1px 2px rgba(0,0,0,.15)
|
||||||
|
|
||||||
|
&:hover
|
||||||
|
background: darken(white, 5%)
|
||||||
|
|
||||||
|
&.filled
|
||||||
|
background: #E0FFE5
|
||||||
|
|
||||||
|
&:hover
|
||||||
|
background: #FFE0E0
|
||||||
|
|
||||||
|
&.ghost-item
|
||||||
|
height: 0
|
||||||
|
visibility: hidden
|
||||||
|
border: none
|
||||||
|
|
||||||
|
.profile-source
|
||||||
display: inline-block
|
display: inline-block
|
||||||
width: 80%
|
width: 80%
|
||||||
|
|
||||||
.wekan
|
.wekan
|
||||||
display: inline-block
|
display: inline-block
|
||||||
width: 35px
|
width: 35px
|
||||||
|
|
||||||
.member
|
.member
|
||||||
float: none
|
float: none
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -26,13 +26,14 @@ body
|
||||||
#content
|
#content
|
||||||
position: relative
|
position: relative
|
||||||
flex: 1
|
flex: 1
|
||||||
overflow: hidden
|
overflow-x: hidden
|
||||||
|
|
||||||
.sk-spinner
|
.sk-spinner
|
||||||
margin-top: 30vh
|
margin-top: 30vh
|
||||||
|
|
||||||
> .wrapper
|
> .wrapper
|
||||||
margin-top: 25px
|
margin-top: 10px
|
||||||
|
padding: 15px
|
||||||
|
|
||||||
#modal
|
#modal
|
||||||
position: absolute
|
position: absolute
|
||||||
|
|
@ -109,6 +110,9 @@ a
|
||||||
cursor: default
|
cursor: default
|
||||||
text-decoration: none
|
text-decoration: none
|
||||||
|
|
||||||
|
span a
|
||||||
|
text-decoration: underline
|
||||||
|
|
||||||
strong
|
strong
|
||||||
font-weight: bold
|
font-weight: bold
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -142,6 +142,11 @@ window.Popup = new class {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
getOpenerComponent() {
|
||||||
|
const { openerElement } = Template.parentData(4);
|
||||||
|
return BlazeComponent.getComponentForElement(openerElement);
|
||||||
|
}
|
||||||
|
|
||||||
// An utility fonction that returns the top element of the internal stack
|
// An utility fonction that returns the top element of the internal stack
|
||||||
_getTopStack() {
|
_getTopStack() {
|
||||||
return this._stack[this._stack.length - 1];
|
return this._stack[this._stack.length - 1];
|
||||||
|
|
|
||||||
|
|
@ -79,6 +79,26 @@ FlowRouter.route('/shortcuts', {
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
|
FlowRouter.route('/import', {
|
||||||
|
name: 'import',
|
||||||
|
triggersEnter: [
|
||||||
|
AccountsTemplates.ensureSignedIn,
|
||||||
|
() => {
|
||||||
|
Session.set('currentBoard', null);
|
||||||
|
Session.set('currentCard', null);
|
||||||
|
|
||||||
|
Filter.reset();
|
||||||
|
EscapeActions.executeAll();
|
||||||
|
},
|
||||||
|
],
|
||||||
|
action() {
|
||||||
|
BlazeLayout.render('defaultLayout', {
|
||||||
|
headerBar: 'importHeaderBar',
|
||||||
|
content: 'import',
|
||||||
|
});
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
FlowRouter.notFound = {
|
FlowRouter.notFound = {
|
||||||
action() {
|
action() {
|
||||||
BlazeLayout.render('defaultLayout', { content: 'notFound' });
|
BlazeLayout.render('defaultLayout', { content: 'notFound' });
|
||||||
|
|
|
||||||
|
|
@ -78,7 +78,6 @@
|
||||||
"boardChangeTitlePopup-title": "Rename Board",
|
"boardChangeTitlePopup-title": "Rename Board",
|
||||||
"boardChangeVisibilityPopup-title": "Change Visibility",
|
"boardChangeVisibilityPopup-title": "Change Visibility",
|
||||||
"boardChangeWatchPopup-title": "Change Watch",
|
"boardChangeWatchPopup-title": "Change Watch",
|
||||||
"boardImportBoardPopup-title": "Import board from Trello",
|
|
||||||
"boardMenuPopup-title": "Board Menu",
|
"boardMenuPopup-title": "Board Menu",
|
||||||
"boards": "Boards",
|
"boards": "Boards",
|
||||||
"bucket-example": "Like “Bucket List” for example",
|
"bucket-example": "Like “Bucket List” for example",
|
||||||
|
|
@ -181,13 +180,14 @@
|
||||||
"home": "Home",
|
"home": "Home",
|
||||||
"import": "Import",
|
"import": "Import",
|
||||||
"import-board": "import from Trello",
|
"import-board": "import from Trello",
|
||||||
"import-board-trello-instruction": "In your Trello board, go to 'Menu', then 'More', 'Print and Export', 'Export JSON', and copy the resulting text",
|
"import-board-title": "Import board from Trello",
|
||||||
"import-card": "Import a Trello card",
|
"import-board-trello-instruction": "In your Trello board, go to 'Menu', then 'More', 'Print and Export', 'Export JSON', and copy the resulting text.",
|
||||||
"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-json-placeholder": "Paste your valid JSON data here",
|
||||||
|
"import-map-members": "Map members",
|
||||||
"import-members-map": "Your imported board has some members. Please map the members you want to import to Wekan users",
|
"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-show-user-mapping": "Review members mapping",
|
||||||
"import-user-select": "Pick the Wekan user you want to use as this member",
|
"import-user-select": "Pick the Wekan user you want to use as this member",
|
||||||
|
"importMapMembersAddPopup-title": "Select Wekan member",
|
||||||
"info": "Infos",
|
"info": "Infos",
|
||||||
"initials": "Initials",
|
"initials": "Initials",
|
||||||
"joined": "joined",
|
"joined": "joined",
|
||||||
|
|
@ -210,8 +210,6 @@
|
||||||
"lists": "Lists",
|
"lists": "Lists",
|
||||||
"log-out": "Log Out",
|
"log-out": "Log Out",
|
||||||
"loginPopup-title": "Log In",
|
"loginPopup-title": "Log In",
|
||||||
"mapMembersAddPopup-title": "Select Wekan member",
|
|
||||||
"mapMembersPopup-title": "Map members",
|
|
||||||
"memberMenuPopup-title": "Member Settings",
|
"memberMenuPopup-title": "Member Settings",
|
||||||
"members": "Members",
|
"members": "Members",
|
||||||
"menu": "Menu",
|
"menu": "Menu",
|
||||||
|
|
@ -224,7 +222,6 @@
|
||||||
"muted-info": "You will never be notified of any changes in this board",
|
"muted-info": "You will never be notified of any changes in this board",
|
||||||
"my-boards": "My Boards",
|
"my-boards": "My Boards",
|
||||||
"name": "Name",
|
"name": "Name",
|
||||||
"name": "Name",
|
|
||||||
"no-archived-cards": "No archived cards.",
|
"no-archived-cards": "No archived cards.",
|
||||||
"no-archived-lists": "No archived lists.",
|
"no-archived-lists": "No archived lists.",
|
||||||
"no-results": "No results",
|
"no-results": "No results",
|
||||||
|
|
|
||||||
|
|
@ -470,42 +470,4 @@ Meteor.methods({
|
||||||
// XXX add members
|
// XXX add members
|
||||||
return boardId;
|
return boardId;
|
||||||
},
|
},
|
||||||
|
|
||||||
importTrelloCard(trelloCard, data) {
|
|
||||||
const trelloCreator = new TrelloCreator(data);
|
|
||||||
|
|
||||||
// 1. check parameters are ok from a syntax point of view
|
|
||||||
try {
|
|
||||||
check(data, {
|
|
||||||
listId: String,
|
|
||||||
sortIndex: Number,
|
|
||||||
membersMapping: Match.Optional(Object),
|
|
||||||
});
|
|
||||||
trelloCreator.checkCards([trelloCard]);
|
|
||||||
trelloCreator.checkLabels(trelloCard.labels);
|
|
||||||
trelloCreator.checkActions(trelloCard.actions);
|
|
||||||
} catch(e) {
|
|
||||||
throw new Meteor.Error('error-json-schema');
|
|
||||||
}
|
|
||||||
|
|
||||||
// 2. check parameters are ok from a business point of view (exist &
|
|
||||||
// authorized)
|
|
||||||
const list = Lists.findOne(data.listId);
|
|
||||||
if (!list) {
|
|
||||||
throw new Meteor.Error('error-list-doesNotExist');
|
|
||||||
}
|
|
||||||
if (Meteor.isServer) {
|
|
||||||
if (!allowIsBoardMember(Meteor.userId(), Boards.findOne(list.boardId))) {
|
|
||||||
throw new Meteor.Error('error-board-notAMember');
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// 3. create all elements
|
|
||||||
trelloCreator.lists[trelloCard.idList] = data.listId;
|
|
||||||
trelloCreator.parseActions(trelloCard.actions);
|
|
||||||
const board = list.board();
|
|
||||||
trelloCreator.createLabels(trelloCard.labels, board);
|
|
||||||
const cardIds = trelloCreator.createCards([trelloCard], board._id);
|
|
||||||
return cardIds[0];
|
|
||||||
},
|
|
||||||
});
|
});
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,11 @@
|
||||||
|
Meteor.publish('user-miniprofile', function(userId) {
|
||||||
|
check(userId, String);
|
||||||
|
|
||||||
|
return Users.find(userId, {
|
||||||
|
fields: {
|
||||||
|
'username': 1,
|
||||||
|
'profile.fullname': 1,
|
||||||
|
'profile.avatarUrl': 1,
|
||||||
|
},
|
||||||
|
});
|
||||||
|
});
|
||||||
Loading…
Add table
Add a link
Reference in a new issue