summaryrefslogtreecommitdiffstats
path: root/client/components/sidebar/sidebarCustomFields.js
diff options
context:
space:
mode:
authorLauri Ojansivu <x@xet7.org>2019-03-20 19:30:44 +0200
committerLauri Ojansivu <x@xet7.org>2019-03-20 19:30:44 +0200
commitdce89bcfa84106ecb18ba65247d13003f9aac660 (patch)
treef4ccebb1fbd74981e00ca759c177ee57a5c9ee0e /client/components/sidebar/sidebarCustomFields.js
parente5370ce859a0d18f2d4a94216e9baf808062c617 (diff)
parent777d9ac35320cbfdd8d90136b176d4a3e69e74be (diff)
downloadwekan-dce89bcfa84106ecb18ba65247d13003f9aac660.tar.gz
wekan-dce89bcfa84106ecb18ba65247d13003f9aac660.tar.bz2
wekan-dce89bcfa84106ecb18ba65247d13003f9aac660.zip
Merge branch 'edge' of https://github.com/andresmanelli/wekan into andresmanelli-edge
Diffstat (limited to 'client/components/sidebar/sidebarCustomFields.js')
-rw-r--r--client/components/sidebar/sidebarCustomFields.js16
1 files changed, 12 insertions, 4 deletions
diff --git a/client/components/sidebar/sidebarCustomFields.js b/client/components/sidebar/sidebarCustomFields.js
index ccc8ffb9..28af973b 100644
--- a/client/components/sidebar/sidebarCustomFields.js
+++ b/client/components/sidebar/sidebarCustomFields.js
@@ -2,7 +2,7 @@ BlazeComponent.extendComponent({
customFields() {
return CustomFields.find({
- boardId: Session.get('currentBoard'),
+ boardIds: {$in: [Session.get('currentBoard')]},
});
},
@@ -103,7 +103,6 @@ const CreateCustomFieldPopup = BlazeComponent.extendComponent({
evt.preventDefault();
const data = {
- boardId: Session.get('currentBoard'),
name: this.find('.js-field-name').value.trim(),
type: this.type.get(),
settings: this.getSettings(),
@@ -114,6 +113,7 @@ const CreateCustomFieldPopup = BlazeComponent.extendComponent({
// insert or update
if (!this.data()._id) {
+ data.boardIds = [Session.get('currentBoard')];
CustomFields.insert(data);
} else {
CustomFields.update(this.data()._id, {$set: data});
@@ -122,8 +122,16 @@ const CreateCustomFieldPopup = BlazeComponent.extendComponent({
Popup.back();
},
'click .js-delete-custom-field': Popup.afterConfirm('deleteCustomField', function() {
- const customFieldId = this._id;
- CustomFields.remove(customFieldId);
+ const customField = CustomFields.findOne(this._id);
+ if (customField.boardIds.length > 1) {
+ CustomFields.update(customField._id, {
+ $pull: {
+ boardIds: Session.get('currentBoard'),
+ },
+ });
+ } else {
+ CustomFields.remove(customField._id);
+ }
Popup.close();
}),
}];