summaryrefslogtreecommitdiffstats
path: root/client/components/swimlanes/swimlanes.js
diff options
context:
space:
mode:
Diffstat (limited to 'client/components/swimlanes/swimlanes.js')
-rw-r--r--client/components/swimlanes/swimlanes.js138
1 files changed, 109 insertions, 29 deletions
diff --git a/client/components/swimlanes/swimlanes.js b/client/components/swimlanes/swimlanes.js
index e0857003..9bc093be 100644
--- a/client/components/swimlanes/swimlanes.js
+++ b/client/components/swimlanes/swimlanes.js
@@ -3,8 +3,8 @@ const { calculateIndex, enableClickOnTouch } = Utils;
function currentListIsInThisSwimlane(swimlaneId) {
const currentList = Lists.findOne(Session.get('currentList'));
return (
- currentList &&
- (currentList.swimlaneId === swimlaneId || currentList.swimlaneId === '')
+ currentList
+ && (currentList.swimlaneId === swimlaneId || currentList.swimlaneId === '')
);
}
@@ -12,14 +12,14 @@ function currentCardIsInThisList(listId, swimlaneId) {
const currentCard = Cards.findOne(Session.get('currentCard'));
const currentUser = Meteor.user();
if (
- currentUser &&
- currentUser.profile &&
- currentUser.profile.boardView === 'board-view-swimlanes'
+ currentUser
+ && currentUser.profile
+ && Utils.boardView() === 'board-view-swimlanes'
)
return (
- currentCard &&
- currentCard.listId === listId &&
- currentCard.swimlaneId === swimlaneId
+ currentCard
+ && currentCard.listId === listId
+ && currentCard.swimlaneId === swimlaneId
);
// Default view: board-view-lists
else return currentCard && currentCard.listId === listId;
@@ -56,7 +56,6 @@ function initSortable(boardComponent, $listsDom) {
$listsDom.sortable({
tolerance: 'pointer',
helper: 'clone',
- handle: '.js-list-header',
items: '.js-list:not(.js-list-composer)',
placeholder: 'list placeholder',
distance: 7,
@@ -91,21 +90,47 @@ function initSortable(boardComponent, $listsDom) {
function userIsMember() {
return (
- Meteor.user() &&
- Meteor.user().isBoardMember() &&
- !Meteor.user().isCommentOnly()
+ Meteor.user()
+ && Meteor.user().isBoardMember()
+ && !Meteor.user().isCommentOnly()
);
}
- // Disable drag-dropping while in multi-selection mode, or if the current user
- // is not a board member
boardComponent.autorun(() => {
+ let showDesktopDragHandles = false;
+ currentUser = Meteor.user();
+ if (currentUser) {
+ showDesktopDragHandles = (currentUser.profile || {})
+ .showDesktopDragHandles;
+ } else {
+ import { Cookies } from 'meteor/ostrio:cookies';
+ const cookies = new Cookies();
+ if (cookies.has('showDesktopDragHandles')) {
+ showDesktopDragHandles = true;
+ } else {
+ showDesktopDragHandles = false;
+ }
+ }
+
+ if (!Utils.isMiniScreen() && showDesktopDragHandles) {
+ $listsDom.sortable({
+ handle: '.js-list-handle',
+ });
+ } else {
+ $listsDom.sortable({
+ handle: '.js-list-header',
+ });
+ }
+
const $listDom = $listsDom;
if ($listDom.data('sortable')) {
$listsDom.sortable(
'option',
'disabled',
- MultiSelection.isActive() || !userIsMember(),
+ // Disable drag-dropping when user is not member
+ !userIsMember(),
+ // Not disable drag-dropping while in multi-selection mode
+ // MultiSelection.isActive() || !userIsMember(),
);
}
});
@@ -121,6 +146,26 @@ BlazeComponent.extendComponent({
}
initSortable(boardComponent, $listsDom);
+
+ import { Cookies } from 'meteor/ostrio:cookies';
+ const cookies = new Cookies();
+ if (cookies.has('collapseSwimlane')) {
+ // Minimize swimlanes start https://www.w3schools.com/howto/howto_js_accordion.asp
+ const acc = document.getElementsByClassName('accordion');
+ let i;
+ for (i = 0; i < acc.length; i++) {
+ acc[i].addEventListener('click', function() {
+ this.classList.toggle('active');
+ const panel = this.nextElementSibling;
+ if (panel.style.maxHeight) {
+ panel.style.maxHeight = null;
+ } else {
+ panel.style.maxHeight = `${panel.scrollHeight}px`;
+ }
+ });
+ }
+ // Minimize swimlanes end https://www.w3schools.com/howto/howto_js_accordion.asp
+ }
},
onCreated() {
this.draggingActive = new ReactiveVar(false);
@@ -151,16 +196,32 @@ BlazeComponent.extendComponent({
// define a list of elements in which we disable the dragging because
// the user will legitimately expect to be able to select some text with
// his mouse.
- const noDragInside = [
- 'a',
- 'input',
- 'textarea',
- 'p',
- '.js-list-header',
- ];
+
+ let showDesktopDragHandles = false;
+ currentUser = Meteor.user();
+ if (currentUser) {
+ showDesktopDragHandles = (currentUser.profile || {})
+ .showDesktopDragHandles;
+ } else {
+ import { Cookies } from 'meteor/ostrio:cookies';
+ const cookies = new Cookies();
+ if (cookies.has('showDesktopDragHandles')) {
+ showDesktopDragHandles = true;
+ } else {
+ showDesktopDragHandles = false;
+ }
+ }
+
+ const noDragInside = ['a', 'input', 'textarea', 'p'].concat(
+ Utils.isMiniScreen()
+ || (!Utils.isMiniScreen() && showDesktopDragHandles)
+ ? ['.js-list-handle', '.js-swimlane-header-handle']
+ : ['.js-list-header'],
+ );
+
if (
- $(evt.target).closest(noDragInside.join(',')).length === 0 &&
- this.$('.swimlane').prop('clientHeight') > evt.offsetY
+ $(evt.target).closest(noDragInside.join(',')).length === 0
+ && this.$('.swimlane').prop('clientHeight') > evt.offsetY
) {
this._isDragging = true;
this._lastDragPositionX = evt.clientX;
@@ -194,8 +255,8 @@ BlazeComponent.extendComponent({
onCreated() {
this.currentBoard = Boards.findOne(Session.get('currentBoard'));
this.isListTemplatesSwimlane =
- this.currentBoard.isTemplatesBoard() &&
- this.currentData().isListTemplatesSwimlane();
+ this.currentBoard.isTemplatesBoard()
+ && this.currentData().isListTemplatesSwimlane();
this.currentSwimlane = this.currentData();
},
@@ -233,11 +294,25 @@ BlazeComponent.extendComponent({
}).register('addListForm');
Template.swimlane.helpers({
+ showDesktopDragHandles() {
+ currentUser = Meteor.user();
+ if (currentUser) {
+ return (currentUser.profile || {}).showDesktopDragHandles;
+ } else {
+ import { Cookies } from 'meteor/ostrio:cookies';
+ const cookies = new Cookies();
+ if (cookies.has('showDesktopDragHandles')) {
+ return true;
+ } else {
+ return false;
+ }
+ }
+ },
canSeeAddList() {
return (
- Meteor.user() &&
- Meteor.user().isBoardMember() &&
- !Meteor.user().isCommentOnly()
+ Meteor.user()
+ && Meteor.user().isBoardMember()
+ && !Meteor.user().isCommentOnly()
);
},
});
@@ -253,6 +328,11 @@ BlazeComponent.extendComponent({
return false;
}
}
+ if (Filter.lists._isActive()) {
+ if (!list.title.match(Filter.lists.getRegexSelector())) {
+ return false;
+ }
+ }
if (Filter.hideEmpty.isSelected()) {
const swimlaneId = this.parentComponent()
.parentComponent()