diff options
Diffstat (limited to 'client/components/activities/activities.js')
-rw-r--r-- | client/components/activities/activities.js | 63 |
1 files changed, 59 insertions, 4 deletions
diff --git a/client/components/activities/activities.js b/client/components/activities/activities.js index ccb064f3..0476897f 100644 --- a/client/components/activities/activities.js +++ b/client/components/activities/activities.js @@ -8,16 +8,24 @@ BlazeComponent.extendComponent({ const sidebar = this.parentComponent(); // XXX for some reason not working sidebar.callFirstWith(null, 'resetNextPeak'); this.autorun(() => { - const mode = this.data().mode; + let mode = this.data().mode; const capitalizedMode = Utils.capitalize(mode); - const id = Session.get(`current${capitalizedMode}`); + let thisId, searchId; + if (mode === 'linkedcard' || mode === 'linkedboard') { + thisId = Session.get('currentCard'); + searchId = Cards.findOne({_id: thisId}).linkedId; + mode = mode.replace('linked', ''); + } else { + thisId = Session.get(`current${capitalizedMode}`); + searchId = thisId; + } const limit = this.page.get() * activitiesPerPage; const user = Meteor.user(); const hideSystem = user ? user.hasHiddenSystemMessages() : false; - if (id === null) + if (searchId === null) return; - this.subscribe('activities', mode, id, limit, hideSystem, () => { + this.subscribe('activities', mode, searchId, limit, hideSystem, () => { this.loadNextPageLocked = false; // If the sibear peak hasn't increased, that mean that there are no more @@ -42,6 +50,12 @@ BlazeComponent.extendComponent({ } }, + checkItem(){ + const checkItemId = this.currentData().checklistItemId; + const checkItem = ChecklistItems.findOne({_id:checkItemId}); + return checkItem.title; + }, + boardLabel() { return TAPi18n.__('this-board'); }, @@ -58,6 +72,40 @@ BlazeComponent.extendComponent({ }, card.title)); }, + lastLabel(){ + const lastLabelId = this.currentData().labelId; + if (!lastLabelId) + return null; + const lastLabel = Boards.findOne(Session.get('currentBoard')).getLabelById(lastLabelId); + if(lastLabel.name === undefined || lastLabel.name === ''){ + return lastLabel.color; + }else{ + return lastLabel.name; + } + }, + + lastCustomField(){ + const lastCustomField = CustomFields.findOne(this.currentData().customFieldId); + if (!lastCustomField) + return null; + return lastCustomField.name; + }, + + lastCustomFieldValue(){ + const lastCustomField = CustomFields.findOne(this.currentData().customFieldId); + if (!lastCustomField) + return null; + const value = this.currentData().value; + if (lastCustomField.settings.dropdownItems && lastCustomField.settings.dropdownItems.length > 0) { + const dropDownValue = _.find(lastCustomField.settings.dropdownItems, (item) => { + return item._id === value; + }); + if (dropDownValue) + return dropDownValue.name; + } + return value; + }, + listLabel() { return this.currentData().list().title; }, @@ -91,6 +139,13 @@ BlazeComponent.extendComponent({ }, attachment.name())); }, + customField() { + const customField = this.currentData().customField(); + if (!customField) + return null; + return customField.name; + }, + events() { return [{ // XXX We should use Popup.afterConfirmation here |