triggers.js 909 B

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. Triggers = new Mongo.Collection('triggers');
  2. Triggers.mutations({
  3. rename(description) {
  4. return { $set: { description } };
  5. },
  6. });
  7. Triggers.allow({
  8. update: function () {
  9. // add custom authentication code here
  10. return true;
  11. },
  12. insert: function () {
  13. // add custom authentication code here
  14. return true;
  15. },
  16. remove: function () {
  17. // add custom authentication code here
  18. return true;
  19. }
  20. });
  21. Triggers.helpers({
  22. getRule(){
  23. return Rules.findOne({triggerId:this._id});
  24. },
  25. fromList() {
  26. return Lists.findOne(this.fromId);
  27. },
  28. toList() {
  29. return Lists.findOne(this.toId);
  30. },
  31. findList(title) {
  32. return Lists.findOne({title:title});
  33. },
  34. labels() {
  35. const boardLabels = this.board().labels;
  36. const cardLabels = _.filter(boardLabels, (label) => {
  37. return _.contains(this.labelIds, label._id);
  38. });
  39. return cardLabels;
  40. }});