mirror of
https://github.com/wekan/wekan.git
synced 2025-12-16 07:20:12 +01:00
Changed public board changing Swimlanes/Lists/Calendar view
and changing Hide minicard label text from using cookies to using browser localStorage. Thanks to xet7 !
This commit is contained in:
parent
a463f2a855
commit
460b1d3a66
9 changed files with 51 additions and 63 deletions
|
|
@ -1,5 +1,3 @@
|
|||
import { Cookies } from 'meteor/ostrio:cookies';
|
||||
const cookies = new Cookies();
|
||||
const subManager = new SubsManager();
|
||||
const { calculateIndex } = Utils;
|
||||
const swimlaneWhileSortingHeight = 150;
|
||||
|
|
@ -197,7 +195,7 @@ BlazeComponent.extendComponent({
|
|||
if (currentUser) {
|
||||
showDesktopDragHandles = (currentUser.profile || {})
|
||||
.showDesktopDragHandles;
|
||||
} else if (cookies.has('showDesktopDragHandles')) {
|
||||
} else if (window.localStorage.getItem('showDesktopDragHandles')) {
|
||||
showDesktopDragHandles = true;
|
||||
} else {
|
||||
showDesktopDragHandles = false;
|
||||
|
|
@ -237,7 +235,9 @@ BlazeComponent.extendComponent({
|
|||
if (currentUser) {
|
||||
return (currentUser.profile || {}).boardView === 'board-view-swimlanes';
|
||||
} else {
|
||||
return cookies.get('boardView') === 'board-view-swimlanes';
|
||||
return (
|
||||
window.localStorage.getItem('boardView') === 'board-view-swimlanes'
|
||||
);
|
||||
}
|
||||
},
|
||||
|
||||
|
|
@ -246,7 +246,7 @@ BlazeComponent.extendComponent({
|
|||
if (currentUser) {
|
||||
return (currentUser.profile || {}).boardView === 'board-view-lists';
|
||||
} else {
|
||||
return cookies.get('boardView') === 'board-view-lists';
|
||||
return window.localStorage.getItem('boardView') === 'board-view-lists';
|
||||
}
|
||||
},
|
||||
|
||||
|
|
@ -255,7 +255,7 @@ BlazeComponent.extendComponent({
|
|||
if (currentUser) {
|
||||
return (currentUser.profile || {}).boardView === 'board-view-cal';
|
||||
} else {
|
||||
return cookies.get('boardView') === 'board-view-cal';
|
||||
return window.localStorage.getItem('boardView') === 'board-view-cal';
|
||||
}
|
||||
},
|
||||
|
||||
|
|
@ -417,7 +417,7 @@ BlazeComponent.extendComponent({
|
|||
if (currentUser) {
|
||||
return (currentUser.profile || {}).boardView === 'board-view-cal';
|
||||
} else {
|
||||
return cookies.get('boardView') === 'board-view-cal';
|
||||
return window.localStorage.getItem('boardView') === 'board-view-cal';
|
||||
}
|
||||
},
|
||||
}).register('calendarView');
|
||||
|
|
|
|||
|
|
@ -1,5 +1,3 @@
|
|||
import { Cookies } from 'meteor/ostrio:cookies';
|
||||
const cookies = new Cookies();
|
||||
// Template.cards.events({
|
||||
// 'click .member': Popup.open('cardMember')
|
||||
// });
|
||||
|
|
@ -34,10 +32,10 @@ BlazeComponent.extendComponent({
|
|||
},
|
||||
{
|
||||
'click .js-toggle-minicard-label-text'() {
|
||||
if (cookies.has('hiddenMinicardLabelText')) {
|
||||
cookies.remove('hiddenMinicardLabelText'); //true
|
||||
if (window.localStorage.getItem('hiddenMinicardLabelText')) {
|
||||
window.localStorage.removeItem('hiddenMinicardLabelText'); //true
|
||||
} else {
|
||||
cookies.set('hiddenMinicardLabelText', 'true'); //true
|
||||
window.localStorage.setItem('hiddenMinicardLabelText', 'true'); //true
|
||||
}
|
||||
},
|
||||
},
|
||||
|
|
@ -50,7 +48,7 @@ Template.minicard.helpers({
|
|||
currentUser = Meteor.user();
|
||||
if (currentUser) {
|
||||
return (currentUser.profile || {}).showDesktopDragHandles;
|
||||
} else if (cookies.has('showDesktopDragHandles')) {
|
||||
} else if (window.localStorage.getItem('showDesktopDragHandles')) {
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
|
|
@ -60,7 +58,7 @@ Template.minicard.helpers({
|
|||
currentUser = Meteor.user();
|
||||
if (currentUser) {
|
||||
return (currentUser.profile || {}).hiddenMinicardLabelText;
|
||||
} else if (cookies.has('hiddenMinicardLabelText')) {
|
||||
} else if (window.localStorage.getItem('hiddenMinicardLabelText')) {
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
|
|
|
|||
|
|
@ -1,5 +1,3 @@
|
|||
import { Cookies } from 'meteor/ostrio:cookies';
|
||||
const cookies = new Cookies();
|
||||
const { calculateIndex } = Utils;
|
||||
|
||||
BlazeComponent.extendComponent({
|
||||
|
|
@ -124,7 +122,7 @@ BlazeComponent.extendComponent({
|
|||
if (currentUser) {
|
||||
showDesktopDragHandles = (currentUser.profile || {})
|
||||
.showDesktopDragHandles;
|
||||
} else if (cookies.has('showDesktopDragHandles')) {
|
||||
} else if (window.localStorage.getItem('showDesktopDragHandles')) {
|
||||
showDesktopDragHandles = true;
|
||||
} else {
|
||||
showDesktopDragHandles = false;
|
||||
|
|
@ -185,7 +183,7 @@ Template.list.helpers({
|
|||
currentUser = Meteor.user();
|
||||
if (currentUser) {
|
||||
return (currentUser.profile || {}).showDesktopDragHandles;
|
||||
} else if (cookies.has('showDesktopDragHandles')) {
|
||||
} else if (window.localStorage.getItem('showDesktopDragHandles')) {
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
|
|
|
|||
|
|
@ -1,5 +1,3 @@
|
|||
import { Cookies } from 'meteor/ostrio:cookies';
|
||||
const cookies = new Cookies();
|
||||
let listsColors;
|
||||
Meteor.startup(() => {
|
||||
listsColors = Lists.simpleSchema()._schema.color.allowedValues;
|
||||
|
|
@ -110,7 +108,7 @@ Template.listHeader.helpers({
|
|||
currentUser = Meteor.user();
|
||||
if (currentUser) {
|
||||
return (currentUser.profile || {}).showDesktopDragHandles;
|
||||
} else if (cookies.has('showDesktopDragHandles')) {
|
||||
} else if (window.localStorage.getItem('showDesktopDragHandles')) {
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
|
|
|
|||
|
|
@ -1,5 +1,3 @@
|
|||
import { Cookies } from 'meteor/ostrio:cookies';
|
||||
const cookies = new Cookies();
|
||||
Sidebar = null;
|
||||
|
||||
const defaultView = 'home';
|
||||
|
|
@ -112,10 +110,12 @@ BlazeComponent.extendComponent({
|
|||
currentUser = Meteor.user();
|
||||
if (currentUser) {
|
||||
Meteor.call('toggleMinicardLabelText');
|
||||
} else if (cookies.has('hiddenMinicardLabelText')) {
|
||||
cookies.remove('hiddenMinicardLabelText');
|
||||
} else if (window.localStorage.getItem('hiddenMinicardLabelText')) {
|
||||
window.localStorage.removeItem('hiddenMinicardLabelText');
|
||||
location.reload();
|
||||
} else {
|
||||
cookies.set('hiddenMinicardLabelText', 'true');
|
||||
window.localStorage.setItem('hiddenMinicardLabelText', 'true');
|
||||
location.reload();
|
||||
}
|
||||
},
|
||||
'click .js-shortcuts'() {
|
||||
|
|
@ -133,7 +133,7 @@ Template.homeSidebar.helpers({
|
|||
currentUser = Meteor.user();
|
||||
if (currentUser) {
|
||||
return (currentUser.profile || {}).hiddenMinicardLabelText;
|
||||
} else if (cookies.has('hiddenMinicardLabelText')) {
|
||||
} else if (window.localStorage.getItem('hiddenMinicardLabelText')) {
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
|
|
|
|||
|
|
@ -1,5 +1,3 @@
|
|||
import { Cookies } from 'meteor/ostrio:cookies';
|
||||
const cookies = new Cookies();
|
||||
const { calculateIndexData } = Utils;
|
||||
|
||||
let swimlaneColors;
|
||||
|
|
@ -35,7 +33,7 @@ Template.swimlaneHeader.helpers({
|
|||
currentUser = Meteor.user();
|
||||
if (currentUser) {
|
||||
return (currentUser.profile || {}).showDesktopDragHandles;
|
||||
} else if (cookies.has('showDesktopDragHandles')) {
|
||||
} else if (window.localStorage.getItem('showDesktopDragHandles')) {
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
|
|
|
|||
|
|
@ -1,5 +1,3 @@
|
|||
import { Cookies } from 'meteor/ostrio:cookies';
|
||||
const cookies = new Cookies();
|
||||
const { calculateIndex } = Utils;
|
||||
|
||||
function currentListIsInThisSwimlane(swimlaneId) {
|
||||
|
|
@ -102,7 +100,7 @@ function initSortable(boardComponent, $listsDom) {
|
|||
if (currentUser) {
|
||||
showDesktopDragHandles = (currentUser.profile || {})
|
||||
.showDesktopDragHandles;
|
||||
} else if (cookies.has('showDesktopDragHandles')) {
|
||||
} else if (window.localStorage.getItem('showDesktopDragHandles')) {
|
||||
showDesktopDragHandles = true;
|
||||
} else {
|
||||
showDesktopDragHandles = false;
|
||||
|
|
@ -178,7 +176,7 @@ BlazeComponent.extendComponent({
|
|||
if (currentUser) {
|
||||
showDesktopDragHandles = (currentUser.profile || {})
|
||||
.showDesktopDragHandles;
|
||||
} else if (cookies.has('showDesktopDragHandles')) {
|
||||
} else if (window.localStorage.getItem('showDesktopDragHandles')) {
|
||||
showDesktopDragHandles = true;
|
||||
} else {
|
||||
showDesktopDragHandles = false;
|
||||
|
|
@ -269,7 +267,7 @@ Template.swimlane.helpers({
|
|||
currentUser = Meteor.user();
|
||||
if (currentUser) {
|
||||
return (currentUser.profile || {}).showDesktopDragHandles;
|
||||
} else if (cookies.has('showDesktopDragHandles')) {
|
||||
} else if (window.localStorage.getItem('showDesktopDragHandles')) {
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
|
|
|
|||
|
|
@ -1,6 +1,3 @@
|
|||
import { Cookies } from 'meteor/ostrio:cookies';
|
||||
const cookies = new Cookies();
|
||||
|
||||
Template.headerUserBar.events({
|
||||
'click .js-open-header-member-menu': Popup.open('memberMenu'),
|
||||
'click .js-change-avatar': Popup.open('changeAvatar'),
|
||||
|
|
@ -200,7 +197,7 @@ Template.changeSettingsPopup.helpers({
|
|||
currentUser = Meteor.user();
|
||||
if (currentUser) {
|
||||
return (currentUser.profile || {}).showDesktopDragHandles;
|
||||
} else if (cookies.has('showDesktopDragHandles')) {
|
||||
} else if (window.localStorage.getItem('showDesktopDragHandles')) {
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
|
|
@ -210,7 +207,7 @@ Template.changeSettingsPopup.helpers({
|
|||
currentUser = Meteor.user();
|
||||
if (currentUser) {
|
||||
return (currentUser.profile || {}).hasHiddenSystemMessages;
|
||||
} else if (cookies.has('hasHiddenSystemMessages')) {
|
||||
} else if (window.localStorage.getItem('hasHiddenSystemMessages')) {
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
|
|
@ -221,7 +218,7 @@ Template.changeSettingsPopup.helpers({
|
|||
if (currentUser) {
|
||||
return Meteor.user().getLimitToShowCardsCount();
|
||||
} else {
|
||||
return cookies.get('limitToShowCardsCount');
|
||||
return window.localStorage.getItem('limitToShowCardsCount');
|
||||
}
|
||||
},
|
||||
weekDays(startDay) {
|
||||
|
|
@ -242,7 +239,7 @@ Template.changeSettingsPopup.helpers({
|
|||
if (currentUser) {
|
||||
return currentUser.getStartDayOfWeek();
|
||||
} else {
|
||||
return cookies.get('startDayOfWeek');
|
||||
return window.localStorage.getItem('startDayOfWeek');
|
||||
}
|
||||
},
|
||||
});
|
||||
|
|
@ -252,20 +249,20 @@ Template.changeSettingsPopup.events({
|
|||
currentUser = Meteor.user();
|
||||
if (currentUser) {
|
||||
Meteor.call('toggleDesktopDragHandles');
|
||||
} else if (cookies.has('showDesktopDragHandles')) {
|
||||
cookies.remove('showDesktopDragHandles');
|
||||
} else if (window.localStorage.getItem('showDesktopDragHandles')) {
|
||||
window.localStorage.removeItem('showDesktopDragHandles');
|
||||
} else {
|
||||
cookies.set('showDesktopDragHandles', 'true');
|
||||
window.localStorage.setItem('showDesktopDragHandles', 'true');
|
||||
}
|
||||
},
|
||||
'click .js-toggle-system-messages'() {
|
||||
currentUser = Meteor.user();
|
||||
if (currentUser) {
|
||||
Meteor.call('toggleSystemMessages');
|
||||
} else if (cookies.has('hasHiddenSystemMessages')) {
|
||||
cookies.remove('hasHiddenSystemMessages');
|
||||
} else if (window.localStorage.getItem('hasHiddenSystemMessages')) {
|
||||
window.localStorage.removeItem('hasHiddenSystemMessages');
|
||||
} else {
|
||||
cookies.set('hasHiddenSystemMessages', 'true');
|
||||
window.localStorage.setItem('hasHiddenSystemMessages', 'true');
|
||||
}
|
||||
},
|
||||
'click .js-apply-user-settings'(event, templateInstance) {
|
||||
|
|
@ -283,14 +280,14 @@ Template.changeSettingsPopup.events({
|
|||
if (currentUser) {
|
||||
Meteor.call('changeLimitToShowCardsCount', minLimit);
|
||||
} else {
|
||||
cookies.set('limitToShowCardsCount', minLimit);
|
||||
window.localStorage.setItem('limitToShowCardsCount', minLimit);
|
||||
}
|
||||
}
|
||||
if (!isNaN(startDay)) {
|
||||
if (currentUser) {
|
||||
Meteor.call('changeStartDayOfWeek', startDay);
|
||||
} else {
|
||||
cookies.set('startDayOfWeek', startDay);
|
||||
window.localStorage.setItem('startDayOfWeek', startDay);
|
||||
}
|
||||
}
|
||||
Popup.back();
|
||||
|
|
|
|||
|
|
@ -1,43 +1,44 @@
|
|||
import { Cookies } from 'meteor/ostrio:cookies';
|
||||
const cookies = new Cookies();
|
||||
|
||||
Utils = {
|
||||
setBoardView(view) {
|
||||
currentUser = Meteor.user();
|
||||
if (currentUser) {
|
||||
Meteor.user().setBoardView(view);
|
||||
} else if (view === 'board-view-swimlanes') {
|
||||
cookies.set('boardView', 'board-view-swimlanes'); //true
|
||||
window.localStorage.setItem('boardView', 'board-view-swimlanes'); //true
|
||||
location.reload();
|
||||
} else if (view === 'board-view-lists') {
|
||||
cookies.set('boardView', 'board-view-lists'); //true
|
||||
window.localStorage.setItem('boardView', 'board-view-lists'); //true
|
||||
location.reload();
|
||||
} else if (view === 'board-view-cal') {
|
||||
cookies.set('boardView', 'board-view-cal'); //true
|
||||
window.localStorage.setItem('boardView', 'board-view-cal'); //true
|
||||
location.reload();
|
||||
} else {
|
||||
cookies.set('boardView', 'board-view-swimlanes'); //true
|
||||
window.localStorage.setItem('boardView', 'board-view-swimlanes'); //true
|
||||
location.reload();
|
||||
}
|
||||
},
|
||||
|
||||
unsetBoardView() {
|
||||
cookies.remove('boardView');
|
||||
cookies.remove('collapseSwimlane');
|
||||
window.localStorage.removeItem('boardView');
|
||||
window.localStorage.removeItem('collapseSwimlane');
|
||||
},
|
||||
|
||||
boardView() {
|
||||
currentUser = Meteor.user();
|
||||
if (currentUser) {
|
||||
return (currentUser.profile || {}).boardView;
|
||||
} else if (cookies.get('boardView') === 'board-view-swimlanes') {
|
||||
} else if (
|
||||
window.localStorage.getItem('boardView') === 'board-view-swimlanes'
|
||||
) {
|
||||
return 'board-view-swimlanes';
|
||||
} else if (cookies.get('boardView') === 'board-view-lists') {
|
||||
} else if (
|
||||
window.localStorage.getItem('boardView') === 'board-view-lists'
|
||||
) {
|
||||
return 'board-view-lists';
|
||||
} else if (cookies.get('boardView') === 'board-view-cal') {
|
||||
} else if (window.localStorage.getItem('boardView') === 'board-view-cal') {
|
||||
return 'board-view-cal';
|
||||
} else {
|
||||
cookies.set('boardView', 'board-view-swimlanes'); //true
|
||||
window.localStorage.setItem('boardView', 'board-view-swimlanes'); //true
|
||||
location.reload();
|
||||
return 'board-view-swimlanes';
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue