summaryrefslogtreecommitdiffstats
path: root/client/components/cards/cardDetails.js
diff options
context:
space:
mode:
Diffstat (limited to 'client/components/cards/cardDetails.js')
-rw-r--r--client/components/cards/cardDetails.js102
1 files changed, 51 insertions, 51 deletions
diff --git a/client/components/cards/cardDetails.js b/client/components/cards/cardDetails.js
index aba7254a..69e0cfdd 100644
--- a/client/components/cards/cardDetails.js
+++ b/client/components/cards/cardDetails.js
@@ -1,39 +1,39 @@
BlazeComponent.extendComponent({
- template: function() {
+ template() {
return 'cardDetails';
},
- mixins: function() {
+ mixins() {
return [Mixins.InfiniteScrolling, Mixins.PerfectScrollbar];
},
- calculateNextPeak: function() {
- var altitude = this.find('.js-card-details').scrollHeight;
+ calculateNextPeak() {
+ const altitude = this.find('.js-card-details').scrollHeight;
this.callFirstWith(this, 'setNextPeak', altitude);
},
- reachNextPeak: function() {
- var activitiesComponent = this.componentChildren('activities')[0];
+ reachNextPeak() {
+ const activitiesComponent = this.componentChildren('activities')[0];
activitiesComponent.loadNextPage();
},
- onCreated: function() {
+ onCreated() {
this.isLoaded = new ReactiveVar(false);
this.componentParent().showOverlay.set(true);
this.componentParent().mouseHasEnterCardDetails = false;
},
- scrollParentContainer: function() {
+ scrollParentContainer() {
const cardPanelWidth = 510;
- let bodyBoardComponent = this.componentParent();
+ const bodyBoardComponent = this.componentParent();
- let $cardContainer = bodyBoardComponent.$('.js-lists');
- let $cardView = this.$(this.firstNode());
- let cardContainerScroll = $cardContainer.scrollLeft();
- let cardContainerWidth = $cardContainer.width();
+ const $cardContainer = bodyBoardComponent.$('.js-lists');
+ const $cardView = this.$(this.firstNode());
+ const cardContainerScroll = $cardContainer.scrollLeft();
+ const cardContainerWidth = $cardContainer.width();
- let cardViewStart = $cardView.offset().left;
- let cardViewEnd = cardViewStart + cardPanelWidth;
+ const cardViewStart = $cardView.offset().left;
+ const cardViewEnd = cardViewStart + cardPanelWidth;
let offset = false;
if (cardViewStart < 0) {
@@ -47,53 +47,53 @@ BlazeComponent.extendComponent({
}
},
- onRendered: function() {
+ onRendered() {
this.scrollParentContainer();
},
- onDestroyed: function() {
+ onDestroyed() {
this.componentParent().showOverlay.set(false);
},
- updateCard: function(modifier) {
+ updateCard(modifier) {
Cards.update(this.data()._id, {
- $set: modifier
+ $set: modifier,
});
},
- events: function() {
- var events = {
- [CSSEvents.animationend + ' .js-card-details']: function() {
+ events() {
+ const events = {
+ [`${CSSEvents.animationend} .js-card-details`]() {
this.isLoaded.set(true);
- }
+ },
};
return [_.extend(events, {
- 'click .js-close-card-details': function() {
+ 'click .js-close-card-details'() {
Utils.goBoardId(this.data().boardId);
},
'click .js-open-card-details-menu': Popup.open('cardDetailsActions'),
- 'submit .js-card-description': function(evt) {
+ 'submit .js-card-description'(evt) {
evt.preventDefault();
- var description = this.currentComponent().getValue();
- this.updateCard({ description: description });
+ const description = this.currentComponent().getValue();
+ this.updateCard({ description });
},
- 'submit .js-card-details-title': function(evt) {
+ 'submit .js-card-details-title'(evt) {
evt.preventDefault();
- var title = this.currentComponent().getValue();
+ const title = this.currentComponent().getValue();
if ($.trim(title)) {
- this.updateCard({ title: title });
+ this.updateCard({ title });
}
},
'click .js-member': Popup.open('cardMember'),
'click .js-add-members': Popup.open('cardMembers'),
'click .js-add-labels': Popup.open('cardLabels'),
- 'mouseenter .js-card-details': function() {
+ 'mouseenter .js-card-details'() {
this.componentParent().showOverlay.set(true);
this.componentParent().mouseHasEnterCardDetails = true;
- }
+ },
})];
- }
+ },
}).register('cardDetails');
// We extends the normal InlinedForm component to support UnsavedEdits draft
@@ -103,12 +103,12 @@ BlazeComponent.extendComponent({
return {
fieldName: 'cardDescription',
docId: Session.get('currentCard'),
- }
+ };
}
close(isReset = false) {
- if (this.isOpen.get() && ! isReset) {
- let draft = $.trim(this.getValue());
+ if (this.isOpen.get() && !isReset) {
+ const draft = $.trim(this.getValue());
if (draft !== Cards.findOne(Session.get('currentCard')).description) {
UnsavedEdits.set(this._getUnsavedEditKey(), this.getValue());
}
@@ -136,45 +136,45 @@ Template.cardDetailsActionsPopup.events({
'click .js-attachments': Popup.open('cardAttachments'),
'click .js-move-card': Popup.open('moveCard'),
// 'click .js-copy': Popup.open(),
- 'click .js-archive': function(evt) {
+ 'click .js-archive'(evt) {
evt.preventDefault();
Cards.update(this._id, {
$set: {
- archived: true
- }
+ archived: true,
+ },
});
Popup.close();
},
- 'click .js-more': Popup.open('cardMore')
+ 'click .js-more': Popup.open('cardMore'),
});
Template.moveCardPopup.events({
- 'click .js-select-list': function() {
+ 'click .js-select-list'() {
// XXX We should *not* get the currentCard from the global state, but
// instead from a “component” state.
- var cardId = Session.get('currentCard');
- var newListId = this._id;
+ const cardId = Session.get('currentCard');
+ const newListId = this._id;
Cards.update(cardId, {
$set: {
- listId: newListId
- }
+ listId: newListId,
+ },
});
Popup.close();
- }
+ },
});
Template.cardMorePopup.events({
- 'click .js-delete': Popup.afterConfirm('cardDelete', function() {
+ 'click .js-delete': Popup.afterConfirm('cardDelete', () => {
Popup.close();
Cards.remove(this._id);
Utils.goBoardId(this.board()._id);
- })
+ }),
});
// Close the card details pane by pressing escape
EscapeActions.register('detailsPane',
- function() { Utils.goBoardId(Session.get('currentBoard')); },
- function() { return ! Session.equals('currentCard', null); }, {
- noClickEscapeOn: '.js-card-details,.board-sidebar,#header'
+ () => { Utils.goBoardId(Session.get('currentBoard')); },
+ () => { return !Session.equals('currentCard', null); }, {
+ noClickEscapeOn: '.js-card-details,.board-sidebar,#header',
}
);