From 96abe3c6914ce37d9fb44da8fda375e40ad65c9e Mon Sep 17 00:00:00 2001 From: Lauri Ojansivu Date: Mon, 18 Nov 2019 22:23:49 +0200 Subject: New feature: Now there is popup selection of Lists/Swimlanes/Calendar/Roles. New feature, not set visible yet, because switching to it does not work properly yet: Collapsible Swimlanes #2804 Fix: Public board now loads correctly. When you select one of Lists/Swimlanes/Calendar view and reload webbrowser page, it can change view. Closes #2311 Fix: List sorting commented out. Closes #2800 Fix: Errors hasHiddenMinicardText, hasShowDragHandles, showSort, hasSortBy, profile, FirefoxAndroid/IE11/Vivaldi/Chromium browsers not working by using cookies instead of database. More details at https://github.com/wekan/wekan/issues/2643#issuecomment-554907955 Note: Cookie changes are not always immediate, if there is no effect, you may need to reload webbrowser page. Closes #2643 . Thanks to xet7 ! --- client/components/swimlanes/swimlanes.js | 55 +++++++++++++++++++------------- 1 file changed, 33 insertions(+), 22 deletions(-) (limited to 'client/components/swimlanes/swimlanes.js') diff --git a/client/components/swimlanes/swimlanes.js b/client/components/swimlanes/swimlanes.js index 56d8fb81..1bb522e5 100644 --- a/client/components/swimlanes/swimlanes.js +++ b/client/components/swimlanes/swimlanes.js @@ -14,7 +14,7 @@ function currentCardIsInThisList(listId, swimlaneId) { if ( currentUser && currentUser.profile && - currentUser.profile.boardView === 'board-view-swimlanes' + Utils.boardView() === 'board-view-swimlanes' ) return ( currentCard && @@ -97,10 +97,9 @@ function initSortable(boardComponent, $listsDom) { } boardComponent.autorun(() => { - if ( - Utils.isMiniScreen() || - (!Utils.isMiniScreen() && Meteor.user().hasShowDesktopDragHandles()) - ) { + import { Cookies } from 'meteor/ostrio:cookies'; + const cookies = new Cookies(); + if (!Utils.isMiniScreen() && cookies.has('showDesktopDragHandles')) { $listsDom.sortable({ handle: '.js-list-handle', }); @@ -135,21 +134,25 @@ BlazeComponent.extendComponent({ initSortable(boardComponent, $listsDom); - // 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`; - } - }); + 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 } - // Minimize swimlanes end https://www.w3schools.com/howto/howto_js_accordion.asp }, onCreated() { this.draggingActive = new ReactiveVar(false); @@ -181,10 +184,12 @@ BlazeComponent.extendComponent({ // the user will legitimately expect to be able to select some text with // his mouse. + import { Cookies } from 'meteor/ostrio:cookies'; + const cookies = new Cookies(); + const noDragInside = ['a', 'input', 'textarea', 'p'].concat( Utils.isMiniScreen() || - (!Utils.isMiniScreen() && - Meteor.user().hasShowDesktopDragHandles()) + (!Utils.isMiniScreen() && cookies.has('showDesktopDragHandles')) ? ['.js-list-handle', '.js-swimlane-header-handle'] : ['.js-list-header'], ); @@ -265,7 +270,13 @@ BlazeComponent.extendComponent({ Template.swimlane.helpers({ showDesktopDragHandles() { - return Meteor.user().hasShowDesktopDragHandles(); + import { Cookies } from 'meteor/ostrio:cookies'; + const cookies = new Cookies(); + if (cookies.has('showDesktopDragHandles')) { + return true; + } else { + return false; + } }, canSeeAddList() { return ( -- cgit v1.2.3-1-g7c22