summaryrefslogtreecommitdiffstats
path: root/models/triggers.js
diff options
context:
space:
mode:
Diffstat (limited to 'models/triggers.js')
-rw-r--r--models/triggers.js88
1 files changed, 70 insertions, 18 deletions
diff --git a/models/triggers.js b/models/triggers.js
index a1437ea6..c5ed849e 100644
--- a/models/triggers.js
+++ b/models/triggers.js
@@ -24,28 +24,80 @@ Triggers.allow({
Triggers.helpers({
- getRule(){
- return Rules.findOne({triggerId:this._id});
- },
+ description(){
+ if(this.activityType == "createCard"){
+ if(this.listName == "*"){
+ return TAPi18n.__('r-when-a-card-is') + " " + TAPi18n.__('r-added-to').toLowerCase() + " " + TAPi18n.__('r-the-board');
+ }else{
+ return TAPi18n.__('r-when-a-card-is') + " " + TAPi18n.__('r-added-to').toLowerCase() + " " + TAPi18n.__('r-list') + " " +this.listName;
+ }
+ }
+ if(this.activityType == "removeCard"){
+ if(this.listName == "*"){
+ return TAPi18n.__('r-when-a-card-is') + " " + TAPi18n.__('r-removed-from') + " " + TAPi18n.__('r-the-board');
+ }else{
+ return TAPi18n.__('r-when-a-card-is') + " " + TAPi18n.__('r-removed-from') + " " + TAPi18n.__('r-list') + " " +this.listName;
+ }
+ }
+ if(this.activityType == "moveCard"){
+ if(this.listName = "*"){
+ return TAPi18n.__('r-when-a-card-is') + " " + TAPi18n.__('r-moved-from') + " " + this.oldListName;
+ }else{
+ return TAPi18n.__('r-when-a-card-is') + " " + TAPi18n.__('r-moved-to') + " " + this.listName;
+ }
+
+ }
+ if(this.activityType = "archivedCard"){
+ return TAPi18n.__('r-when-a-card-is') + " " + TAPi18n.__('r-archived');
+ }
+ if(this.activityType = "restoredCard"){
+ return TAPi18n.__('r-when-a-card-is') + " " + TAPi18n.__('r-unarchived');
+ }
+ if(this.activityType = "addedLabel"){
+ if(this.labelId == "*"){
+ return TAPi18n.__('r-when-a-label-is') + " " + TAPi18n.__('r-added-to') + " " + TAPi18n.__('r-a-card');
+ }else{
+ const board = Boards.findOne(Session.get('currentBoard'));
+ const label = board.getLabelById(this.labelId);
+ let name;
+ if(label.name == "" || label.name == undefined){
+ name = label.color.toUpperCase();
+ }else{
+ name = label.name;
+ }
+ }
+ }
+ if(this.activityType = "restoredCard"){
+ return TAPi18n.__('r-when-a-card-is') + " " + TAPi18n.__('r-unarchived');
+ }
- fromList() {
- return Lists.findOne(this.fromId);
- },
- toList() {
- return Lists.findOne(this.toId);
- },
- findList(title) {
- return Lists.findOne({title:title});
- },
+ return "No description found";
+},
+
+getRule(){
+ return Rules.findOne({triggerId:this._id});
+},
+
+fromList() {
+ return Lists.findOne(this.fromId);
+},
+
+toList() {
+ return Lists.findOne(this.toId);
+},
+
+findList(title) {
+ return Lists.findOne({title:title});
+},
- labels() {
- const boardLabels = this.board().labels;
- const cardLabels = _.filter(boardLabels, (label) => {
- return _.contains(this.labelIds, label._id);
- });
- return cardLabels;
+labels() {
+ const boardLabels = this.board().labels;
+ const cardLabels = _.filter(boardLabels, (label) => {
+ return _.contains(this.labelIds, label._id);
+ });
+ return cardLabels;
}});