Fix lint errors

This commit is contained in:
Andrés Manelli 2019-02-24 00:13:35 +01:00
parent 60be4df76e
commit eb62c9ce6a
9 changed files with 163 additions and 163 deletions

View file

@ -8,10 +8,10 @@ Template.boardListHeaderBar.events({
Template.boardListHeaderBar.helpers({ Template.boardListHeaderBar.helpers({
templatesBoardId() { templatesBoardId() {
return Meteor.user().getTemplatesBoardId(); return Meteor.user().getTemplatesBoardId();
}, },
templatesBoardSlug() { templatesBoardSlug() {
return Meteor.user().getTemplatesBoardSlug(); return Meteor.user().getTemplatesBoardSlug();
}, },
}); });

View file

@ -81,16 +81,16 @@ BlazeComponent.extendComponent({
cardType = 'template-card'; cardType = 'template-card';
// If this is the board templates swimlane, insert a board template and a linked card // If this is the board templates swimlane, insert a board template and a linked card
else if (swimlane.isBoardTemplatesSwimlane()) { else if (swimlane.isBoardTemplatesSwimlane()) {
linkedId = Boards.insert({ linkedId = Boards.insert({
title, title,
permission: 'private', permission: 'private',
type: 'template-board', type: 'template-board',
}); });
Swimlanes.insert({ Swimlanes.insert({
title: TAPi18n.__('default'), title: TAPi18n.__('default'),
boardId: linkedId, boardId: linkedId,
}); });
cardType = 'cardType-linkedBoard'; cardType = 'cardType-linkedBoard';
} }
} else if (boardView === 'board-view-swimlanes') } else if (boardView === 'board-view-swimlanes')
swimlaneId = this.parentComponent().parentComponent().data()._id; swimlaneId = this.parentComponent().parentComponent().data()._id;
@ -149,9 +149,9 @@ BlazeComponent.extendComponent({
const methodName = evt.shiftKey ? 'toggleRange' : 'toggle'; const methodName = evt.shiftKey ? 'toggleRange' : 'toggle';
MultiSelection[methodName](this.currentData()._id); MultiSelection[methodName](this.currentData()._id);
// If the card is already selected, we want to de-select it. // If the card is already selected, we want to de-select it.
// XXX We should probably modify the minicard href attribute instead of // XXX We should probably modify the minicard href attribute instead of
// overwriting the event in case the card is already selected. // overwriting the event in case the card is already selected.
} else if (Session.equals('currentCard', this.currentData()._id)) { } else if (Session.equals('currentCard', this.currentData()._id)) {
evt.stopImmediatePropagation(); evt.stopImmediatePropagation();
evt.preventDefault(); evt.preventDefault();
@ -171,8 +171,8 @@ BlazeComponent.extendComponent({
idOrNull(swimlaneId) { idOrNull(swimlaneId) {
const currentUser = Meteor.user(); const currentUser = Meteor.user();
if (currentUser.profile.boardView === 'board-view-swimlanes' if (currentUser.profile.boardView === 'board-view-swimlanes' ||
|| this.data().board().isTemplatesBoard()) this.data().board().isTemplatesBoard())
return swimlaneId; return swimlaneId;
return undefined; return undefined;
}, },
@ -292,8 +292,8 @@ BlazeComponent.extendComponent({
// work. // work.
$form.find('button[type=submit]').click(); $form.find('button[type=submit]').click();
// Pressing Tab should open the form of the next column, and Maj+Tab go // Pressing Tab should open the form of the next column, and Maj+Tab go
// in the reverse order // in the reverse order
} else if (evt.keyCode === 9) { } else if (evt.keyCode === 9) {
evt.preventDefault(); evt.preventDefault();
const isReverse = evt.shiftKey; const isReverse = evt.shiftKey;
@ -354,7 +354,7 @@ BlazeComponent.extendComponent({
const currentBoard = Boards.findOne(Session.get('currentBoard')); const currentBoard = Boards.findOne(Session.get('currentBoard'));
callback($.map(currentBoard.labels, (label) => { callback($.map(currentBoard.labels, (label) => {
if (label.name.indexOf(term) > -1 || if (label.name.indexOf(term) > -1 ||
label.color.indexOf(term) > -1) { label.color.indexOf(term) > -1) {
return label; return label;
} }
return null; return null;
@ -530,7 +530,7 @@ BlazeComponent.extendComponent({
this.isTemplateSearch = this.isCardTemplateSearch || this.isListTemplateSearch || this.isSwimlaneTemplateSearch; this.isTemplateSearch = this.isCardTemplateSearch || this.isListTemplateSearch || this.isSwimlaneTemplateSearch;
let board = {}; let board = {};
if (this.isTemplateSearch) { if (this.isTemplateSearch) {
board = Boards.findOne(Meteor.user().profile.templatesBoardId); board = Boards.findOne(Meteor.user().profile.templatesBoardId);
} else { } else {
// Prefetch first non-current board id // Prefetch first non-current board id
board = Boards.findOne({ board = Boards.findOne({
@ -582,13 +582,13 @@ BlazeComponent.extendComponent({
} }
const board = Boards.findOne(this.selectedBoardId.get()); const board = Boards.findOne(this.selectedBoardId.get());
if (!this.isTemplateSearch || this.isCardTemplateSearch) { if (!this.isTemplateSearch || this.isCardTemplateSearch) {
return board.searchCards(this.term.get(), false); return board.searchCards(this.term.get(), false);
} else if (this.isListTemplateSearch) { } else if (this.isListTemplateSearch) {
return board.searchLists(this.term.get()); return board.searchLists(this.term.get());
} else if (this.isSwimlaneTemplateSearch) { } else if (this.isSwimlaneTemplateSearch) {
return board.searchSwimlanes(this.term.get()); return board.searchSwimlanes(this.term.get());
} else { } else {
return []; return [];
} }
}, },
@ -604,7 +604,7 @@ BlazeComponent.extendComponent({
}, },
'click .js-minicard'(evt) { 'click .js-minicard'(evt) {
// 0. Common // 0. Common
let element = Blaze.getData(evt.currentTarget); const element = Blaze.getData(evt.currentTarget);
element.boardId = this.boardId; element.boardId = this.boardId;
let _id = ''; let _id = '';
if (!this.isTemplateSearch || this.isCardTemplateSearch) { if (!this.isTemplateSearch || this.isCardTemplateSearch) {
@ -615,27 +615,27 @@ BlazeComponent.extendComponent({
element.sort = Lists.findOne(this.listId).cards().count(); element.sort = Lists.findOne(this.listId).cards().count();
// 1.A From template // 1.A From template
if (this.isTemplateSearch) { if (this.isTemplateSearch) {
element.type = 'cardType-card'; element.type = 'cardType-card';
element.linkedId = ''; element.linkedId = '';
_id = element.copy(); _id = element.copy();
// 1.B Linked card // 1.B Linked card
} else { } else {
element._id = null; element._id = null;
element.type = 'cardType-linkedCard'; element.type = 'cardType-linkedCard';
element.linkedId = element.linkedId || element._id; element.linkedId = element.linkedId || element._id;
_id = Cards.insert(element); _id = Cards.insert(element);
} }
Filter.addException(_id); Filter.addException(_id);
// List insertion // List insertion
} else if (this.isListTemplateSearch) { } else if (this.isListTemplateSearch) {
element.sort = Swimlanes.findOne(this.swimlaneId).lists().count(); element.sort = Swimlanes.findOne(this.swimlaneId).lists().count();
element.type = 'list'; element.type = 'list';
element.swimlaneId = this.swimlaneId; element.swimlaneId = this.swimlaneId;
_id = element.copy(); _id = element.copy();
} else if (this.isSwimlaneTemplateSearch) { } else if (this.isSwimlaneTemplateSearch) {
element.sort = Boards.findOne(this.boardId).swimlanes().count(); element.sort = Boards.findOne(this.boardId).swimlanes().count();
element.type = 'swimlalne'; element.type = 'swimlalne';
_id = element.copy(); _id = element.copy();
} }
Popup.close(); Popup.close();
}, },

View file

@ -5,10 +5,10 @@ Template.headerUserBar.events({
Template.memberMenuPopup.helpers({ Template.memberMenuPopup.helpers({
templatesBoardId() { templatesBoardId() {
return Meteor.user().getTemplatesBoardId(); return Meteor.user().getTemplatesBoardId();
}, },
templatesBoardSlug() { templatesBoardSlug() {
return Meteor.user().getTemplatesBoardSlug(); return Meteor.user().getTemplatesBoardSlug();
}, },
}); });

View file

@ -471,7 +471,7 @@ Boards.helpers({
query.type = 'template-swimlane'; query.type = 'template-swimlane';
query.archived = false; query.archived = false;
} else { } else {
query.type = {$nin: ['template-swimlane']}; query.type = {$nin: ['template-swimlane']};
} }
const projection = { limit: 10, sort: { createdAt: -1 } }; const projection = { limit: 10, sort: { createdAt: -1 } };
@ -495,7 +495,7 @@ Boards.helpers({
query.type = 'template-list'; query.type = 'template-list';
query.archived = false; query.archived = false;
} else { } else {
query.type = {$nin: ['template-list']}; query.type = {$nin: ['template-list']};
} }
const projection = { limit: 10, sort: { createdAt: -1 } }; const projection = { limit: 10, sort: { createdAt: -1 } };
@ -522,7 +522,7 @@ Boards.helpers({
query.type = 'template-card'; query.type = 'template-card';
query.archived = false; query.archived = false;
} else { } else {
query.type = {$nin: ['template-card']}; query.type = {$nin: ['template-card']};
} }
const projection = { limit: 10, sort: { createdAt: -1 } }; const projection = { limit: 10, sort: { createdAt: -1 } };
@ -975,7 +975,7 @@ if (Meteor.isServer) {
* @param {string} userId the ID of the user to retrieve the data * @param {string} userId the ID of the user to retrieve the data
* @return_type [{_id: string, * @return_type [{_id: string,
title: string}] title: string}]
*/ */
JsonRoutes.add('GET', '/api/users/:userId/boards', function (req, res) { JsonRoutes.add('GET', '/api/users/:userId/boards', function (req, res) {
try { try {
Authentication.checkLoggedIn(req.userId); Authentication.checkLoggedIn(req.userId);
@ -1012,7 +1012,7 @@ if (Meteor.isServer) {
* *
* @return_type [{_id: string, * @return_type [{_id: string,
title: string}] title: string}]
*/ */
JsonRoutes.add('GET', '/api/boards', function (req, res) { JsonRoutes.add('GET', '/api/boards', function (req, res) {
try { try {
Authentication.checkUserId(req.userId); Authentication.checkUserId(req.userId);
@ -1083,7 +1083,7 @@ if (Meteor.isServer) {
* *
* @return_type {_id: string, * @return_type {_id: string,
defaultSwimlaneId: string} defaultSwimlaneId: string}
*/ */
JsonRoutes.add('POST', '/api/boards', function (req, res) { JsonRoutes.add('POST', '/api/boards', function (req, res) {
try { try {
Authentication.checkUserId(req.userId); Authentication.checkUserId(req.userId);

View file

@ -273,28 +273,28 @@ Cards.allow({
Cards.helpers({ Cards.helpers({
copy() { copy() {
const oldId = this._id; const oldId = this._id;
this._id = null; this._id = null;
const _id = Cards.insert(this); const _id = Cards.insert(this);
// copy checklists // copy checklists
Checklists.find({cardId: oldId}).forEach((ch) => { Checklists.find({cardId: oldId}).forEach((ch) => {
ch.copy(_id); ch.copy(_id);
}); });
// copy subtasks // copy subtasks
Cards.find({parentId: oldId}).forEach((subtask) => { Cards.find({parentId: oldId}).forEach((subtask) => {
subtask.parentId = _id; subtask.parentId = _id;
subtask._id = null; subtask._id = null;
Cards.insert(subtask); Cards.insert(subtask);
}); });
// copy card comments // copy card comments
CardComments.find({cardId: oldId}).forEach((cmt) => { CardComments.find({cardId: oldId}).forEach((cmt) => {
cmt.copy(_id); cmt.copy(_id);
}); });
return _id; return _id;
}, },
list() { list() {
@ -1259,7 +1259,7 @@ Cards.mutations({
function cardMove(userId, doc, fieldNames, oldListId, oldSwimlaneId) { function cardMove(userId, doc, fieldNames, oldListId, oldSwimlaneId) {
if ((_.contains(fieldNames, 'listId') && doc.listId !== oldListId) || if ((_.contains(fieldNames, 'listId') && doc.listId !== oldListId) ||
(_.contains(fieldNames, 'swimlaneId') && doc.swimlaneId !== oldSwimlaneId)){ (_.contains(fieldNames, 'swimlaneId') && doc.swimlaneId !== oldSwimlaneId)){
Activities.insert({ Activities.insert({
userId, userId,
oldListId, oldListId,

View file

@ -49,16 +49,16 @@ Checklists.attachSchema(new SimpleSchema({
Checklists.helpers({ Checklists.helpers({
copy(newCardId) { copy(newCardId) {
const oldChecklistId = this._id; const oldChecklistId = this._id;
this._id = null; this._id = null;
this.cardId = newCardId; this.cardId = newCardId;
const newChecklistId = Checklists.insert(this); const newChecklistId = Checklists.insert(this);
ChecklistItems.find({checklistId: oldChecklistId}).forEach((item) => { ChecklistItems.find({checklistId: oldChecklistId}).forEach((item) => {
item._id = null; item._id = null;
item.checklistId = newChecklistId; item.checklistId = newChecklistId;
item.cardId = newCardId; item.cardId = newCardId;
ChecklistItems.insert(item); ChecklistItems.insert(item);
}); });
}, },
itemCount() { itemCount() {

View file

@ -138,30 +138,30 @@ Lists.allow({
Lists.helpers({ Lists.helpers({
copy() { copy() {
const oldId = this._id; const oldId = this._id;
let _id = null; let _id = null;
existingListWithSameName = Lists.findOne({ existingListWithSameName = Lists.findOne({
boardId: this.boardId, boardId: this.boardId,
title: this.title, title: this.title,
}); });
if (existingListWithSameName) { if (existingListWithSameName) {
_id = existingListWithSameName._id; _id = existingListWithSameName._id;
} else { } else {
this._id = null; this._id = null;
_id = Lists.insert(this); _id = Lists.insert(this);
} }
// Copy all cards in list // Copy all cards in list
Cards.find({ Cards.find({
listId: oldId, listId: oldId,
archived: false, archived: false,
}).forEach((card) => { }).forEach((card) => {
card.type = 'cardType-card'; card.type = 'cardType-card';
card.listId = _id; card.listId = _id;
card.boardId = this.boardId; card.boardId = this.boardId;
card.swimlaneId = this.swimlaneId; card.swimlaneId = this.swimlaneId;
card.copy(); card.copy();
}); });
}, },
cards(swimlaneId) { cards(swimlaneId) {
@ -224,7 +224,7 @@ Lists.mutations({
archive() { archive() {
if (this.isTemplateList()) { if (this.isTemplateList()) {
this.cards().forEach((card) => { this.cards().forEach((card) => {
return card.archive(); return card.archive();
}); });
} }
return { $set: { archived: true } }; return { $set: { archived: true } };
@ -233,7 +233,7 @@ Lists.mutations({
restore() { restore() {
if (this.isTemplateList()) { if (this.isTemplateList()) {
this.allCards().forEach((card) => { this.allCards().forEach((card) => {
return card.restore(); return card.restore();
}); });
} }
return { $set: { archived: false } }; return { $set: { archived: false } };

View file

@ -102,20 +102,20 @@ Swimlanes.allow({
Swimlanes.helpers({ Swimlanes.helpers({
copy() { copy() {
const oldId = this._id; const oldId = this._id;
this._id = null; this._id = null;
const _id = Swimlanes.insert(this); const _id = Swimlanes.insert(this);
// Copy all lists in swimlane // Copy all lists in swimlane
Lists.find({ Lists.find({
swimlaneId: oldId, swimlaneId: oldId,
archived: false, archived: false,
}).forEach((list) => { }).forEach((list) => {
list.type = 'list'; list.type = 'list';
list.swimlaneId = _id; list.swimlaneId = _id;
list.boardId = this.boardId; list.boardId = this.boardId;
list.copy(); list.copy();
}); });
}, },
cards() { cards() {
@ -127,8 +127,8 @@ Swimlanes.helpers({
lists() { lists() {
return Lists.find(Filter.mongoSelector({ return Lists.find(Filter.mongoSelector({
swimlaneId: this._id, swimlaneId: this._id,
archived: false, archived: false,
}), { sort: ['sort'] }); }), { sort: ['sort'] });
}, },
@ -155,22 +155,22 @@ Swimlanes.helpers({
}, },
isTemplateContainer() { isTemplateContainer() {
return this.type === 'template-container'; return this.type === 'template-container';
}, },
isListTemplatesSwimlane() { isListTemplatesSwimlane() {
const user = Users.findOne(Meteor.userId()); const user = Users.findOne(Meteor.userId());
return user.profile.listTemplatesSwimlaneId === this._id; return user.profile.listTemplatesSwimlaneId === this._id;
}, },
isCardTemplatesSwimlane() { isCardTemplatesSwimlane() {
const user = Users.findOne(Meteor.userId()); const user = Users.findOne(Meteor.userId());
return user.profile.cardTemplatesSwimlaneId === this._id; return user.profile.cardTemplatesSwimlaneId === this._id;
}, },
isBoardTemplatesSwimlane() { isBoardTemplatesSwimlane() {
const user = Users.findOne(Meteor.userId()); const user = Users.findOne(Meteor.userId());
return user.profile.boardTemplatesSwimlaneId === this._id; return user.profile.boardTemplatesSwimlaneId === this._id;
}, },
}); });
@ -182,7 +182,7 @@ Swimlanes.mutations({
archive() { archive() {
if (this.isTemplateSwimlane()) { if (this.isTemplateSwimlane()) {
this.lists().forEach((list) => { this.lists().forEach((list) => {
return list.archive(); return list.archive();
}); });
} }
return { $set: { archived: true } }; return { $set: { archived: true } };
@ -191,7 +191,7 @@ Swimlanes.mutations({
restore() { restore() {
if (this.isTemplateSwimlane()) { if (this.isTemplateSwimlane()) {
this.allLists().forEach((list) => { this.allLists().forEach((list) => {
return list.restore(); return list.restore();
}); });
} }
return { $set: { archived: false } }; return { $set: { archived: false } };

View file

@ -358,11 +358,11 @@ Users.helpers({
}, },
getTemplatesBoardId() { getTemplatesBoardId() {
return this.profile.templatesBoardId; return this.profile.templatesBoardId;
}, },
getTemplatesBoardSlug() { getTemplatesBoardSlug() {
return Boards.findOne(this.profile.templatesBoardId).slug; return Boards.findOne(this.profile.templatesBoardId).slug;
}, },
}); });
@ -741,47 +741,47 @@ if (Meteor.isServer) {
Boards.insert({ Boards.insert({
title: TAPi18n.__('templates'), title: TAPi18n.__('templates'),
permission: 'private', permission: 'private',
type: 'template-container' type: 'template-container',
}, fakeUser, (err, boardId) => { }, fakeUser, (err, boardId) => {
// Insert the reference to our templates board // Insert the reference to our templates board
Users.update(fakeUserId.get(), {$set: {'profile.templatesBoardId': boardId}}); Users.update(fakeUserId.get(), {$set: {'profile.templatesBoardId': boardId}});
// Insert the card templates swimlane // Insert the card templates swimlane
Swimlanes.insert({ Swimlanes.insert({
title: TAPi18n.__('card-templates-swimlane'), title: TAPi18n.__('card-templates-swimlane'),
boardId, boardId,
sort: 1, sort: 1,
type: 'template-container', type: 'template-container',
}, fakeUser, (err, swimlaneId) => { }, fakeUser, (err, swimlaneId) => {
// Insert the reference to out card templates swimlane // Insert the reference to out card templates swimlane
Users.update(fakeUserId.get(), {$set: {'profile.cardTemplatesSwimlaneId': swimlaneId}}); Users.update(fakeUserId.get(), {$set: {'profile.cardTemplatesSwimlaneId': swimlaneId}});
}); });
// Insert the list templates swimlane // Insert the list templates swimlane
Swimlanes.insert({ Swimlanes.insert({
title: TAPi18n.__('list-templates-swimlane'), title: TAPi18n.__('list-templates-swimlane'),
boardId, boardId,
sort: 2, sort: 2,
type: 'template-container', type: 'template-container',
}, fakeUser, (err, swimlaneId) => { }, fakeUser, (err, swimlaneId) => {
// Insert the reference to out list templates swimlane // Insert the reference to out list templates swimlane
Users.update(fakeUserId.get(), {$set: {'profile.listTemplatesSwimlaneId': swimlaneId}}); Users.update(fakeUserId.get(), {$set: {'profile.listTemplatesSwimlaneId': swimlaneId}});
}); });
// Insert the board templates swimlane // Insert the board templates swimlane
Swimlanes.insert({ Swimlanes.insert({
title: TAPi18n.__('board-templates-swimlane'), title: TAPi18n.__('board-templates-swimlane'),
boardId, boardId,
sort: 3, sort: 3,
type: 'template-container', type: 'template-container',
}, fakeUser, (err, swimlaneId) => { }, fakeUser, (err, swimlaneId) => {
// Insert the reference to out board templates swimlane // Insert the reference to out board templates swimlane
Users.update(fakeUserId.get(), {$set: {'profile.boardTemplatesSwimlaneId': swimlaneId}}); Users.update(fakeUserId.get(), {$set: {'profile.boardTemplatesSwimlaneId': swimlaneId}});
}); });
}); });
}); });
}); });