summaryrefslogtreecommitdiffstats
path: root/client/components/activities
diff options
context:
space:
mode:
authorJustin Reynolds <justinr1234@gmail.com>2019-06-28 12:52:09 -0500
committerJustin Reynolds <justinr1234@gmail.com>2019-06-28 12:56:51 -0500
commit3eb4d2c341b712268bd321173909e0a7b19a88c9 (patch)
tree25a8fcb088f3984e72a5bd3ded9e6a45376e0693 /client/components/activities
parenta0a482aa8efb3255a523de4524c8e09453d5571f (diff)
downloadwekan-3eb4d2c341b712268bd321173909e0a7b19a88c9.tar.gz
wekan-3eb4d2c341b712268bd321173909e0a7b19a88c9.tar.bz2
wekan-3eb4d2c341b712268bd321173909e0a7b19a88c9.zip
Prettier & eslint project style update
Diffstat (limited to 'client/components/activities')
-rw-r--r--client/components/activities/activities.js148
-rw-r--r--client/components/activities/comments.js76
2 files changed, 131 insertions, 93 deletions
diff --git a/client/components/activities/activities.js b/client/components/activities/activities.js
index 0476897f..05149826 100644
--- a/client/components/activities/activities.js
+++ b/client/components/activities/activities.js
@@ -13,7 +13,7 @@ BlazeComponent.extendComponent({
let thisId, searchId;
if (mode === 'linkedcard' || mode === 'linkedboard') {
thisId = Session.get('currentCard');
- searchId = Cards.findOne({_id: thisId}).linkedId;
+ searchId = Cards.findOne({ _id: thisId }).linkedId;
mode = mode.replace('linked', '');
} else {
thisId = Session.get(`current${capitalizedMode}`);
@@ -22,8 +22,7 @@ BlazeComponent.extendComponent({
const limit = this.page.get() * activitiesPerPage;
const user = Meteor.user();
const hideSystem = user ? user.hasHiddenSystemMessages() : false;
- if (searchId === null)
- return;
+ if (searchId === null) return;
this.subscribe('activities', mode, searchId, limit, hideSystem, () => {
this.loadNextPageLocked = false;
@@ -50,9 +49,9 @@ BlazeComponent.extendComponent({
}
},
- checkItem(){
+ checkItem() {
const checkItemId = this.currentData().checklistItemId;
- const checkItem = ChecklistItems.findOne({_id:checkItemId});
+ const checkItem = ChecklistItems.findOne({ _id: checkItemId });
return checkItem.title;
},
@@ -66,42 +65,58 @@ BlazeComponent.extendComponent({
cardLink() {
const card = this.currentData().card();
- return card && Blaze.toHTML(HTML.A({
- href: card.absoluteUrl(),
- 'class': 'action-card',
- }, card.title));
+ return (
+ card &&
+ Blaze.toHTML(
+ HTML.A(
+ {
+ href: card.absoluteUrl(),
+ class: 'action-card',
+ },
+ card.title,
+ ),
+ )
+ );
},
- lastLabel(){
+ 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 === ''){
+ if (!lastLabelId) return null;
+ const lastLabel = Boards.findOne(Session.get('currentBoard')).getLabelById(
+ lastLabelId,
+ );
+ if (lastLabel.name === undefined || lastLabel.name === '') {
return lastLabel.color;
- }else{
+ } else {
return lastLabel.name;
}
},
- lastCustomField(){
- const lastCustomField = CustomFields.findOne(this.currentData().customFieldId);
- if (!lastCustomField)
- return null;
+ 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;
+ 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;
+ 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;
},
@@ -112,11 +127,16 @@ BlazeComponent.extendComponent({
sourceLink() {
const source = this.currentData().source;
- if(source) {
- if(source.url) {
- return Blaze.toHTML(HTML.A({
- href: source.url,
- }, source.system));
+ if (source) {
+ if (source.url) {
+ return Blaze.toHTML(
+ HTML.A(
+ {
+ href: source.url,
+ },
+ source.system,
+ ),
+ );
} else {
return source.system;
}
@@ -133,38 +153,50 @@ BlazeComponent.extendComponent({
attachmentLink() {
const attachment = this.currentData().attachment();
// trying to display url before file is stored generates js errors
- return attachment && attachment.url({ download: true }) && Blaze.toHTML(HTML.A({
- href: attachment.url({ download: true }),
- target: '_blank',
- }, attachment.name()));
+ return (
+ attachment &&
+ attachment.url({ download: true }) &&
+ Blaze.toHTML(
+ HTML.A(
+ {
+ href: attachment.url({ download: true }),
+ target: '_blank',
+ },
+ attachment.name(),
+ ),
+ )
+ );
},
customField() {
const customField = this.currentData().customField();
- if (!customField)
- return null;
+ if (!customField) return null;
return customField.name;
},
events() {
- return [{
- // XXX We should use Popup.afterConfirmation here
- 'click .js-delete-comment'() {
- const commentId = this.currentData().commentId;
- CardComments.remove(commentId);
- },
- 'submit .js-edit-comment'(evt) {
- evt.preventDefault();
- const commentText = this.currentComponent().getValue().trim();
- const commentId = Template.parentData().commentId;
- if (commentText) {
- CardComments.update(commentId, {
- $set: {
- text: commentText,
- },
- });
- }
+ return [
+ {
+ // XXX We should use Popup.afterConfirmation here
+ 'click .js-delete-comment'() {
+ const commentId = this.currentData().commentId;
+ CardComments.remove(commentId);
+ },
+ 'submit .js-edit-comment'(evt) {
+ evt.preventDefault();
+ const commentText = this.currentComponent()
+ .getValue()
+ .trim();
+ const commentId = Template.parentData().commentId;
+ if (commentText) {
+ CardComments.update(commentId, {
+ $set: {
+ text: commentText,
+ },
+ });
+ }
+ },
},
- }];
+ ];
},
}).register('activities');
diff --git a/client/components/activities/comments.js b/client/components/activities/comments.js
index 34b6402c..3fc5770c 100644
--- a/client/components/activities/comments.js
+++ b/client/components/activities/comments.js
@@ -14,39 +14,41 @@ BlazeComponent.extendComponent({
},
events() {
- return [{
- 'click .js-new-comment:not(.focus)'() {
- commentFormIsOpen.set(true);
+ return [
+ {
+ 'click .js-new-comment:not(.focus)'() {
+ commentFormIsOpen.set(true);
+ },
+ 'submit .js-new-comment-form'(evt) {
+ const input = this.getInput();
+ const text = input.val().trim();
+ const card = this.currentData();
+ let boardId = card.boardId;
+ let cardId = card._id;
+ if (card.isLinkedCard()) {
+ boardId = Cards.findOne(card.linkedId).boardId;
+ cardId = card.linkedId;
+ }
+ if (text) {
+ CardComments.insert({
+ text,
+ boardId,
+ cardId,
+ });
+ resetCommentInput(input);
+ Tracker.flush();
+ autosize.update(input);
+ }
+ evt.preventDefault();
+ },
+ // Pressing Ctrl+Enter should submit the form
+ 'keydown form textarea'(evt) {
+ if (evt.keyCode === 13 && (evt.metaKey || evt.ctrlKey)) {
+ this.find('button[type=submit]').click();
+ }
+ },
},
- 'submit .js-new-comment-form'(evt) {
- const input = this.getInput();
- const text = input.val().trim();
- const card = this.currentData();
- let boardId = card.boardId;
- let cardId = card._id;
- if (card.isLinkedCard()) {
- boardId = Cards.findOne(card.linkedId).boardId;
- cardId = card.linkedId;
- }
- if (text) {
- CardComments.insert({
- text,
- boardId,
- cardId,
- });
- resetCommentInput(input);
- Tracker.flush();
- autosize.update(input);
- }
- evt.preventDefault();
- },
- // Pressing Ctrl+Enter should submit the form
- 'keydown form textarea'(evt) {
- if (evt.keyCode === 13 && (evt.metaKey || evt.ctrlKey)) {
- this.find('button[type=submit]').click();
- }
- },
- }];
+ ];
},
}).register('commentForm');
@@ -69,7 +71,8 @@ Tracker.autorun(() => {
});
});
-EscapeActions.register('inlinedForm',
+EscapeActions.register(
+ 'inlinedForm',
() => {
const draftKey = {
fieldName: 'cardComment',
@@ -84,7 +87,10 @@ EscapeActions.register('inlinedForm',
}
resetCommentInput(commentInput);
},
- () => { return commentFormIsOpen.get(); }, {
+ () => {
+ return commentFormIsOpen.get();
+ },
+ {
noClickEscapeOn: '.js-new-comment',
- }
+ },
);