Drag handle toggle at top left: Each touch/non-touch screen can

use different setting, because it's saved to browser localstorage,
not database. For example, when using Firefox Multi-Account Containers AddOn,
different browsers etc, when logged in as same user.

Thanks to hatl and xet7 !

Fixes #4715
This commit is contained in:
Lauri Ojansivu 2022-10-23 15:17:41 +03:00
parent 2d16e35ac4
commit e214bc55dc
5 changed files with 38 additions and 11 deletions

View file

@ -107,6 +107,12 @@
#header-quick-access a { #header-quick-access a {
text-decoration: none; text-decoration: none;
} }
#header-quick-access i.fa {
color: #fff;
}
#header-quick-access i.fa:hover {
color: #ccc;
}
#header-quick-access #header-user-bar, #header-quick-access #header-user-bar,
#header-quick-access #header-new-board-icon, #header-quick-access #header-new-board-icon,
#header-quick-access ul li { #header-quick-access ul li {

View file

@ -6,6 +6,12 @@ template(name="header")
The first link goes to the boards page. The first link goes to the boards page.
if currentUser if currentUser
#header-quick-access(class=currentBoard.colorClass) #header-quick-access(class=currentBoard.colorClass)
a.js-toggle-desktop-drag-handles(title="{{_ 'show-desktop-drag-handles'}}" alt="{{_ 'show-desktop-drag-handles'}}")
i.fa.fa-arrows
if isShowDesktopDragHandles
i.fa.fa-check-square-o
unless isShowDesktopDragHandles
i.fa.fa-times
if isMiniScreen if isMiniScreen
span span
a(href="{{pathFor 'home'}}") a(href="{{pathFor 'home'}}")

View file

@ -57,6 +57,19 @@ Template.header.events({
Session.set('currentList', this._id); Session.set('currentList', this._id);
Session.set('currentCard', null); Session.set('currentCard', null);
}, },
'click .js-toggle-desktop-drag-handles'() {
//currentUser = Meteor.user();
//if (currentUser) {
// Meteor.call('toggleDesktopDragHandles');
//} else if (window.localStorage.getItem('showDesktopDragHandles')) {
if (window.localStorage.getItem('showDesktopDragHandles')) {
window.localStorage.removeItem('showDesktopDragHandles');
location.reload();
} else {
window.localStorage.setItem('showDesktopDragHandles', 'true');
location.reload();
}
},
}); });
Template.offlineWarning.events({ Template.offlineWarning.events({

View file

@ -159,12 +159,12 @@ template(name="changeSettingsPopup")
// | {{_ 'hide-system-messages'}} // | {{_ 'hide-system-messages'}}
// if hiddenSystemMessages // if hiddenSystemMessages
// i.fa.fa-check // i.fa.fa-check
li //li
a.js-toggle-desktop-drag-handles // a.js-toggle-desktop-drag-handles
i.fa.fa-arrows // i.fa.fa-arrows
| {{_ 'show-desktop-drag-handles'}} // | {{_ 'show-desktop-drag-handles'}}
if isShowDesktopDragHandles // if isShowDesktopDragHandles
i.fa.fa-check // i.fa.fa-check
unless currentUser.isWorker unless currentUser.isWorker
li li
label.bold.clear label.bold.clear

View file

@ -288,10 +288,11 @@ Utils = {
// returns if desktop drag handles are enabled // returns if desktop drag handles are enabled
isShowDesktopDragHandles() { isShowDesktopDragHandles() {
const currentUser = Meteor.user(); //const currentUser = Meteor.user();
if (currentUser) { //if (currentUser) {
return (currentUser.profile || {}).showDesktopDragHandles; // return (currentUser.profile || {}).showDesktopDragHandles;
} else if (window.localStorage.getItem('showDesktopDragHandles')) { //} else if (window.localStorage.getItem('showDesktopDragHandles')) {
if (window.localStorage.getItem('showDesktopDragHandles')) {
return true; return true;
} else { } else {
return false; return false;
@ -300,7 +301,8 @@ Utils = {
// returns if mini screen or desktop drag handles // returns if mini screen or desktop drag handles
isTouchScreenOrShowDesktopDragHandles() { isTouchScreenOrShowDesktopDragHandles() {
return this.isTouchScreen() || this.isShowDesktopDragHandles(); //return this.isTouchScreen() || this.isShowDesktopDragHandles();
return this.isShowDesktopDragHandles();
}, },
calculateIndexData(prevData, nextData, nItems = 1) { calculateIndexData(prevData, nextData, nItems = 1) {