123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122 |
- BlazeComponent.extendComponent({
- onCreated() {
- },
- events() {
- return [{
- 'click .js-add-spec-move-action' (event) {
- const ruleName = this.data().ruleName.get();
- const trigger = this.data().triggerVar.get();
- const actionSelected = this.find('#move-spec-action').value;
- const listTitle = this.find('#listName').value;
- const boardId = Session.get('currentBoard');
- const desc = Utils.getTriggerActionDesc(event, this);
- if (actionSelected === 'top') {
- const triggerId = Triggers.insert(trigger);
- const actionId = Actions.insert({
- actionType: 'moveCardToTop',
- listTitle,
- boardId,
- desc,
- });
- Rules.insert({
- title: ruleName,
- triggerId,
- actionId,
- boardId,
- });
- }
- if (actionSelected === 'bottom') {
- const triggerId = Triggers.insert(trigger);
- const actionId = Actions.insert({
- actionType: 'moveCardToBottom',
- listTitle,
- boardId,
- desc,
- });
- Rules.insert({
- title: ruleName,
- triggerId,
- actionId,
- boardId,
- });
- }
- },
- 'click .js-add-gen-move-action' (event) {
- const desc = Utils.getTriggerActionDesc(event, this);
- const boardId = Session.get('currentBoard');
- const ruleName = this.data().ruleName.get();
- const trigger = this.data().triggerVar.get();
- const actionSelected = this.find('#move-gen-action').value;
- if (actionSelected === 'top') {
- const triggerId = Triggers.insert(trigger);
- const actionId = Actions.insert({
- actionType: 'moveCardToTop',
- 'listTitle': '*',
- boardId,
- desc,
- });
- Rules.insert({
- title: ruleName,
- triggerId,
- actionId,
- boardId,
- });
- }
- if (actionSelected === 'bottom') {
- const triggerId = Triggers.insert(trigger);
- const actionId = Actions.insert({
- actionType: 'moveCardToBottom',
- 'listTitle': '*',
- boardId,
- desc,
- });
- Rules.insert({
- title: ruleName,
- triggerId,
- actionId,
- boardId,
- });
- }
- },
- 'click .js-add-arch-action' (event) {
- const desc = Utils.getTriggerActionDesc(event, this);
- const boardId = Session.get('currentBoard');
- const ruleName = this.data().ruleName.get();
- const trigger = this.data().triggerVar.get();
- const actionSelected = this.find('#arch-action').value;
- if (actionSelected === 'archive') {
- const triggerId = Triggers.insert(trigger);
- const actionId = Actions.insert({
- actionType: 'archive',
- boardId,
- desc,
- });
- Rules.insert({
- title: ruleName,
- triggerId,
- actionId,
- boardId,
- });
- }
- if (actionSelected === 'unarchive') {
- const triggerId = Triggers.insert(trigger);
- const actionId = Actions.insert({
- actionType: 'unarchive',
- boardId,
- desc,
- });
- Rules.insert({
- title: ruleName,
- triggerId,
- actionId,
- boardId,
- });
- }
- },
- }];
- },
- }).register('boardActions');
- /* eslint-no-undef */
|