mirror of
https://github.com/wekan/wekan.git
synced 2025-12-16 23:40:13 +01:00
When logged in, use database for setting, so that changes are
immediate. Only on public board use cookies. Comment out Collapse CSS that is not in use. Thanks to xet7 !
This commit is contained in:
parent
f595120e72
commit
351d4767d7
12 changed files with 318 additions and 131 deletions
|
|
@ -196,9 +196,20 @@ BlazeComponent.extendComponent({
|
||||||
const cookies = new Cookies();
|
const cookies = new Cookies();
|
||||||
|
|
||||||
this.autorun(() => {
|
this.autorun(() => {
|
||||||
|
let showDesktopDragHandles = false;
|
||||||
|
currentUser = Meteor.user();
|
||||||
|
if (currentUser) {
|
||||||
|
showDesktopDragHandles = (currentUser.profile || {}).showDesktopDragHandles;
|
||||||
|
} else {
|
||||||
|
if (cookies.has('showDesktopDragHandles')) {
|
||||||
|
showDesktopDragHandles = true;
|
||||||
|
} else {
|
||||||
|
showDesktopDragHandles = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
if (
|
if (
|
||||||
Utils.isMiniScreen() ||
|
Utils.isMiniScreen() ||
|
||||||
(!Utils.isMiniScreen() && cookies.has('showDesktopDragHandles'))
|
(!Utils.isMiniScreen() && showDesktopDragHandles)
|
||||||
) {
|
) {
|
||||||
$swimlanesDom.sortable({
|
$swimlanesDom.sortable({
|
||||||
handle: '.js-swimlane-header-handle',
|
handle: '.js-swimlane-header-handle',
|
||||||
|
|
@ -230,33 +241,36 @@ BlazeComponent.extendComponent({
|
||||||
},
|
},
|
||||||
|
|
||||||
isViewSwimlanes() {
|
isViewSwimlanes() {
|
||||||
|
currentUser = Meteor.user();
|
||||||
|
if (currentUser) {
|
||||||
|
return (currentUser.profile || {}).boardView === 'board-view-swimlanes';
|
||||||
|
} else {
|
||||||
import { Cookies } from 'meteor/ostrio:cookies';
|
import { Cookies } from 'meteor/ostrio:cookies';
|
||||||
const cookies = new Cookies();
|
const cookies = new Cookies();
|
||||||
const currentUser = Meteor.user();
|
|
||||||
if (!currentUser) {
|
|
||||||
return cookies.get('boardView') === 'board-view-swimlanes';
|
return cookies.get('boardView') === 'board-view-swimlanes';
|
||||||
}
|
}
|
||||||
return (currentUser.profile || {}).boardView === 'board-view-swimlanes';
|
|
||||||
},
|
},
|
||||||
|
|
||||||
isViewLists() {
|
isViewLists() {
|
||||||
|
currentUser = Meteor.user();
|
||||||
|
if (currentUser) {
|
||||||
|
return (currentUser.profile || {}).boardView === 'board-view-lists';
|
||||||
|
} else {
|
||||||
import { Cookies } from 'meteor/ostrio:cookies';
|
import { Cookies } from 'meteor/ostrio:cookies';
|
||||||
const cookies = new Cookies();
|
const cookies = new Cookies();
|
||||||
const currentUser = Meteor.user();
|
|
||||||
if (!currentUser) {
|
|
||||||
return cookies.get('boardView') === 'board-view-lists';
|
return cookies.get('boardView') === 'board-view-lists';
|
||||||
}
|
}
|
||||||
return (currentUser.profile || {}).boardView === 'board-view-lists';
|
|
||||||
},
|
},
|
||||||
|
|
||||||
isViewCalendar() {
|
isViewCalendar() {
|
||||||
|
currentUser = Meteor.user();
|
||||||
|
if (currentUser) {
|
||||||
|
return (currentUser.profile || {}).boardView === 'board-view-cal';
|
||||||
|
} else {
|
||||||
import { Cookies } from 'meteor/ostrio:cookies';
|
import { Cookies } from 'meteor/ostrio:cookies';
|
||||||
const cookies = new Cookies();
|
const cookies = new Cookies();
|
||||||
const currentUser = Meteor.user();
|
|
||||||
if (!currentUser) {
|
|
||||||
return cookies.get('boardView') === 'board-view-cal';
|
return cookies.get('boardView') === 'board-view-cal';
|
||||||
}
|
}
|
||||||
return (currentUser.profile || {}).boardView === 'board-view-cal';
|
|
||||||
},
|
},
|
||||||
|
|
||||||
openNewListForm() {
|
openNewListForm() {
|
||||||
|
|
@ -413,12 +427,13 @@ BlazeComponent.extendComponent({
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
isViewCalendar() {
|
isViewCalendar() {
|
||||||
|
currentUser = Meteor.user();
|
||||||
|
if (currentUser) {
|
||||||
|
return (currentUser.profile || {}).boardView === 'board-view-cal';
|
||||||
|
} else {
|
||||||
import { Cookies } from 'meteor/ostrio:cookies';
|
import { Cookies } from 'meteor/ostrio:cookies';
|
||||||
const cookies = new Cookies();
|
const cookies = new Cookies();
|
||||||
const currentUser = Meteor.user();
|
|
||||||
if (!currentUser) {
|
|
||||||
return cookies.get('boardView') === 'board-view-cal';
|
return cookies.get('boardView') === 'board-view-cal';
|
||||||
}
|
}
|
||||||
return (currentUser.profile || {}).boardView === 'board-view-cal';
|
|
||||||
},
|
},
|
||||||
}).register('calendarView');
|
}).register('calendarView');
|
||||||
|
|
|
||||||
|
|
@ -33,6 +33,10 @@ BlazeComponent.extendComponent({
|
||||||
|
|
||||||
Template.minicard.helpers({
|
Template.minicard.helpers({
|
||||||
showDesktopDragHandles() {
|
showDesktopDragHandles() {
|
||||||
|
currentUser = Meteor.user();
|
||||||
|
if (currentUser) {
|
||||||
|
return (currentUser.profile || {}).showDesktopDragHandles;
|
||||||
|
} else {
|
||||||
import { Cookies } from 'meteor/ostrio:cookies';
|
import { Cookies } from 'meteor/ostrio:cookies';
|
||||||
const cookies = new Cookies();
|
const cookies = new Cookies();
|
||||||
if (cookies.has('showDesktopDragHandles')) {
|
if (cookies.has('showDesktopDragHandles')) {
|
||||||
|
|
@ -40,8 +44,13 @@ Template.minicard.helpers({
|
||||||
} else {
|
} else {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
},
|
},
|
||||||
hiddenMinicardLabelText() {
|
hiddenMinicardLabelText() {
|
||||||
|
currentUser = Meteor.user();
|
||||||
|
if (currentUser) {
|
||||||
|
return (currentUser.profile || {}).hiddenMinicardLabelText;
|
||||||
|
} else {
|
||||||
import { Cookies } from 'meteor/ostrio:cookies';
|
import { Cookies } from 'meteor/ostrio:cookies';
|
||||||
const cookies = new Cookies();
|
const cookies = new Cookies();
|
||||||
if (cookies.has('hiddenMinicardLabelText')) {
|
if (cookies.has('hiddenMinicardLabelText')) {
|
||||||
|
|
@ -49,5 +58,6 @@ Template.minicard.helpers({
|
||||||
} else {
|
} else {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
|
||||||
|
|
@ -119,7 +119,19 @@ BlazeComponent.extendComponent({
|
||||||
const cookies = new Cookies();
|
const cookies = new Cookies();
|
||||||
|
|
||||||
this.autorun(() => {
|
this.autorun(() => {
|
||||||
if (!Utils.isMiniScreen() && cookies.has('showDesktopDragHandles')) {
|
let showDesktopDragHandles = false;
|
||||||
|
currentUser = Meteor.user();
|
||||||
|
if (currentUser) {
|
||||||
|
showDesktopDragHandles = (currentUser.profile || {}).showDesktopDragHandles;
|
||||||
|
} else {
|
||||||
|
if (cookies.has('showDesktopDragHandles')) {
|
||||||
|
showDesktopDragHandles = true;
|
||||||
|
} else {
|
||||||
|
showDesktopDragHandles = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!Utils.isMiniScreen() && showDesktopDragHandles) {
|
||||||
$cards.sortable({
|
$cards.sortable({
|
||||||
handle: '.handle',
|
handle: '.handle',
|
||||||
});
|
});
|
||||||
|
|
@ -163,6 +175,10 @@ BlazeComponent.extendComponent({
|
||||||
|
|
||||||
Template.list.helpers({
|
Template.list.helpers({
|
||||||
showDesktopDragHandles() {
|
showDesktopDragHandles() {
|
||||||
|
currentUser = Meteor.user();
|
||||||
|
if (currentUser) {
|
||||||
|
return (currentUser.profile || {}).showDesktopDragHandles;
|
||||||
|
} else {
|
||||||
import { Cookies } from 'meteor/ostrio:cookies';
|
import { Cookies } from 'meteor/ostrio:cookies';
|
||||||
const cookies = new Cookies();
|
const cookies = new Cookies();
|
||||||
if (cookies.has('showDesktopDragHandles')) {
|
if (cookies.has('showDesktopDragHandles')) {
|
||||||
|
|
@ -170,6 +186,7 @@ Template.list.helpers({
|
||||||
} else {
|
} else {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -102,6 +102,10 @@ BlazeComponent.extendComponent({
|
||||||
|
|
||||||
Template.listHeader.helpers({
|
Template.listHeader.helpers({
|
||||||
showDesktopDragHandles() {
|
showDesktopDragHandles() {
|
||||||
|
currentUser = Meteor.user();
|
||||||
|
if (currentUser) {
|
||||||
|
return (currentUser.profile || {}).showDesktopDragHandles;
|
||||||
|
} else {
|
||||||
import { Cookies } from 'meteor/ostrio:cookies';
|
import { Cookies } from 'meteor/ostrio:cookies';
|
||||||
const cookies = new Cookies();
|
const cookies = new Cookies();
|
||||||
if (cookies.has('showDesktopDragHandles')) {
|
if (cookies.has('showDesktopDragHandles')) {
|
||||||
|
|
@ -109,6 +113,7 @@ Template.listHeader.helpers({
|
||||||
} else {
|
} else {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -107,12 +107,17 @@ BlazeComponent.extendComponent({
|
||||||
'click .js-toggle-sidebar': this.toggle,
|
'click .js-toggle-sidebar': this.toggle,
|
||||||
'click .js-back-home': this.setView,
|
'click .js-back-home': this.setView,
|
||||||
'click .js-toggle-minicard-label-text'() {
|
'click .js-toggle-minicard-label-text'() {
|
||||||
|
currentUser = Meteor.user();
|
||||||
|
if (currentUser) {
|
||||||
|
Meteor.call('toggleMinicardLabelText');
|
||||||
|
} else {
|
||||||
import { Cookies } from 'meteor/ostrio:cookies';
|
import { Cookies } from 'meteor/ostrio:cookies';
|
||||||
const cookies = new Cookies();
|
const cookies = new Cookies();
|
||||||
if (cookies.has('hiddenMinicardLabelText')) {
|
if (cookies.has('hiddenMinicardLabelText')) {
|
||||||
cookies.remove('hiddenMinicardLabelText'); //true
|
cookies.remove('hiddenMinicardLabelText');
|
||||||
} else {
|
} else {
|
||||||
cookies.set('hiddenMinicardLabelText', 'true'); //true
|
cookies.set('hiddenMinicardLabelText', 'true');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
'click .js-shortcuts'() {
|
'click .js-shortcuts'() {
|
||||||
|
|
@ -127,6 +132,10 @@ Blaze.registerHelper('Sidebar', () => Sidebar);
|
||||||
|
|
||||||
Template.homeSidebar.helpers({
|
Template.homeSidebar.helpers({
|
||||||
hiddenMinicardLabelText() {
|
hiddenMinicardLabelText() {
|
||||||
|
currentUser = Meteor.user();
|
||||||
|
if (currentUser) {
|
||||||
|
return (currentUser.profile || {}).hiddenMinicardLabelText;
|
||||||
|
} else {
|
||||||
import { Cookies } from 'meteor/ostrio:cookies';
|
import { Cookies } from 'meteor/ostrio:cookies';
|
||||||
const cookies = new Cookies();
|
const cookies = new Cookies();
|
||||||
if (cookies.has('hiddenMinicardLabelText')) {
|
if (cookies.has('hiddenMinicardLabelText')) {
|
||||||
|
|
@ -134,6 +143,7 @@ Template.homeSidebar.helpers({
|
||||||
} else {
|
} else {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -30,6 +30,10 @@ BlazeComponent.extendComponent({
|
||||||
|
|
||||||
Template.swimlaneHeader.helpers({
|
Template.swimlaneHeader.helpers({
|
||||||
showDesktopDragHandles() {
|
showDesktopDragHandles() {
|
||||||
|
currentUser = Meteor.user();
|
||||||
|
if (currentUser) {
|
||||||
|
return (currentUser.profile || {}).showDesktopDragHandles;
|
||||||
|
} else {
|
||||||
import { Cookies } from 'meteor/ostrio:cookies';
|
import { Cookies } from 'meteor/ostrio:cookies';
|
||||||
const cookies = new Cookies();
|
const cookies = new Cookies();
|
||||||
if (cookies.has('showDesktopDragHandles')) {
|
if (cookies.has('showDesktopDragHandles')) {
|
||||||
|
|
@ -37,6 +41,7 @@ Template.swimlaneHeader.helpers({
|
||||||
} else {
|
} else {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -20,28 +20,28 @@ template(name="swimlane")
|
||||||
if currentUser.isBoardMember
|
if currentUser.isBoardMember
|
||||||
unless currentUser.isCommentOnly
|
unless currentUser.isCommentOnly
|
||||||
+addListForm
|
+addListForm
|
||||||
if collapseSwimlane
|
//if collapseSwimlane
|
||||||
// Minimize swimlanes next 2 lines below https://www.w3schools.com/howto/howto_js_accordion.asp
|
// // Minimize swimlanes next 2 lines below https://www.w3schools.com/howto/howto_js_accordion.asp
|
||||||
button(class="accordion")
|
// button(class="accordion")
|
||||||
div(class="panel")
|
// div(class="panel")
|
||||||
.swimlane.js-lists.js-swimlane
|
// .swimlane.js-lists.js-swimlane
|
||||||
if isMiniScreen
|
// if isMiniScreen
|
||||||
if currentListIsInThisSwimlane _id
|
// if currentListIsInThisSwimlane _id
|
||||||
+list(currentList)
|
// +list(currentList)
|
||||||
unless currentList
|
// unless currentList
|
||||||
each lists
|
// each lists
|
||||||
+miniList(this)
|
// +miniList(this)
|
||||||
if currentUser.isBoardMember
|
// if currentUser.isBoardMember
|
||||||
unless currentUser.isCommentOnly
|
// unless currentUser.isCommentOnly
|
||||||
+addListForm
|
// +addListForm
|
||||||
else
|
// else
|
||||||
each lists
|
// each lists
|
||||||
+list(this)
|
// +list(this)
|
||||||
if currentCardIsInThisList _id ../_id
|
// if currentCardIsInThisList _id ../_id
|
||||||
+cardDetails(currentCard)
|
// +cardDetails(currentCard)
|
||||||
if currentUser.isBoardMember
|
// if currentUser.isBoardMember
|
||||||
unless currentUser.isCommentOnly
|
// unless currentUser.isCommentOnly
|
||||||
+addListForm
|
// +addListForm
|
||||||
|
|
||||||
template(name="listsGroup")
|
template(name="listsGroup")
|
||||||
.swimlane.list-group.js-lists
|
.swimlane.list-group.js-lists
|
||||||
|
|
|
||||||
|
|
@ -99,7 +99,21 @@ function initSortable(boardComponent, $listsDom) {
|
||||||
boardComponent.autorun(() => {
|
boardComponent.autorun(() => {
|
||||||
import { Cookies } from 'meteor/ostrio:cookies';
|
import { Cookies } from 'meteor/ostrio:cookies';
|
||||||
const cookies = new Cookies();
|
const cookies = new Cookies();
|
||||||
if (!Utils.isMiniScreen() && cookies.has('showDesktopDragHandles')) {
|
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({
|
$listsDom.sortable({
|
||||||
handle: '.js-list-handle',
|
handle: '.js-list-handle',
|
||||||
});
|
});
|
||||||
|
|
@ -186,10 +200,23 @@ BlazeComponent.extendComponent({
|
||||||
|
|
||||||
import { Cookies } from 'meteor/ostrio:cookies';
|
import { Cookies } from 'meteor/ostrio:cookies';
|
||||||
const cookies = new Cookies();
|
const cookies = new Cookies();
|
||||||
|
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(
|
const noDragInside = ['a', 'input', 'textarea', 'p'].concat(
|
||||||
Utils.isMiniScreen() ||
|
Utils.isMiniScreen() ||
|
||||||
(!Utils.isMiniScreen() && cookies.has('showDesktopDragHandles'))
|
(!Utils.isMiniScreen() && showDesktopDragHandles)
|
||||||
? ['.js-list-handle', '.js-swimlane-header-handle']
|
? ['.js-list-handle', '.js-swimlane-header-handle']
|
||||||
: ['.js-list-header'],
|
: ['.js-list-header'],
|
||||||
);
|
);
|
||||||
|
|
@ -270,6 +297,10 @@ BlazeComponent.extendComponent({
|
||||||
|
|
||||||
Template.swimlane.helpers({
|
Template.swimlane.helpers({
|
||||||
showDesktopDragHandles() {
|
showDesktopDragHandles() {
|
||||||
|
currentUser = Meteor.user();
|
||||||
|
if (currentUser) {
|
||||||
|
return (currentUser.profile || {}).showDesktopDragHandles;
|
||||||
|
} else {
|
||||||
import { Cookies } from 'meteor/ostrio:cookies';
|
import { Cookies } from 'meteor/ostrio:cookies';
|
||||||
const cookies = new Cookies();
|
const cookies = new Cookies();
|
||||||
if (cookies.has('showDesktopDragHandles')) {
|
if (cookies.has('showDesktopDragHandles')) {
|
||||||
|
|
@ -277,6 +308,7 @@ Template.swimlane.helpers({
|
||||||
} else {
|
} else {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
},
|
},
|
||||||
canSeeAddList() {
|
canSeeAddList() {
|
||||||
return (
|
return (
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,6 @@
|
||||||
@import 'nib'
|
@import 'nib'
|
||||||
|
|
||||||
|
/*
|
||||||
// Minimize swimlanes start https://www.w3schools.com/howto/howto_js_accordion.asp
|
// Minimize swimlanes start https://www.w3schools.com/howto/howto_js_accordion.asp
|
||||||
|
|
||||||
.accordion
|
.accordion
|
||||||
|
|
@ -33,6 +34,7 @@
|
||||||
padding: 0px
|
padding: 0px
|
||||||
|
|
||||||
// Minimize swimlanes end https://www.w3schools.com/howto/howto_js_accordion.asp
|
// Minimize swimlanes end https://www.w3schools.com/howto/howto_js_accordion.asp
|
||||||
|
*/
|
||||||
|
|
||||||
.swimlane
|
.swimlane
|
||||||
// Even if this background color is the same as the body we can't leave it
|
// Even if this background color is the same as the body we can't leave it
|
||||||
|
|
|
||||||
|
|
@ -5,10 +5,22 @@ Template.headerUserBar.events({
|
||||||
|
|
||||||
Template.memberMenuPopup.helpers({
|
Template.memberMenuPopup.helpers({
|
||||||
templatesBoardId() {
|
templatesBoardId() {
|
||||||
|
currentUser = Meteor.user();
|
||||||
|
if (currentUser) {
|
||||||
return Meteor.user().getTemplatesBoardId();
|
return Meteor.user().getTemplatesBoardId();
|
||||||
|
} else {
|
||||||
|
// No need to getTemplatesBoardId on public board
|
||||||
|
return false;
|
||||||
|
}
|
||||||
},
|
},
|
||||||
templatesBoardSlug() {
|
templatesBoardSlug() {
|
||||||
|
currentUser = Meteor.user();
|
||||||
|
if (currentUser) {
|
||||||
return Meteor.user().getTemplatesBoardSlug();
|
return Meteor.user().getTemplatesBoardSlug();
|
||||||
|
} else {
|
||||||
|
// No need to getTemplatesBoardSlug() on public board
|
||||||
|
return false;
|
||||||
|
}
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
@ -162,6 +174,10 @@ Template.changeLanguagePopup.events({
|
||||||
|
|
||||||
Template.changeSettingsPopup.helpers({
|
Template.changeSettingsPopup.helpers({
|
||||||
showDesktopDragHandles() {
|
showDesktopDragHandles() {
|
||||||
|
currentUser = Meteor.user();
|
||||||
|
if (currentUser) {
|
||||||
|
return (currentUser.profile || {}).showDesktopDragHandles;
|
||||||
|
} else {
|
||||||
import { Cookies } from 'meteor/ostrio:cookies';
|
import { Cookies } from 'meteor/ostrio:cookies';
|
||||||
const cookies = new Cookies();
|
const cookies = new Cookies();
|
||||||
if (cookies.has('showDesktopDragHandles')) {
|
if (cookies.has('showDesktopDragHandles')) {
|
||||||
|
|
@ -169,37 +185,62 @@ Template.changeSettingsPopup.helpers({
|
||||||
} else {
|
} else {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
},
|
},
|
||||||
hiddenSystemMessages() {
|
hiddenSystemMessages() {
|
||||||
const currentUser = Meteor.user();
|
currentUser = Meteor.user();
|
||||||
if (currentUser) {
|
if (currentUser) {
|
||||||
return Meteor.user().hasHiddenSystemMessages();
|
return (currentUser.profile || {}).hasHiddenSystemMessages;
|
||||||
|
} else {
|
||||||
|
import { Cookies } from 'meteor/ostrio:cookies';
|
||||||
|
const cookies = new Cookies();
|
||||||
|
if (cookies.has('hasHiddenSystemMessages')) {
|
||||||
|
return true;
|
||||||
} else {
|
} else {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
},
|
},
|
||||||
showCardsCountAt() {
|
showCardsCountAt() {
|
||||||
const currentUser = Meteor.user();
|
currentUser = Meteor.user();
|
||||||
if (currentUser) {
|
if (currentUser) {
|
||||||
return Meteor.user().getLimitToShowCardsCount();
|
return Meteor.user().getLimitToShowCardsCount();
|
||||||
} else {
|
} else {
|
||||||
return false;
|
import { Cookies } from 'meteor/ostrio:cookies';
|
||||||
|
const cookies = new Cookies();
|
||||||
|
return cookies.get('limitToShowCardsCount');
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
Template.changeSettingsPopup.events({
|
Template.changeSettingsPopup.events({
|
||||||
'click .js-toggle-desktop-drag-handles'() {
|
'click .js-toggle-desktop-drag-handles'() {
|
||||||
|
currentUser = Meteor.user();
|
||||||
|
if (currentUser) {
|
||||||
|
Meteor.call('toggleDesktopDragHandles');
|
||||||
|
} else {
|
||||||
import { Cookies } from 'meteor/ostrio:cookies';
|
import { Cookies } from 'meteor/ostrio:cookies';
|
||||||
const cookies = new Cookies();
|
const cookies = new Cookies();
|
||||||
if (cookies.has('showDesktopDragHandles')) {
|
if (cookies.has('showDesktopDragHandles')) {
|
||||||
cookies.remove('showDesktopDragHandles'); //true
|
cookies.remove('showDesktopDragHandles');
|
||||||
} else {
|
} else {
|
||||||
cookies.set('showDesktopDragHandles', 'true'); //true
|
cookies.set('showDesktopDragHandles', 'true');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
'click .js-toggle-system-messages'() {
|
'click .js-toggle-system-messages'() {
|
||||||
|
currentUser = Meteor.user();
|
||||||
|
if (currentUser) {
|
||||||
Meteor.call('toggleSystemMessages');
|
Meteor.call('toggleSystemMessages');
|
||||||
|
} else {
|
||||||
|
import { Cookies } from 'meteor/ostrio:cookies';
|
||||||
|
const cookies = new Cookies();
|
||||||
|
if (cookies.has('hasHiddenSystemMessages')) {
|
||||||
|
cookies.remove('hasHiddenSystemMessages');
|
||||||
|
} else {
|
||||||
|
cookies.set('hasHiddenSystemMessages', 'true');
|
||||||
|
}
|
||||||
|
}
|
||||||
},
|
},
|
||||||
'click .js-apply-show-cards-at'(event, templateInstance) {
|
'click .js-apply-show-cards-at'(event, templateInstance) {
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
|
|
@ -208,7 +249,14 @@ Template.changeSettingsPopup.events({
|
||||||
10,
|
10,
|
||||||
);
|
);
|
||||||
if (!isNaN(minLimit)) {
|
if (!isNaN(minLimit)) {
|
||||||
|
currentUser = Meteor.user();
|
||||||
|
if (currentUser) {
|
||||||
Meteor.call('changeLimitToShowCardsCount', minLimit);
|
Meteor.call('changeLimitToShowCardsCount', minLimit);
|
||||||
|
} else {
|
||||||
|
import { Cookies } from 'meteor/ostrio:cookies';
|
||||||
|
const cookies = new Cookies();
|
||||||
|
cookies.set('limitToShowCardsCount', minLimit);
|
||||||
|
}
|
||||||
Popup.back();
|
Popup.back();
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
|
||||||
|
|
@ -119,6 +119,13 @@ Users.attachSchema(
|
||||||
type: String,
|
type: String,
|
||||||
optional: true,
|
optional: true,
|
||||||
},
|
},
|
||||||
|
'profile.showDesktopDragHandles': {
|
||||||
|
/**
|
||||||
|
* does the user want to hide system messages?
|
||||||
|
*/
|
||||||
|
type: Boolean,
|
||||||
|
optional: true,
|
||||||
|
},
|
||||||
'profile.hiddenSystemMessages': {
|
'profile.hiddenSystemMessages': {
|
||||||
/**
|
/**
|
||||||
* does the user want to hide system messages?
|
* does the user want to hide system messages?
|
||||||
|
|
@ -126,6 +133,13 @@ Users.attachSchema(
|
||||||
type: Boolean,
|
type: Boolean,
|
||||||
optional: true,
|
optional: true,
|
||||||
},
|
},
|
||||||
|
'profile.hiddenMinicardLabelText': {
|
||||||
|
/**
|
||||||
|
* does the user want to hide minicard label texts?
|
||||||
|
*/
|
||||||
|
type: Boolean,
|
||||||
|
optional: true,
|
||||||
|
},
|
||||||
'profile.initials': {
|
'profile.initials': {
|
||||||
/**
|
/**
|
||||||
* initials of the user
|
* initials of the user
|
||||||
|
|
@ -184,7 +198,6 @@ Users.attachSchema(
|
||||||
allowedValues: [
|
allowedValues: [
|
||||||
'board-view-lists',
|
'board-view-lists',
|
||||||
'board-view-swimlanes',
|
'board-view-swimlanes',
|
||||||
'board-view-collapse',
|
|
||||||
'board-view-cal',
|
'board-view-cal',
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
|
|
@ -382,18 +395,10 @@ Users.helpers({
|
||||||
}
|
}
|
||||||
return ret;
|
return ret;
|
||||||
},
|
},
|
||||||
//hasSortBy() {
|
hasSortBy() {
|
||||||
// if use doesn't have dragHandle, then we can let user to choose sort list by different order
|
// if use doesn't have dragHandle, then we can let user to choose sort list by different order
|
||||||
//return this.hasShowDesktopDragHandles();
|
return !this.hasShowDesktopDragHandles();
|
||||||
// return false;
|
},
|
||||||
/*
|
|
||||||
if (typeof currentUser === 'undefined' || typeof currentUser === 'null') {
|
|
||||||
return false;
|
|
||||||
} else {
|
|
||||||
return this.hasShowDesktopDragHandles();
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
//},
|
|
||||||
getListSortBy() {
|
getListSortBy() {
|
||||||
return this._getListSortBy()[0];
|
return this._getListSortBy()[0];
|
||||||
},
|
},
|
||||||
|
|
@ -414,11 +419,21 @@ Users.helpers({
|
||||||
return _.contains(notifications, activityId);
|
return _.contains(notifications, activityId);
|
||||||
},
|
},
|
||||||
|
|
||||||
|
hasShowDesktopDragHandles() {
|
||||||
|
const profile = this.profile || {};
|
||||||
|
return profile.showDesktopDragHandles || false;
|
||||||
|
},
|
||||||
|
|
||||||
hasHiddenSystemMessages() {
|
hasHiddenSystemMessages() {
|
||||||
const profile = this.profile || {};
|
const profile = this.profile || {};
|
||||||
return profile.hiddenSystemMessages || false;
|
return profile.hiddenSystemMessages || false;
|
||||||
},
|
},
|
||||||
|
|
||||||
|
hasHiddenMinicardLabelText() {
|
||||||
|
const profile = this.profile || {};
|
||||||
|
return profile.hiddenMinicardLabelText || false;
|
||||||
|
},
|
||||||
|
|
||||||
getEmailBuffer() {
|
getEmailBuffer() {
|
||||||
const { emailBuffer = [] } = this.profile || {};
|
const { emailBuffer = [] } = this.profile || {};
|
||||||
return emailBuffer;
|
return emailBuffer;
|
||||||
|
|
@ -440,11 +455,8 @@ Users.helpers({
|
||||||
},
|
},
|
||||||
|
|
||||||
getLimitToShowCardsCount() {
|
getLimitToShowCardsCount() {
|
||||||
currentUser = Meteor.user();
|
|
||||||
if (currentUser) {
|
|
||||||
const profile = this.profile || {};
|
const profile = this.profile || {};
|
||||||
return profile.showCardsCountAt;
|
return profile.showCardsCountAt;
|
||||||
}
|
|
||||||
},
|
},
|
||||||
|
|
||||||
getName() {
|
getName() {
|
||||||
|
|
@ -524,6 +536,13 @@ Users.mutations({
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
|
toggleDesktopHandles(value = false) {
|
||||||
|
return {
|
||||||
|
$set: {
|
||||||
|
'profile.showDesktopDragHandles': !value,
|
||||||
|
},
|
||||||
|
};
|
||||||
|
},
|
||||||
|
|
||||||
toggleSystem(value = false) {
|
toggleSystem(value = false) {
|
||||||
return {
|
return {
|
||||||
|
|
@ -533,6 +552,14 @@ Users.mutations({
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
|
|
||||||
|
toggleLabelText(value = false) {
|
||||||
|
return {
|
||||||
|
$set: {
|
||||||
|
'profile.hiddenMinicardLabelText': !value,
|
||||||
|
},
|
||||||
|
};
|
||||||
|
},
|
||||||
|
|
||||||
addNotification(activityId) {
|
addNotification(activityId) {
|
||||||
return {
|
return {
|
||||||
$addToSet: {
|
$addToSet: {
|
||||||
|
|
@ -597,10 +624,18 @@ Meteor.methods({
|
||||||
check(value, String);
|
check(value, String);
|
||||||
Meteor.user().setListSortBy(value);
|
Meteor.user().setListSortBy(value);
|
||||||
},
|
},
|
||||||
|
toggleDesktopDragHandles() {
|
||||||
|
const user = Meteor.user();
|
||||||
|
user.toggleDesktopHandles(user.hasShowDesktopDragHandles());
|
||||||
|
},
|
||||||
toggleSystemMessages() {
|
toggleSystemMessages() {
|
||||||
const user = Meteor.user();
|
const user = Meteor.user();
|
||||||
user.toggleSystem(user.hasHiddenSystemMessages());
|
user.toggleSystem(user.hasHiddenSystemMessages());
|
||||||
},
|
},
|
||||||
|
toggleMinicardLabelText() {
|
||||||
|
const user = Meteor.user();
|
||||||
|
user.toggleLabelText(user.hasHiddenMinicardLabelText());
|
||||||
|
},
|
||||||
changeLimitToShowCardsCount(limit) {
|
changeLimitToShowCardsCount(limit) {
|
||||||
check(limit, Number);
|
check(limit, Number);
|
||||||
Meteor.user().setShowCardsCountAt(limit);
|
Meteor.user().setShowCardsCountAt(limit);
|
||||||
|
|
|
||||||
|
|
@ -794,24 +794,32 @@ Migrations.add('add-assignee', () => {
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
Migrations.add('remove-profile-showDesktopDragHandles', () => {
|
Migrations.add('add-profile-showDesktopDragHandles', () => {
|
||||||
Users.update(
|
Users.update(
|
||||||
{},
|
|
||||||
{
|
{
|
||||||
$unset: {
|
'profile.showDesktopDragHandles': {
|
||||||
'profile.showDesktopDragHandles': 1,
|
$exists: false,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
$set: {
|
||||||
|
'profile.showDesktopDragHandles': false,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
noValidateMulti,
|
noValidateMulti,
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
Migrations.add('remove-profile-hiddenMinicardLabelText', () => {
|
Migrations.add('add-profile-hiddenMinicardLabelText', () => {
|
||||||
Users.update(
|
Users.update(
|
||||||
{},
|
|
||||||
{
|
{
|
||||||
$unset: {
|
'profile.hiddenMinicardLabelText': {
|
||||||
'profile.hiddenMinicardLabelText': 1,
|
$exists: false,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
$set: {
|
||||||
|
'profile.hiddenMinicardLabelText': false,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
noValidateMulti,
|
noValidateMulti,
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue