actions.js 755 B

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. Actions = new Mongo.Collection('actions');
  2. Actions.mutations({
  3. rename(description) {
  4. return { $set: { description } };
  5. },
  6. });
  7. Actions.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. });
  17. Actions.helpers({
  18. fromList() {
  19. return Lists.findOne(this.fromId);
  20. },
  21. toList() {
  22. return Lists.findOne(this.toId);
  23. },
  24. findList(title) {
  25. return Lists.findOne({title:title});
  26. },
  27. labels() {
  28. const boardLabels = this.board().labels;
  29. const cardLabels = _.filter(boardLabels, (label) => {
  30. return _.contains(this.labelIds, label._id);
  31. });
  32. return cardLabels;
  33. }});