Fix lint errors.

This commit is contained in:
Lauri Ojansivu 2019-11-20 21:10:11 +02:00
parent 82d76e55e5
commit 788dd0a81a
5 changed files with 76 additions and 84 deletions

View file

@ -201,16 +201,14 @@ BlazeComponent.extendComponent({
if (currentUser) { if (currentUser) {
showDesktopDragHandles = (currentUser.profile || {}) showDesktopDragHandles = (currentUser.profile || {})
.showDesktopDragHandles; .showDesktopDragHandles;
} else { } else if (cookies.has('showDesktopDragHandles')) {
if (cookies.has('showDesktopDragHandles')) {
showDesktopDragHandles = true; showDesktopDragHandles = true;
} else { } else {
showDesktopDragHandles = false; showDesktopDragHandles = false;
} }
}
if ( if (
Utils.isMiniScreen() || Utils.isMiniScreen()
(!Utils.isMiniScreen() && showDesktopDragHandles) || (!Utils.isMiniScreen() && showDesktopDragHandles)
) { ) {
$swimlanesDom.sortable({ $swimlanesDom.sortable({
handle: '.js-swimlane-header-handle', handle: '.js-swimlane-header-handle',
@ -227,9 +225,9 @@ BlazeComponent.extendComponent({
function userIsMember() { function userIsMember() {
return ( return (
Meteor.user() && Meteor.user()
Meteor.user().isBoardMember() && && Meteor.user().isBoardMember()
!Meteor.user().isCommentOnly() && !Meteor.user().isCommentOnly()
); );
} }
@ -308,16 +306,16 @@ BlazeComponent.extendComponent({
scrollLeft(position = 0) { scrollLeft(position = 0) {
const swimlanes = this.$('.js-swimlanes'); const swimlanes = this.$('.js-swimlanes');
swimlanes && swimlanes
swimlanes.animate({ && swimlanes.animate({
scrollLeft: position, scrollLeft: position,
}); });
}, },
scrollTop(position = 0) { scrollTop(position = 0) {
const swimlanes = this.$('.js-swimlanes'); const swimlanes = this.$('.js-swimlanes');
swimlanes && swimlanes
swimlanes.animate({ && swimlanes.animate({
scrollTop: position, scrollTop: position,
}); });
}, },
@ -361,8 +359,8 @@ BlazeComponent.extendComponent({
end = end || card.endAt; end = end || card.endAt;
title = title || card.title; title = title || card.title;
const className = const className =
(extraCls ? `${extraCls} ` : '') + (extraCls ? `${extraCls} ` : '')
(card.color ? `calendar-event-${card.color}` : ''); + (card.color ? `calendar-event-${card.color}` : '');
events.push({ events.push({
id: card._id, id: card._id,
title, title,

View file

@ -22,9 +22,9 @@ BlazeComponent.extendComponent({
function userIsMember() { function userIsMember() {
return ( return (
Meteor.user() && Meteor.user()
Meteor.user().isBoardMember() && && Meteor.user().isBoardMember()
!Meteor.user().isCommentOnly() && !Meteor.user().isCommentOnly()
); );
} }
@ -74,14 +74,14 @@ BlazeComponent.extendComponent({
const currentBoard = Boards.findOne(Session.get('currentBoard')); const currentBoard = Boards.findOne(Session.get('currentBoard'));
let swimlaneId = ''; let swimlaneId = '';
if ( if (
Utils.boardView() === 'board-view-swimlanes' || Utils.boardView() === 'board-view-swimlanes'
currentBoard.isTemplatesBoard() || currentBoard.isTemplatesBoard()
) )
swimlaneId = Blaze.getData(ui.item.parents('.swimlane').get(0))._id; swimlaneId = Blaze.getData(ui.item.parents('.swimlane').get(0))._id;
else if ( else if (
Utils.boardView() === 'board-view-lists' || Utils.boardView() === 'board-view-lists'
Utils.boardView() === 'board-view-cal' || || Utils.boardView() === 'board-view-cal'
!Utils.boardView || !Utils.boardView
) )
swimlaneId = currentBoard.getDefaultSwimline()._id; swimlaneId = currentBoard.getDefaultSwimline()._id;
@ -124,13 +124,11 @@ BlazeComponent.extendComponent({
if (currentUser) { if (currentUser) {
showDesktopDragHandles = (currentUser.profile || {}) showDesktopDragHandles = (currentUser.profile || {})
.showDesktopDragHandles; .showDesktopDragHandles;
} else { } else if (cookies.has('showDesktopDragHandles')) {
if (cookies.has('showDesktopDragHandles')) {
showDesktopDragHandles = true; showDesktopDragHandles = true;
} else { } else {
showDesktopDragHandles = false; showDesktopDragHandles = false;
} }
}
if (!Utils.isMiniScreen() && showDesktopDragHandles) { if (!Utils.isMiniScreen() && showDesktopDragHandles) {
$cards.sortable({ $cards.sortable({

View file

@ -7,9 +7,9 @@ BlazeComponent.extendComponent({
canSeeAddCard() { canSeeAddCard() {
const list = Template.currentData(); const list = Template.currentData();
return ( return (
!list.getWipLimit('enabled') || !list.getWipLimit('enabled')
list.getWipLimit('soft') || || list.getWipLimit('soft')
!this.reachedWipLimit() || !this.reachedWipLimit()
); );
}, },
@ -47,6 +47,8 @@ BlazeComponent.extendComponent({
const currentUser = Meteor.user(); const currentUser = Meteor.user();
if (currentUser) { if (currentUser) {
return Meteor.user().getLimitToShowCardsCount(); return Meteor.user().getLimitToShowCardsCount();
} else {
return false;
} }
}, },
@ -64,8 +66,8 @@ BlazeComponent.extendComponent({
reachedWipLimit() { reachedWipLimit() {
const list = Template.currentData(); const list = Template.currentData();
return ( return (
list.getWipLimit('enabled') && list.getWipLimit('enabled')
list.getWipLimit('value') <= list.cards().count() && list.getWipLimit('value') <= list.cards().count()
); );
}, },
@ -175,8 +177,8 @@ BlazeComponent.extendComponent({
const list = Template.currentData(); const list = Template.currentData();
if ( if (
list.getWipLimit('soft') && list.getWipLimit('soft')
list.getWipLimit('value') < list.cards().count() && list.getWipLimit('value') < list.cards().count()
) { ) {
list.setWipLimit(list.cards().count()); list.setWipLimit(list.cards().count());
} }
@ -187,8 +189,8 @@ BlazeComponent.extendComponent({
const list = Template.currentData(); const list = Template.currentData();
// Prevent user from using previously stored wipLimit.value if it is less than the current number of cards in the list // Prevent user from using previously stored wipLimit.value if it is less than the current number of cards in the list
if ( if (
!list.getWipLimit('enabled') && !list.getWipLimit('enabled')
list.getWipLimit('value') < list.cards().count() && list.getWipLimit('value') < list.cards().count()
) { ) {
list.setWipLimit(list.cards().count()); list.setWipLimit(list.cards().count());
} }

View file

@ -3,8 +3,8 @@ const { calculateIndex, enableClickOnTouch } = Utils;
function currentListIsInThisSwimlane(swimlaneId) { function currentListIsInThisSwimlane(swimlaneId) {
const currentList = Lists.findOne(Session.get('currentList')); const currentList = Lists.findOne(Session.get('currentList'));
return ( return (
currentList && currentList
(currentList.swimlaneId === swimlaneId || currentList.swimlaneId === '') && (currentList.swimlaneId === swimlaneId || currentList.swimlaneId === '')
); );
} }
@ -12,14 +12,14 @@ function currentCardIsInThisList(listId, swimlaneId) {
const currentCard = Cards.findOne(Session.get('currentCard')); const currentCard = Cards.findOne(Session.get('currentCard'));
const currentUser = Meteor.user(); const currentUser = Meteor.user();
if ( if (
currentUser && currentUser
currentUser.profile && && currentUser.profile
Utils.boardView() === 'board-view-swimlanes' && Utils.boardView() === 'board-view-swimlanes'
) )
return ( return (
currentCard && currentCard
currentCard.listId === listId && && currentCard.listId === listId
currentCard.swimlaneId === swimlaneId && currentCard.swimlaneId === swimlaneId
); );
// Default view: board-view-lists // Default view: board-view-lists
else return currentCard && currentCard.listId === listId; else return currentCard && currentCard.listId === listId;
@ -90,15 +90,13 @@ function initSortable(boardComponent, $listsDom) {
function userIsMember() { function userIsMember() {
return ( return (
Meteor.user() && Meteor.user()
Meteor.user().isBoardMember() && && Meteor.user().isBoardMember()
!Meteor.user().isCommentOnly() && !Meteor.user().isCommentOnly()
); );
} }
boardComponent.autorun(() => { boardComponent.autorun(() => {
import { Cookies } from 'meteor/ostrio:cookies';
const cookies = new Cookies();
let showDesktopDragHandles = false; let showDesktopDragHandles = false;
currentUser = Meteor.user(); currentUser = Meteor.user();
if (currentUser) { if (currentUser) {
@ -199,8 +197,6 @@ BlazeComponent.extendComponent({
// the user will legitimately expect to be able to select some text with // the user will legitimately expect to be able to select some text with
// his mouse. // his mouse.
import { Cookies } from 'meteor/ostrio:cookies';
const cookies = new Cookies();
let showDesktopDragHandles = false; let showDesktopDragHandles = false;
currentUser = Meteor.user(); currentUser = Meteor.user();
if (currentUser) { if (currentUser) {
@ -217,15 +213,15 @@ BlazeComponent.extendComponent({
} }
const noDragInside = ['a', 'input', 'textarea', 'p'].concat( const noDragInside = ['a', 'input', 'textarea', 'p'].concat(
Utils.isMiniScreen() || Utils.isMiniScreen()
(!Utils.isMiniScreen() && showDesktopDragHandles) || (!Utils.isMiniScreen() && showDesktopDragHandles)
? ['.js-list-handle', '.js-swimlane-header-handle'] ? ['.js-list-handle', '.js-swimlane-header-handle']
: ['.js-list-header'], : ['.js-list-header'],
); );
if ( if (
$(evt.target).closest(noDragInside.join(',')).length === 0 && $(evt.target).closest(noDragInside.join(',')).length === 0
this.$('.swimlane').prop('clientHeight') > evt.offsetY && this.$('.swimlane').prop('clientHeight') > evt.offsetY
) { ) {
this._isDragging = true; this._isDragging = true;
this._lastDragPositionX = evt.clientX; this._lastDragPositionX = evt.clientX;
@ -259,8 +255,8 @@ BlazeComponent.extendComponent({
onCreated() { onCreated() {
this.currentBoard = Boards.findOne(Session.get('currentBoard')); this.currentBoard = Boards.findOne(Session.get('currentBoard'));
this.isListTemplatesSwimlane = this.isListTemplatesSwimlane =
this.currentBoard.isTemplatesBoard() && this.currentBoard.isTemplatesBoard()
this.currentData().isListTemplatesSwimlane(); && this.currentData().isListTemplatesSwimlane();
this.currentSwimlane = this.currentData(); this.currentSwimlane = this.currentData();
}, },
@ -314,9 +310,9 @@ Template.swimlane.helpers({
}, },
canSeeAddList() { canSeeAddList() {
return ( return (
Meteor.user() && Meteor.user()
Meteor.user().isBoardMember() && && Meteor.user().isBoardMember()
!Meteor.user().isCommentOnly() && !Meteor.user().isCommentOnly()
); );
}, },
}); });

View file

@ -5,8 +5,7 @@ Utils = {
currentUser = Meteor.user(); currentUser = Meteor.user();
if (currentUser) { if (currentUser) {
Meteor.user().setBoardView(view); Meteor.user().setBoardView(view);
} else { } else if (view === 'board-view-lists') {
if (view === 'board-view-lists') {
cookies.set('boardView', 'board-view-lists'); //true cookies.set('boardView', 'board-view-lists'); //true
} else if (view === 'board-view-swimlanes') { } else if (view === 'board-view-swimlanes') {
cookies.set('boardView', 'board-view-swimlanes'); //true cookies.set('boardView', 'board-view-swimlanes'); //true
@ -16,7 +15,6 @@ Utils = {
} else if (view === 'board-view-cal') { } else if (view === 'board-view-cal') {
cookies.set('boardView', 'board-view-cal'); //true cookies.set('boardView', 'board-view-cal'); //true
} }
}
}, },
unsetBoardView() { unsetBoardView() {
@ -54,8 +52,8 @@ Utils = {
goBoardId(_id) { goBoardId(_id) {
const board = Boards.findOne(_id); const board = Boards.findOne(_id);
return ( return (
board && board
FlowRouter.go('board', { && FlowRouter.go('board', {
id: board._id, id: board._id,
slug: board.slug, slug: board.slug,
}) })
@ -66,8 +64,8 @@ Utils = {
const card = Cards.findOne(_id); const card = Cards.findOne(_id);
const board = Boards.findOne(card.boardId); const board = Boards.findOne(card.boardId);
return ( return (
board && board
FlowRouter.go('card', { && FlowRouter.go('card', {
cardId: card._id, cardId: card._id,
boardId: board._id, boardId: board._id,
slug: board.slug, slug: board.slug,
@ -238,8 +236,8 @@ Utils = {
}; };
if ( if (
'ontouchstart' in window || 'ontouchstart' in window
(window.DocumentTouch && document instanceof window.DocumentTouch) || (window.DocumentTouch && document instanceof window.DocumentTouch)
) { ) {
return true; return true;
} }
@ -260,8 +258,8 @@ Utils = {
calculateTouchDistance(touchA, touchB) { calculateTouchDistance(touchA, touchB) {
return Math.sqrt( return Math.sqrt(
Math.pow(touchA.screenX - touchB.screenX, 2) + Math.pow(touchA.screenX - touchB.screenX, 2)
Math.pow(touchA.screenY - touchB.screenY, 2), + Math.pow(touchA.screenY - touchB.screenY, 2),
); );
}, },
@ -278,9 +276,9 @@ Utils = {
}); });
$(document).on('touchend', selector, function(e) { $(document).on('touchend', selector, function(e) {
if ( if (
touchStart && touchStart
lastTouch && && lastTouch
Utils.calculateTouchDistance(touchStart, lastTouch) <= 20 && Utils.calculateTouchDistance(touchStart, lastTouch) <= 20
) { ) {
e.preventDefault(); e.preventDefault();
const clickEvent = document.createEvent('MouseEvents'); const clickEvent = document.createEvent('MouseEvents');