mirror of
https://github.com/wekan/wekan.git
synced 2025-04-25 06:27:10 -04:00
Merge branch 'trello-import' of https://github.com/jrsupplee/wekan into jrsupplee-trello-import
This commit is contained in:
commit
b8ab5e0e8d
8 changed files with 2479 additions and 7 deletions
|
@ -52,6 +52,14 @@ template(name="cardCustomField-number")
|
||||||
if value
|
if value
|
||||||
= value
|
= value
|
||||||
|
|
||||||
|
template(name="cardCustomField-checkbox")
|
||||||
|
.js-checklist-item.checklist-item(class="{{#if data.value }}is-checked{{/if}}")
|
||||||
|
if canModifyCard
|
||||||
|
.check-box-container
|
||||||
|
.check-box.materialCheckBox(class="{{#if data.value }}is-checked{{/if}}")
|
||||||
|
else
|
||||||
|
.materialCheckBox(class="{{#if data.value }}is-checked{{/if}}")
|
||||||
|
|
||||||
template(name="cardCustomField-currency")
|
template(name="cardCustomField-currency")
|
||||||
if canModifyCard
|
if canModifyCard
|
||||||
+inlinedForm(classNames="js-card-customfield-currency")
|
+inlinedForm(classNames="js-card-customfield-currency")
|
||||||
|
|
|
@ -80,6 +80,25 @@ CardCustomField.register('cardCustomField');
|
||||||
}
|
}
|
||||||
}.register('cardCustomField-number'));
|
}.register('cardCustomField-number'));
|
||||||
|
|
||||||
|
// cardCustomField-checkbox
|
||||||
|
(class extends CardCustomField {
|
||||||
|
onCreated() {
|
||||||
|
super.onCreated();
|
||||||
|
}
|
||||||
|
|
||||||
|
toggleItem() {
|
||||||
|
this.card.setCustomField(this.customFieldId, !this.data().value);
|
||||||
|
}
|
||||||
|
|
||||||
|
events() {
|
||||||
|
return [
|
||||||
|
{
|
||||||
|
'click .js-checklist-item .check-box-container': this.toggleItem,
|
||||||
|
},
|
||||||
|
];
|
||||||
|
}
|
||||||
|
}.register('cardCustomField-checkbox'));
|
||||||
|
|
||||||
// cardCustomField-currency
|
// cardCustomField-currency
|
||||||
(class extends CardCustomField {
|
(class extends CardCustomField {
|
||||||
onCreated() {
|
onCreated() {
|
||||||
|
|
|
@ -7,4 +7,3 @@ template(name="dateBadge")
|
||||||
a.card-date(title="{{showTitle}}" class="{{classes}}")
|
a.card-date(title="{{showTitle}}" class="{{classes}}")
|
||||||
time(datetime="{{showISODate}}")
|
time(datetime="{{showISODate}}")
|
||||||
| {{showDate}}
|
| {{showDate}}
|
||||||
|
|
||||||
|
|
|
@ -77,6 +77,8 @@ template(name="minicard")
|
||||||
if $eq definition.type "currency"
|
if $eq definition.type "currency"
|
||||||
+viewer
|
+viewer
|
||||||
= formattedCurrencyCustomFieldValue(definition)
|
= formattedCurrencyCustomFieldValue(definition)
|
||||||
|
else if $eq definition.type "checkbox"
|
||||||
|
.materialCheckBox(class="{{#if value }}is-checked{{/if}}")
|
||||||
else
|
else
|
||||||
+viewer
|
+viewer
|
||||||
= trueValue
|
= trueValue
|
||||||
|
|
|
@ -22,7 +22,14 @@ CustomFields.attachSchema(
|
||||||
* type of the custom field
|
* type of the custom field
|
||||||
*/
|
*/
|
||||||
type: String,
|
type: String,
|
||||||
allowedValues: ['text', 'number', 'date', 'dropdown', 'currency'],
|
allowedValues: [
|
||||||
|
'text',
|
||||||
|
'number',
|
||||||
|
'date',
|
||||||
|
'dropdown',
|
||||||
|
'checkbox',
|
||||||
|
'currency',
|
||||||
|
],
|
||||||
},
|
},
|
||||||
settings: {
|
settings: {
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -40,6 +40,8 @@ export class TrelloCreator {
|
||||||
|
|
||||||
// maps a trelloCardId to an array of trelloAttachments
|
// maps a trelloCardId to an array of trelloAttachments
|
||||||
this.attachments = {};
|
this.attachments = {};
|
||||||
|
|
||||||
|
this.customFields = {};
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -161,6 +163,7 @@ export class TrelloCreator {
|
||||||
// very old boards won't have a creation activity so no creation date
|
// very old boards won't have a creation activity so no creation date
|
||||||
createdAt: this._now(this.createdAt.board),
|
createdAt: this._now(this.createdAt.board),
|
||||||
labels: [],
|
labels: [],
|
||||||
|
customFields: [],
|
||||||
members: [
|
members: [
|
||||||
{
|
{
|
||||||
userId: Meteor.userId(),
|
userId: Meteor.userId(),
|
||||||
|
@ -232,6 +235,36 @@ export class TrelloCreator {
|
||||||
// not the author from the original object.
|
// not the author from the original object.
|
||||||
userId: this._user(),
|
userId: this._user(),
|
||||||
});
|
});
|
||||||
|
if (trelloBoard.customFields) {
|
||||||
|
trelloBoard.customFields.forEach(field => {
|
||||||
|
const fieldToCreate = {
|
||||||
|
// trelloId: field.id,
|
||||||
|
name: field.name,
|
||||||
|
showOnCard: field.display.cardFront,
|
||||||
|
showLabelOnMiniCard: field.display.cardFront,
|
||||||
|
automaticallyOnCard: true,
|
||||||
|
type: field.type,
|
||||||
|
boardIds: [boardId],
|
||||||
|
settings: {},
|
||||||
|
};
|
||||||
|
|
||||||
|
if (field.type === 'list') {
|
||||||
|
fieldToCreate.type = 'dropdown';
|
||||||
|
fieldToCreate.settings = {
|
||||||
|
dropdownItems: field.options.map(opt => {
|
||||||
|
return {
|
||||||
|
_id: opt.id,
|
||||||
|
name: opt.value.text,
|
||||||
|
};
|
||||||
|
}),
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
// We need to remember them by Trello ID, as this is the only ref we have
|
||||||
|
// when importing cards.
|
||||||
|
this.customFields[field.id] = CustomFields.direct.insert(fieldToCreate);
|
||||||
|
});
|
||||||
|
}
|
||||||
return boardId;
|
return boardId;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -309,6 +342,27 @@ export class TrelloCreator {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (card.customFieldItems) {
|
||||||
|
cardToCreate.customFields = [];
|
||||||
|
card.customFieldItems.forEach(item => {
|
||||||
|
const custom = {
|
||||||
|
_id: this.customFields[item.idCustomField],
|
||||||
|
};
|
||||||
|
if (item.idValue) {
|
||||||
|
custom.value = item.idValue;
|
||||||
|
} else if (item.value.hasOwnProperty('checked')) {
|
||||||
|
custom.value = item.value.checked === 'true';
|
||||||
|
} else if (item.value.hasOwnProperty('text')) {
|
||||||
|
custom.value = item.value.text;
|
||||||
|
} else if (item.value.hasOwnProperty('date')) {
|
||||||
|
custom.value = item.value.date;
|
||||||
|
} else if (item.value.hasOwnProperty('number')) {
|
||||||
|
custom.value = item.value.number;
|
||||||
|
}
|
||||||
|
cardToCreate.customFields.push(custom);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
// insert card
|
// insert card
|
||||||
const cardId = Cards.direct.insert(cardToCreate);
|
const cardId = Cards.direct.insert(cardToCreate);
|
||||||
// keep track of Trello id => Wekan id
|
// keep track of Trello id => Wekan id
|
||||||
|
|
2383
trello/trello-project100.json
Normal file
2383
trello/trello-project100.json
Normal file
File diff suppressed because it is too large
Load diff
Loading…
Add table
Add a link
Reference in a new issue