The Open Source kanban (built with Meteor). Keep variable/table/field names camelCase. For translations, only add Pull Request changes to wekan/i18n/en.i18n.json , other translations are done at https://transifex.com/wekan/wekan only.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
wekan/client/components/rules/triggers/checklistTriggers.js

147 lines
4.7 KiB

BlazeComponent.extendComponent({
onCreated() {
this.subscribe('allRules');
},
events() {
7 years ago
return [{
'click .js-add-gen-check-trigger' (event) {
const desc = Utils.getTriggerActionDesc(event, this);
7 years ago
const datas = this.data();
7 years ago
const actionSelected = this.find('#gen-check-action').value;
7 years ago
const boardId = Session.get('currentBoard');
if (actionSelected === 'created') {
7 years ago
datas.triggerVar.set({
7 years ago
activityType: 'addChecklist',
boardId,
'checklistName': '*',
desc,
7 years ago
});
}
7 years ago
if (actionSelected === 'removed') {
7 years ago
datas.triggerVar.set({
7 years ago
activityType: 'removeChecklist',
boardId,
'checklistName': '*',
desc,
7 years ago
});
}
},
'click .js-add-spec-check-trigger' (event) {
const desc = Utils.getTriggerActionDesc(event, this);
7 years ago
const datas = this.data();
7 years ago
const actionSelected = this.find('#spec-check-action').value;
const checklistId = this.find('#check-name').value;
7 years ago
const boardId = Session.get('currentBoard');
if (actionSelected === 'created') {
7 years ago
datas.triggerVar.set({
7 years ago
activityType: 'addChecklist',
boardId,
'checklistName': checklistId,
desc,
7 years ago
});
}
7 years ago
if (actionSelected === 'removed') {
7 years ago
datas.triggerVar.set({
7 years ago
activityType: 'removeChecklist',
boardId,
'checklistName': checklistId,
desc,
7 years ago
});
}
},
'click .js-add-gen-comp-trigger' (event) {
const desc = Utils.getTriggerActionDesc(event, this);
7 years ago
const datas = this.data();
7 years ago
const actionSelected = this.find('#gen-comp-check-action').value;
7 years ago
const boardId = Session.get('currentBoard');
if (actionSelected === 'completed') {
7 years ago
datas.triggerVar.set({
7 years ago
activityType: 'completeChecklist',
boardId,
'checklistName': '*',
desc,
7 years ago
});
}
7 years ago
if (actionSelected === 'uncompleted') {
7 years ago
datas.triggerVar.set({
7 years ago
activityType: 'uncompleteChecklist',
boardId,
'checklistName': '*',
desc,
7 years ago
});
}
},
'click .js-add-spec-comp-trigger' (event) {
const desc = Utils.getTriggerActionDesc(event, this);
7 years ago
const datas = this.data();
7 years ago
const actionSelected = this.find('#spec-comp-check-action').value;
const checklistId = this.find('#spec-comp-check-name').value;
7 years ago
const boardId = Session.get('currentBoard');
7 years ago
if (actionSelected === 'completed') {
7 years ago
datas.triggerVar.set({
7 years ago
activityType: 'completeChecklist',
boardId,
'checklistName': checklistId,
desc,
7 years ago
});
}
7 years ago
if (actionSelected === 'uncompleted') {
7 years ago
datas.triggerVar.set({
7 years ago
activityType: 'uncompleteChecklist',
boardId,
'checklistName': checklistId,
desc,
7 years ago
});
}
},
'click .js-add-gen-check-item-trigger' (event) {
const desc = Utils.getTriggerActionDesc(event, this);
7 years ago
const datas = this.data();
7 years ago
const actionSelected = this.find('#check-item-gen-action').value;
7 years ago
const boardId = Session.get('currentBoard');
if (actionSelected === 'checked') {
7 years ago
datas.triggerVar.set({
7 years ago
activityType: 'checkedItem',
boardId,
'checklistItemName': '*',
desc,
7 years ago
});
}
7 years ago
if (actionSelected === 'unchecked') {
7 years ago
datas.triggerVar.set({
7 years ago
activityType: 'uncheckedItem',
boardId,
'checklistItemName': '*',
desc,
7 years ago
});
}
},
'click .js-add-spec-check-item-trigger' (event) {
const desc = Utils.getTriggerActionDesc(event, this);
7 years ago
const datas = this.data();
7 years ago
const actionSelected = this.find('#check-item-spec-action').value;
const checklistItemId = this.find('#check-item-name').value;
7 years ago
const boardId = Session.get('currentBoard');
if (actionSelected === 'checked') {
7 years ago
datas.triggerVar.set({
7 years ago
activityType: 'checkedItem',
boardId,
'checklistItemName': checklistItemId,
desc,
7 years ago
});
}
7 years ago
if (actionSelected === 'unchecked') {
7 years ago
datas.triggerVar.set({
7 years ago
activityType: 'uncheckedItem',
boardId,
'checklistItemName': checklistItemId,
desc,
7 years ago
});
}
},
}];
},
7 years ago
}).register('checklistTriggers');