mirror of
https://github.com/wekan/wekan.git
synced 2025-04-22 21:17:18 -04:00
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 !
This commit is contained in:
parent
2079a5bfa3
commit
96abe3c691
19 changed files with 459 additions and 175 deletions
|
@ -96,3 +96,4 @@ konecty:mongo-counter
|
|||
percolate:synced-cron
|
||||
easylogic:summernote
|
||||
cfs:filesystem
|
||||
ostrio:cookies
|
||||
|
|
|
@ -133,6 +133,7 @@ oauth2@1.2.1
|
|||
observe-sequence@1.0.16
|
||||
ongoworks:speakingurl@1.1.0
|
||||
ordered-dict@1.1.0
|
||||
ostrio:cookies@2.5.0
|
||||
peerlibrary:assert@0.2.5
|
||||
peerlibrary:base-component@0.16.0
|
||||
peerlibrary:blaze-components@0.15.1
|
||||
|
|
|
@ -192,10 +192,13 @@ BlazeComponent.extendComponent({
|
|||
// ugly touch event hotfix
|
||||
enableClickOnTouch('.js-swimlane:not(.placeholder)');
|
||||
|
||||
import { Cookies } from 'meteor/ostrio:cookies';
|
||||
const cookies = new Cookies();
|
||||
|
||||
this.autorun(() => {
|
||||
if (
|
||||
Utils.isMiniScreen() ||
|
||||
(!Utils.isMiniScreen() && Meteor.user().hasShowDesktopDragHandles())
|
||||
(!Utils.isMiniScreen() && cookies.has('showDesktopDragHandles'))
|
||||
) {
|
||||
$swimlanesDom.sortable({
|
||||
handle: '.js-swimlane-header-handle',
|
||||
|
@ -227,20 +230,32 @@ BlazeComponent.extendComponent({
|
|||
},
|
||||
|
||||
isViewSwimlanes() {
|
||||
import { Cookies } from 'meteor/ostrio:cookies';
|
||||
const cookies = new Cookies();
|
||||
const currentUser = Meteor.user();
|
||||
if (!currentUser) return false;
|
||||
if (!currentUser) {
|
||||
return cookies.get('boardView') === 'board-view-swimlanes';
|
||||
}
|
||||
return (currentUser.profile || {}).boardView === 'board-view-swimlanes';
|
||||
},
|
||||
|
||||
isViewLists() {
|
||||
import { Cookies } from 'meteor/ostrio:cookies';
|
||||
const cookies = new Cookies();
|
||||
const currentUser = Meteor.user();
|
||||
if (!currentUser) return true;
|
||||
if (!currentUser) {
|
||||
return cookies.get('boardView') === 'board-view-lists';
|
||||
}
|
||||
return (currentUser.profile || {}).boardView === 'board-view-lists';
|
||||
},
|
||||
|
||||
isViewCalendar() {
|
||||
import { Cookies } from 'meteor/ostrio:cookies';
|
||||
const cookies = new Cookies();
|
||||
const currentUser = Meteor.user();
|
||||
if (!currentUser) return false;
|
||||
if (!currentUser) {
|
||||
return cookies.get('boardView') === 'board-view-cal';
|
||||
}
|
||||
return (currentUser.profile || {}).boardView === 'board-view-cal';
|
||||
},
|
||||
|
||||
|
@ -398,8 +413,12 @@ BlazeComponent.extendComponent({
|
|||
};
|
||||
},
|
||||
isViewCalendar() {
|
||||
import { Cookies } from 'meteor/ostrio:cookies';
|
||||
const cookies = new Cookies();
|
||||
const currentUser = Meteor.user();
|
||||
if (!currentUser) return false;
|
||||
if (!currentUser) {
|
||||
return cookies.get('boardView') === 'board-view-cal';
|
||||
}
|
||||
return (currentUser.profile || {}).boardView === 'board-view-cal';
|
||||
},
|
||||
}).register('calendarView');
|
||||
|
|
|
@ -77,10 +77,11 @@ template(name="boardHeaderBar")
|
|||
i.fa.fa-archive
|
||||
span {{_ 'archives'}}
|
||||
|
||||
if showSort
|
||||
a.board-header-btn.js-open-sort-view(title="{{_ 'sort-desc'}}")
|
||||
i.fa(class="{{directionClass}}")
|
||||
span {{_ 'sort'}}{{_ listSortShortDesc}}
|
||||
//if showSort
|
||||
// a.board-header-btn.js-open-sort-view(title="{{_ 'sort-desc'}}")
|
||||
// i.fa(class="{{directionClass}}")
|
||||
// span {{_ 'sort'}}{{_ listSortShortDesc}}
|
||||
|
||||
a.board-header-btn.js-open-filter-view(
|
||||
title="{{#if Filter.isActive}}{{_ 'filter-on-desc'}}{{else}}{{_ 'filter'}}{{/if}}"
|
||||
class="{{#if Filter.isActive}}emphasis{{/if}}")
|
||||
|
@ -89,15 +90,6 @@ template(name="boardHeaderBar")
|
|||
if Filter.isActive
|
||||
a.board-header-btn-close.js-filter-reset(title="{{_ 'filter-clear'}}")
|
||||
i.fa.fa-times-thin
|
||||
|
||||
if currentUser.isAdmin
|
||||
a.board-header-btn.js-open-rules-view(title="{{_ 'rules'}}")
|
||||
i.fa.fa-magic
|
||||
span {{_ 'rules'}}
|
||||
else if currentUser.isBoardAdmin
|
||||
a.board-header-btn.js-open-rules-view(title="{{_ 'rules'}}")
|
||||
i.fa.fa-magic
|
||||
span {{_ 'rules'}}
|
||||
|
||||
a.board-header-btn.js-open-search-view(title="{{_ 'search'}}")
|
||||
i.fa.fa-search
|
||||
|
@ -106,8 +98,19 @@ template(name="boardHeaderBar")
|
|||
unless currentBoard.isTemplatesBoard
|
||||
a.board-header-btn.js-toggle-board-view(
|
||||
title="{{_ 'board-view'}}")
|
||||
i.fa.fa-th-large
|
||||
span {{#if currentUser.profile.boardView}}{{_ currentUser.profile.boardView}}{{else}}{{_ 'board-view-lists'}}{{/if}}
|
||||
i.fa.fa-caret-down
|
||||
if $eq boardView 'board-view-lists'
|
||||
i.fa.fa-trello
|
||||
if $eq boardView 'board-view-swimlanes'
|
||||
i.fa.fa-th-large
|
||||
// unless collapseSwimlane
|
||||
// i.fa.fa-th-large
|
||||
// if collapseSwimlane
|
||||
// i.fa.fa-play
|
||||
if $eq boardView 'board-view-cal'
|
||||
i.fa.fa-calendar
|
||||
span {{#if boardView}}{{_ boardView}}{{else}}{{_ 'board-view-lists'}}{{/if}}
|
||||
//span {{#if collapseSwimlane}}{{_ 'board-view-collapse'}}{{else}}{{#if boardView}}{{_ boardView}}{{else}}{{_ 'board-view-lists'}}{{/if}}{{/if}}
|
||||
|
||||
if canModifyBoard
|
||||
a.board-header-btn.js-multiselection-activate(
|
||||
|
@ -172,6 +175,51 @@ template(name="boardChangeWatchPopup")
|
|||
i.fa.fa-check
|
||||
span.sub-name {{_ 'muted-info'}}
|
||||
|
||||
template(name="boardChangeViewPopup")
|
||||
ul.pop-over-list
|
||||
li
|
||||
with "board-view-lists"
|
||||
a.js-open-lists-view
|
||||
i.fa.fa-trello.colorful
|
||||
| {{_ 'board-view-lists'}}
|
||||
if $eq Utils.boardView "board-view-lists"
|
||||
i.fa.fa-check
|
||||
li
|
||||
with "board-view-swimlanes"
|
||||
a.js-open-swimlanes-view
|
||||
i.fa.fa-th-large.colorful
|
||||
| {{_ 'board-view-swimlanes'}}
|
||||
if $eq Utils.boardView "board-view-swimlanes"
|
||||
i.fa.fa-check
|
||||
//li
|
||||
// with "board-view-collapse"
|
||||
// a.js-open-collapse-view
|
||||
// i.fa.fa-play.colorful
|
||||
// | {{_ 'board-view-collapse'}}
|
||||
// if $eq Utils.boardView "board-view-collapse"
|
||||
// i.fa.fa-check
|
||||
li
|
||||
with "board-view-cal"
|
||||
a.js-open-cal-view
|
||||
i.fa.fa-calendar.colorful
|
||||
| {{_ 'board-view-cal'}}
|
||||
if $eq Utils.boardView "board-view-cal"
|
||||
i.fa.fa-check
|
||||
if currentUser.isAdmin
|
||||
hr
|
||||
li
|
||||
with "board-view-rules"
|
||||
a.js-open-rules-view(title="{{_ 'rules'}}")
|
||||
i.fa.fa-magic
|
||||
| {{_ 'rules'}}
|
||||
else if currentUser.isBoardAdmin
|
||||
hr
|
||||
li
|
||||
with "board-view-rules"
|
||||
a.js-open-rules-view(title="{{_ 'rules'}}")
|
||||
i.fa.fa-magic
|
||||
| {{_ 'rules'}}
|
||||
|
||||
template(name="createBoard")
|
||||
form
|
||||
label
|
||||
|
@ -198,19 +246,19 @@ template(name="createBoard")
|
|||
| /
|
||||
a.js-board-template {{_ 'template'}}
|
||||
|
||||
template(name="listsortPopup")
|
||||
h2
|
||||
| {{_ 'list-sort-by'}}
|
||||
hr
|
||||
ul.pop-over-list
|
||||
each value in allowedSortValues
|
||||
li
|
||||
a.js-sort-by(name="{{value.name}}")
|
||||
if $eq sortby value.name
|
||||
i(class="fa {{Direction}}")
|
||||
| {{_ value.label }}{{_ value.shortLabel}}
|
||||
if $eq sortby value.name
|
||||
i(class="fa fa-check")
|
||||
//template(name="listsortPopup")
|
||||
// h2
|
||||
// | {{_ 'list-sort-by'}}
|
||||
// hr
|
||||
// ul.pop-over-list
|
||||
// each value in allowedSortValues
|
||||
// li
|
||||
// a.js-sort-by(name="{{value.name}}")
|
||||
// if $eq sortby value.name
|
||||
// i(class="fa {{Direction}}")
|
||||
// | {{_ value.label }}{{_ value.shortLabel}}
|
||||
// if $eq sortby value.name
|
||||
// i(class="fa fa-check")
|
||||
|
||||
template(name="boardChangeTitlePopup")
|
||||
form
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
/*
|
||||
const DOWNCLS = 'fa-sort-down';
|
||||
const UPCLS = 'fa-sort-up';
|
||||
*/
|
||||
Template.boardMenuPopup.events({
|
||||
'click .js-rename-board': Popup.open('boardChangeTitle'),
|
||||
'click .js-custom-fields'() {
|
||||
|
@ -82,6 +84,7 @@ BlazeComponent.extendComponent({
|
|||
const currentBoard = Boards.findOne(Session.get('currentBoard'));
|
||||
return currentBoard && currentBoard.stars >= 2;
|
||||
},
|
||||
/*
|
||||
showSort() {
|
||||
return Meteor.user().hasSortBy();
|
||||
},
|
||||
|
@ -101,6 +104,7 @@ BlazeComponent.extendComponent({
|
|||
listSortShortDesc() {
|
||||
return `list-label-short-${this.currentListSortBy()}`;
|
||||
},
|
||||
*/
|
||||
events() {
|
||||
return [
|
||||
{
|
||||
|
@ -114,30 +118,14 @@ BlazeComponent.extendComponent({
|
|||
'click .js-open-archived-board'() {
|
||||
Modal.open('archivedBoards');
|
||||
},
|
||||
'click .js-toggle-board-view'() {
|
||||
const currentUser = Meteor.user();
|
||||
if (
|
||||
(currentUser.profile || {}).boardView === 'board-view-swimlanes'
|
||||
) {
|
||||
currentUser.setBoardView('board-view-cal');
|
||||
} else if (
|
||||
(currentUser.profile || {}).boardView === 'board-view-lists'
|
||||
) {
|
||||
currentUser.setBoardView('board-view-swimlanes');
|
||||
} else if (
|
||||
(currentUser.profile || {}).boardView === 'board-view-cal'
|
||||
) {
|
||||
currentUser.setBoardView('board-view-lists');
|
||||
} else {
|
||||
currentUser.setBoardView('board-view-swimlanes');
|
||||
}
|
||||
},
|
||||
'click .js-toggle-board-view': Popup.open('boardChangeView'),
|
||||
'click .js-toggle-sidebar'() {
|
||||
Sidebar.toggle();
|
||||
},
|
||||
'click .js-open-filter-view'() {
|
||||
Sidebar.setView('filter');
|
||||
},
|
||||
/*
|
||||
'click .js-open-sort-view'(evt) {
|
||||
const target = evt.target;
|
||||
if (target.tagName === 'I') {
|
||||
|
@ -148,6 +136,7 @@ BlazeComponent.extendComponent({
|
|||
Popup.open('listsort')(evt);
|
||||
}
|
||||
},
|
||||
*/
|
||||
'click .js-filter-reset'(event) {
|
||||
event.stopPropagation();
|
||||
Sidebar.setView();
|
||||
|
@ -156,9 +145,6 @@ BlazeComponent.extendComponent({
|
|||
'click .js-open-search-view'() {
|
||||
Sidebar.setView('search');
|
||||
},
|
||||
'click .js-open-rules-view'() {
|
||||
Modal.openWide('rulesMain');
|
||||
},
|
||||
'click .js-multiselection-activate'() {
|
||||
const currentCard = Session.get('currentCard');
|
||||
MultiSelection.activate();
|
||||
|
@ -186,6 +172,85 @@ Template.boardHeaderBar.helpers({
|
|||
!Meteor.user().isCommentOnly()
|
||||
);
|
||||
},
|
||||
boardView() {
|
||||
import { Cookies } from 'meteor/ostrio:cookies';
|
||||
const cookies = new Cookies();
|
||||
if (cookies.get('boardView') === 'board-view-lists') {
|
||||
return 'board-view-lists';
|
||||
} else if (cookies.get('boardView') === 'board-view-swimlanes') {
|
||||
return 'board-view-swimlanes';
|
||||
} else if (cookies.get('boardView') === 'board-view-collapse') {
|
||||
return 'board-view-collapse';
|
||||
} else if (cookies.get('boardView') === 'board-view-cal') {
|
||||
return 'board-view-cal';
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
},
|
||||
collapseSwimlane() {
|
||||
import { Cookies } from 'meteor/ostrio:cookies';
|
||||
const cookies = new Cookies();
|
||||
if (cookies.has('collapseSwimlane')) {
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
},
|
||||
});
|
||||
|
||||
Template.boardChangeViewPopup.events({
|
||||
'click .js-open-lists-view'() {
|
||||
import { Cookies } from 'meteor/ostrio:cookies';
|
||||
const cookies = new Cookies();
|
||||
if (cookies.get('boardView') !== 'board-view-lists') {
|
||||
cookies.set('boardView', 'board-view-lists');
|
||||
const currentUser = Meteor.user();
|
||||
if (currentUser) {
|
||||
Meteor.user().setBoardView('board-view-lists');
|
||||
}
|
||||
}
|
||||
Popup.close();
|
||||
},
|
||||
'click .js-open-swimlanes-view'() {
|
||||
import { Cookies } from 'meteor/ostrio:cookies';
|
||||
const cookies = new Cookies();
|
||||
if (cookies.get('boardView') !== 'board-view-swimlanes') {
|
||||
cookies.set('boardView', 'board-view-swimlanes');
|
||||
cookies.remove('collapseSwimlane');
|
||||
const currentUser = Meteor.user();
|
||||
if (currentUser) {
|
||||
Meteor.user().setBoardView('board-view-swimlanes');
|
||||
}
|
||||
}
|
||||
Popup.close();
|
||||
},
|
||||
'click .js-open-collapse-view'() {
|
||||
import { Cookies } from 'meteor/ostrio:cookies';
|
||||
const cookies = new Cookies();
|
||||
if (cookies.get('boardView') !== 'board-view-swimlanes') {
|
||||
cookies.set('boardView', 'board-view-swimlanes');
|
||||
cookies.set('collapseSwimlane', 'true');
|
||||
const currentUser = Meteor.user();
|
||||
if (currentUser) {
|
||||
Meteor.user().setBoardView('board-view-swimlanes');
|
||||
}
|
||||
}
|
||||
Popup.close();
|
||||
},
|
||||
'click .js-open-cal-view'() {
|
||||
import { Cookies } from 'meteor/ostrio:cookies';
|
||||
const cookies = new Cookies();
|
||||
cookies.set('boardView', 'board-view-cal');
|
||||
const currentUser = Meteor.user();
|
||||
if (currentUser) {
|
||||
Meteor.user().setBoardView('board-view-cal');
|
||||
}
|
||||
Popup.close();
|
||||
},
|
||||
'click .js-open-rules-view'() {
|
||||
Modal.openWide('rulesMain');
|
||||
Popup.close();
|
||||
},
|
||||
});
|
||||
|
||||
const CreateBoard = BlazeComponent.extendComponent({
|
||||
|
@ -308,6 +373,7 @@ BlazeComponent.extendComponent({
|
|||
},
|
||||
}).register('boardChangeWatchPopup');
|
||||
|
||||
/*
|
||||
BlazeComponent.extendComponent({
|
||||
onCreated() {
|
||||
//this.sortBy = new ReactiveVar();
|
||||
|
@ -377,3 +443,4 @@ BlazeComponent.extendComponent({
|
|||
];
|
||||
},
|
||||
}).register('listsortPopup');
|
||||
*/
|
||||
|
|
|
@ -18,7 +18,13 @@ BlazeComponent.extendComponent({
|
|||
},
|
||||
{
|
||||
'click .js-toggle-minicard-label-text'() {
|
||||
Meteor.call('toggleMinicardLabelText');
|
||||
import { Cookies } from 'meteor/ostrio:cookies';
|
||||
const cookies = new Cookies();
|
||||
if (cookies.has('hiddenMinicardLabelText')) {
|
||||
cookies.remove('hiddenMinicardLabelText'); //true
|
||||
} else {
|
||||
cookies.set('hiddenMinicardLabelText', 'true'); //true
|
||||
}
|
||||
},
|
||||
},
|
||||
];
|
||||
|
@ -27,9 +33,21 @@ BlazeComponent.extendComponent({
|
|||
|
||||
Template.minicard.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;
|
||||
}
|
||||
},
|
||||
hiddenMinicardLabelText() {
|
||||
return Meteor.user().hasHiddenMinicardLabelText();
|
||||
import { Cookies } from 'meteor/ostrio:cookies';
|
||||
const cookies = new Cookies();
|
||||
if (cookies.has('hiddenMinicardLabelText')) {
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
},
|
||||
});
|
||||
|
|
|
@ -73,16 +73,15 @@ BlazeComponent.extendComponent({
|
|||
const listId = Blaze.getData(ui.item.parents('.list').get(0))._id;
|
||||
const currentBoard = Boards.findOne(Session.get('currentBoard'));
|
||||
let swimlaneId = '';
|
||||
const boardView = (Meteor.user().profile || {}).boardView;
|
||||
if (
|
||||
boardView === 'board-view-swimlanes' ||
|
||||
Utils.boardView() === 'board-view-swimlanes' ||
|
||||
currentBoard.isTemplatesBoard()
|
||||
)
|
||||
swimlaneId = Blaze.getData(ui.item.parents('.swimlane').get(0))._id;
|
||||
else if (
|
||||
boardView === 'board-view-lists' ||
|
||||
boardView === 'board-view-cal' ||
|
||||
!boardView
|
||||
Utils.boardView() === 'board-view-lists' ||
|
||||
Utils.boardView() === 'board-view-cal' ||
|
||||
!Utils.boardView
|
||||
)
|
||||
swimlaneId = currentBoard.getDefaultSwimline()._id;
|
||||
|
||||
|
@ -116,11 +115,11 @@ BlazeComponent.extendComponent({
|
|||
// ugly touch event hotfix
|
||||
enableClickOnTouch(itemsSelector);
|
||||
|
||||
import { Cookies } from 'meteor/ostrio:cookies';
|
||||
const cookies = new Cookies();
|
||||
|
||||
this.autorun(() => {
|
||||
if (
|
||||
Utils.isMiniScreen() ||
|
||||
(!Utils.isMiniScreen() && Meteor.user().hasShowDesktopDragHandles())
|
||||
) {
|
||||
if (!Utils.isMiniScreen() && cookies.has('showDesktopDragHandles')) {
|
||||
$cards.sortable({
|
||||
handle: '.handle',
|
||||
});
|
||||
|
@ -164,7 +163,13 @@ BlazeComponent.extendComponent({
|
|||
|
||||
Template.list.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;
|
||||
}
|
||||
},
|
||||
});
|
||||
|
||||
|
|
|
@ -48,7 +48,6 @@ BlazeComponent.extendComponent({
|
|||
const board = this.data().board();
|
||||
let linkedId = '';
|
||||
let swimlaneId = '';
|
||||
const boardView = (Meteor.user().profile || {}).boardView;
|
||||
let cardType = 'cardType-card';
|
||||
if (title) {
|
||||
if (board.isTemplatesBoard()) {
|
||||
|
@ -71,14 +70,14 @@ BlazeComponent.extendComponent({
|
|||
});
|
||||
cardType = 'cardType-linkedBoard';
|
||||
}
|
||||
} else if (boardView === 'board-view-swimlanes')
|
||||
} else if (Utils.boardView() === 'board-view-swimlanes')
|
||||
swimlaneId = this.parentComponent()
|
||||
.parentComponent()
|
||||
.data()._id;
|
||||
else if (
|
||||
boardView === 'board-view-lists' ||
|
||||
boardView === 'board-view-cal' ||
|
||||
!boardView
|
||||
Utils.boardView() === 'board-view-lists' ||
|
||||
Utils.boardView() === 'board-view-cal' ||
|
||||
!Utils.boardView
|
||||
)
|
||||
swimlaneId = board.getDefaultSwimline()._id;
|
||||
|
||||
|
@ -157,9 +156,8 @@ BlazeComponent.extendComponent({
|
|||
},
|
||||
|
||||
idOrNull(swimlaneId) {
|
||||
const currentUser = Meteor.user();
|
||||
if (
|
||||
(currentUser.profile || {}).boardView === 'board-view-swimlanes' ||
|
||||
Utils.boardView() === 'board-view-swimlanes' ||
|
||||
this.data()
|
||||
.board()
|
||||
.isTemplatesBoard()
|
||||
|
@ -397,10 +395,9 @@ BlazeComponent.extendComponent({
|
|||
'.js-swimlane',
|
||||
);
|
||||
this.swimlaneId = '';
|
||||
const boardView = (Meteor.user().profile || {}).boardView;
|
||||
if (boardView === 'board-view-swimlanes')
|
||||
if (Utils.boardView() === 'board-view-swimlanes')
|
||||
this.swimlaneId = Blaze.getData(swimlane[0])._id;
|
||||
else if (boardView === 'board-view-lists' || !boardView)
|
||||
else if (Utils.boardView() === 'board-view-lists' || !Utils.boardView)
|
||||
this.swimlaneId = Swimlanes.findOne({ boardId: this.boardId })._id;
|
||||
},
|
||||
|
||||
|
@ -580,7 +577,7 @@ BlazeComponent.extendComponent({
|
|||
const swimlane = $(Popup._getTopStack().openerElement).parents(
|
||||
'.js-swimlane',
|
||||
);
|
||||
if ((Meteor.user().profile || {}).boardView === 'board-view-swimlanes')
|
||||
if (Utils.boardView() === 'board-view-swimlanes')
|
||||
this.swimlaneId = Blaze.getData(swimlane[0])._id;
|
||||
else this.swimlaneId = Swimlanes.findOne({ boardId: this.boardId })._id;
|
||||
// List where to insert card
|
||||
|
@ -709,8 +706,7 @@ BlazeComponent.extendComponent({
|
|||
if (isSandstorm) {
|
||||
const user = Meteor.user();
|
||||
if (user) {
|
||||
const boardView = (Meteor.user().profile || {}).boardView;
|
||||
if (boardView === 'board-view-swimlanes') {
|
||||
if (Utils.boardView() === 'board-view-swimlanes') {
|
||||
this.swimlaneId = this.parentComponent()
|
||||
.parentComponent()
|
||||
.parentComponent()
|
||||
|
@ -718,8 +714,7 @@ BlazeComponent.extendComponent({
|
|||
}
|
||||
}
|
||||
} else {
|
||||
const boardView = (Meteor.user().profile || {}).boardView;
|
||||
if (boardView === 'board-view-swimlanes') {
|
||||
if (Utils.boardView() === 'board-view-swimlanes') {
|
||||
this.swimlaneId = this.parentComponent()
|
||||
.parentComponent()
|
||||
.parentComponent()
|
||||
|
|
|
@ -44,14 +44,16 @@ BlazeComponent.extendComponent({
|
|||
},
|
||||
|
||||
limitToShowCardsCount() {
|
||||
return Meteor.user().getLimitToShowCardsCount();
|
||||
const currentUser = Meteor.user();
|
||||
if (currentUser) {
|
||||
return Meteor.user().getLimitToShowCardsCount();
|
||||
}
|
||||
},
|
||||
|
||||
cardsCount() {
|
||||
const list = Template.currentData();
|
||||
let swimlaneId = '';
|
||||
const boardView = (Meteor.user().profile || {}).boardView;
|
||||
if (boardView === 'board-view-swimlanes')
|
||||
if (Utils.boardView() === 'board-view-swimlanes')
|
||||
swimlaneId = this.parentComponent()
|
||||
.parentComponent()
|
||||
.data()._id;
|
||||
|
@ -100,7 +102,13 @@ BlazeComponent.extendComponent({
|
|||
|
||||
Template.listHeader.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;
|
||||
}
|
||||
},
|
||||
});
|
||||
|
||||
|
|
|
@ -107,7 +107,13 @@ BlazeComponent.extendComponent({
|
|||
'click .js-toggle-sidebar': this.toggle,
|
||||
'click .js-back-home': this.setView,
|
||||
'click .js-toggle-minicard-label-text'() {
|
||||
Meteor.call('toggleMinicardLabelText');
|
||||
import { Cookies } from 'meteor/ostrio:cookies';
|
||||
const cookies = new Cookies();
|
||||
if (cookies.has('hiddenMinicardLabelText')) {
|
||||
cookies.remove('hiddenMinicardLabelText'); //true
|
||||
} else {
|
||||
cookies.set('hiddenMinicardLabelText', 'true'); //true
|
||||
}
|
||||
},
|
||||
'click .js-shortcuts'() {
|
||||
FlowRouter.go('shortcuts');
|
||||
|
@ -121,7 +127,13 @@ Blaze.registerHelper('Sidebar', () => Sidebar);
|
|||
|
||||
Template.homeSidebar.helpers({
|
||||
hiddenMinicardLabelText() {
|
||||
return Meteor.user().hasHiddenMinicardLabelText();
|
||||
import { Cookies } from 'meteor/ostrio:cookies';
|
||||
const cookies = new Cookies();
|
||||
if (cookies.has('hiddenMinicardLabelText')) {
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
},
|
||||
});
|
||||
|
||||
|
|
|
@ -30,7 +30,13 @@ BlazeComponent.extendComponent({
|
|||
|
||||
Template.swimlaneHeader.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;
|
||||
}
|
||||
},
|
||||
});
|
||||
|
||||
|
|
|
@ -1,9 +1,7 @@
|
|||
template(name="swimlane")
|
||||
.swimlane
|
||||
+swimlaneHeader
|
||||
// Minimize swimlanes next 2 lines below https://www.w3schools.com/howto/howto_js_accordion.asp
|
||||
button(class="accordion")
|
||||
div(class="panel")
|
||||
unless collapseSwimlane
|
||||
.swimlane.js-lists.js-swimlane
|
||||
if isMiniScreen
|
||||
if currentListIsInThisSwimlane _id
|
||||
|
@ -22,6 +20,28 @@ template(name="swimlane")
|
|||
if currentUser.isBoardMember
|
||||
unless currentUser.isCommentOnly
|
||||
+addListForm
|
||||
if collapseSwimlane
|
||||
// Minimize swimlanes next 2 lines below https://www.w3schools.com/howto/howto_js_accordion.asp
|
||||
button(class="accordion")
|
||||
div(class="panel")
|
||||
.swimlane.js-lists.js-swimlane
|
||||
if isMiniScreen
|
||||
if currentListIsInThisSwimlane _id
|
||||
+list(currentList)
|
||||
unless currentList
|
||||
each lists
|
||||
+miniList(this)
|
||||
if currentUser.isBoardMember
|
||||
unless currentUser.isCommentOnly
|
||||
+addListForm
|
||||
else
|
||||
each lists
|
||||
+list(this)
|
||||
if currentCardIsInThisList _id ../_id
|
||||
+cardDetails(currentCard)
|
||||
if currentUser.isBoardMember
|
||||
unless currentUser.isCommentOnly
|
||||
+addListForm
|
||||
|
||||
template(name="listsGroup")
|
||||
.swimlane.list-group.js-lists
|
||||
|
|
|
@ -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 (
|
||||
|
|
|
@ -162,19 +162,41 @@ Template.changeLanguagePopup.events({
|
|||
|
||||
Template.changeSettingsPopup.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;
|
||||
}
|
||||
},
|
||||
hiddenSystemMessages() {
|
||||
return Meteor.user().hasHiddenSystemMessages();
|
||||
const currentUser = Meteor.user();
|
||||
if (currentUser) {
|
||||
return Meteor.user().hasHiddenSystemMessages();
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
},
|
||||
showCardsCountAt() {
|
||||
return Meteor.user().getLimitToShowCardsCount();
|
||||
const currentUser = Meteor.user();
|
||||
if (currentUser) {
|
||||
return Meteor.user().getLimitToShowCardsCount();
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
},
|
||||
});
|
||||
|
||||
Template.changeSettingsPopup.events({
|
||||
'click .js-toggle-desktop-drag-handles'() {
|
||||
Meteor.call('toggleDesktopDragHandles');
|
||||
import { Cookies } from 'meteor/ostrio:cookies';
|
||||
const cookies = new Cookies();
|
||||
if (cookies.has('showDesktopDragHandles')) {
|
||||
cookies.remove('showDesktopDragHandles'); //true
|
||||
} else {
|
||||
cookies.set('showDesktopDragHandles', 'true'); //true
|
||||
}
|
||||
},
|
||||
'click .js-toggle-system-messages'() {
|
||||
Meteor.call('toggleSystemMessages');
|
||||
|
|
|
@ -1,4 +1,58 @@
|
|||
Utils = {
|
||||
setBoardView(view) {
|
||||
import { Cookies } from 'meteor/ostrio:cookies';
|
||||
const cookies = new Cookies();
|
||||
currentUser = Meteor.user();
|
||||
if (view === 'board-view-lists') {
|
||||
cookies.set('boardView', 'board-view-lists'); //true
|
||||
if (currentUser) {
|
||||
Meteor.user().setBoardView('board-view-lists');
|
||||
}
|
||||
} else if (view === 'board-view-swimlanes') {
|
||||
cookies.set('boardView', 'board-view-swimlanes'); //true
|
||||
if (currentUser) {
|
||||
Meteor.user().setBoardView('board-view-swimlanes');
|
||||
}
|
||||
} else if (view === 'board-view-collapse') {
|
||||
cookies.set('boardView', 'board-view-swimlane'); //true
|
||||
cookies.set('collapseSwimlane', 'true'); //true
|
||||
if (currentUser) {
|
||||
Meteor.user().setBoardView('board-view-swimlane');
|
||||
}
|
||||
} else if (view === 'board-view-cal') {
|
||||
cookies.set('boardView', 'board-view-cal'); //true
|
||||
if (currentUser) {
|
||||
Meteor.user().setBoardView('board-view-cal');
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
unsetBoardView() {
|
||||
import { Cookies } from 'meteor/ostrio:cookies';
|
||||
const cookies = new Cookies();
|
||||
cookies.remove('boardView');
|
||||
cookies.remove('collapseSwimlane');
|
||||
},
|
||||
|
||||
boardView() {
|
||||
import { Cookies } from 'meteor/ostrio:cookies';
|
||||
const cookies = new Cookies();
|
||||
if (cookies.get('boardView') === 'board-view-lists') {
|
||||
return 'board-view-lists';
|
||||
} else if (
|
||||
cookies.get('boardView') === 'board-view-swimlanes' &&
|
||||
!cookies.has('collapseSwimlane')
|
||||
) {
|
||||
return 'board-view-swimlanes';
|
||||
} else if (cookies.has('collapseSwimlane')) {
|
||||
return 'board-view-swimlanes';
|
||||
} else if (cookies.get('boardView') === 'board-view-cal') {
|
||||
return 'board-view-cal';
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
},
|
||||
|
||||
// XXX We should remove these two methods
|
||||
goBoardId(_id) {
|
||||
const board = Boards.findOne(_id);
|
||||
|
|
|
@ -409,8 +409,12 @@ Boards.helpers({
|
|||
},
|
||||
|
||||
lists() {
|
||||
const enabled = Meteor.user().hasSortBy();
|
||||
return enabled ? this.newestLists() : this.draggableLists();
|
||||
//currentUser = Meteor.user();
|
||||
//if (currentUser) {
|
||||
// enabled = Meteor.user().hasSortBy();
|
||||
//}
|
||||
//return enabled ? this.newestLists() : this.draggableLists();
|
||||
return this.draggableLists();
|
||||
},
|
||||
|
||||
newestLists() {
|
||||
|
|
|
@ -174,8 +174,12 @@ Swimlanes.helpers({
|
|||
},
|
||||
|
||||
lists() {
|
||||
const enabled = Meteor.user().hasSortBy();
|
||||
return enabled ? this.newestLists() : this.draggableLists();
|
||||
//currentUser = Meteor.user();
|
||||
//if (currentUser) {
|
||||
// enabled = Meteor.user().hasSortBy();
|
||||
//}
|
||||
//return enabled ? this.newestLists() : this.draggableLists();
|
||||
return this.draggableLists();
|
||||
},
|
||||
newestLists() {
|
||||
// sorted lists from newest to the oldest, by its creation date or its cards' last modification date
|
||||
|
|
|
@ -119,13 +119,6 @@ Users.attachSchema(
|
|||
type: String,
|
||||
optional: true,
|
||||
},
|
||||
'profile.showDesktopDragHandles': {
|
||||
/**
|
||||
* does the user want to hide system messages?
|
||||
*/
|
||||
type: Boolean,
|
||||
optional: true,
|
||||
},
|
||||
'profile.hiddenSystemMessages': {
|
||||
/**
|
||||
* does the user want to hide system messages?
|
||||
|
@ -133,13 +126,6 @@ Users.attachSchema(
|
|||
type: Boolean,
|
||||
optional: true,
|
||||
},
|
||||
'profile.hiddenMinicardLabelText': {
|
||||
/**
|
||||
* does the user want to hide minicard label texts?
|
||||
*/
|
||||
type: Boolean,
|
||||
optional: true,
|
||||
},
|
||||
'profile.initials': {
|
||||
/**
|
||||
* initials of the user
|
||||
|
@ -198,6 +184,7 @@ Users.attachSchema(
|
|||
allowedValues: [
|
||||
'board-view-lists',
|
||||
'board-view-swimlanes',
|
||||
'board-view-collapse',
|
||||
'board-view-cal',
|
||||
],
|
||||
},
|
||||
|
@ -395,10 +382,18 @@ Users.helpers({
|
|||
}
|
||||
return ret;
|
||||
},
|
||||
hasSortBy() {
|
||||
// if use doesn't have dragHandle, then we can let user to choose sort list by different order
|
||||
return !this.hasShowDesktopDragHandles();
|
||||
},
|
||||
//hasSortBy() {
|
||||
// if use doesn't have dragHandle, then we can let user to choose sort list by different order
|
||||
//return this.hasShowDesktopDragHandles();
|
||||
// return false;
|
||||
/*
|
||||
if (typeof currentUser === 'undefined' || typeof currentUser === 'null') {
|
||||
return false;
|
||||
} else {
|
||||
return this.hasShowDesktopDragHandles();
|
||||
}
|
||||
*/
|
||||
//},
|
||||
getListSortBy() {
|
||||
return this._getListSortBy()[0];
|
||||
},
|
||||
|
@ -419,21 +414,11 @@ Users.helpers({
|
|||
return _.contains(notifications, activityId);
|
||||
},
|
||||
|
||||
hasShowDesktopDragHandles() {
|
||||
const profile = this.profile || {};
|
||||
return profile.showDesktopDragHandles || false;
|
||||
},
|
||||
|
||||
hasHiddenSystemMessages() {
|
||||
const profile = this.profile || {};
|
||||
return profile.hiddenSystemMessages || false;
|
||||
},
|
||||
|
||||
hasHiddenMinicardLabelText() {
|
||||
const profile = this.profile || {};
|
||||
return profile.hiddenMinicardLabelText || false;
|
||||
},
|
||||
|
||||
getEmailBuffer() {
|
||||
const { emailBuffer = [] } = this.profile || {};
|
||||
return emailBuffer;
|
||||
|
@ -455,8 +440,11 @@ Users.helpers({
|
|||
},
|
||||
|
||||
getLimitToShowCardsCount() {
|
||||
const profile = this.profile || {};
|
||||
return profile.showCardsCountAt;
|
||||
currentUser = Meteor.user();
|
||||
if (currentUser) {
|
||||
const profile = this.profile || {};
|
||||
return profile.showCardsCountAt;
|
||||
}
|
||||
},
|
||||
|
||||
getName() {
|
||||
|
@ -536,13 +524,6 @@ Users.mutations({
|
|||
},
|
||||
};
|
||||
},
|
||||
toggleDesktopHandles(value = false) {
|
||||
return {
|
||||
$set: {
|
||||
'profile.showDesktopDragHandles': !value,
|
||||
},
|
||||
};
|
||||
},
|
||||
|
||||
toggleSystem(value = false) {
|
||||
return {
|
||||
|
@ -552,14 +533,6 @@ Users.mutations({
|
|||
};
|
||||
},
|
||||
|
||||
toggleLabelText(value = false) {
|
||||
return {
|
||||
$set: {
|
||||
'profile.hiddenMinicardLabelText': !value,
|
||||
},
|
||||
};
|
||||
},
|
||||
|
||||
addNotification(activityId) {
|
||||
return {
|
||||
$addToSet: {
|
||||
|
@ -624,18 +597,10 @@ Meteor.methods({
|
|||
check(value, String);
|
||||
Meteor.user().setListSortBy(value);
|
||||
},
|
||||
toggleDesktopDragHandles() {
|
||||
const user = Meteor.user();
|
||||
user.toggleDesktopHandles(user.hasShowDesktopDragHandles());
|
||||
},
|
||||
toggleSystemMessages() {
|
||||
const user = Meteor.user();
|
||||
user.toggleSystem(user.hasHiddenSystemMessages());
|
||||
},
|
||||
toggleMinicardLabelText() {
|
||||
const user = Meteor.user();
|
||||
user.toggleLabelText(user.hasHiddenMinicardLabelText());
|
||||
},
|
||||
changeLimitToShowCardsCount(limit) {
|
||||
check(limit, Number);
|
||||
Meteor.user().setShowCardsCountAt(limit);
|
||||
|
|
|
@ -793,3 +793,27 @@ Migrations.add('add-assignee', () => {
|
|||
noValidateMulti,
|
||||
);
|
||||
});
|
||||
|
||||
Migrations.add('remove-profile-showDesktopDragHandles', () => {
|
||||
Users.update(
|
||||
{},
|
||||
{
|
||||
$unset: {
|
||||
'profile.showDesktopDragHandles': 1,
|
||||
},
|
||||
},
|
||||
noValidateMulti,
|
||||
);
|
||||
});
|
||||
|
||||
Migrations.add('remove-profile-hiddenMinicardLabelText', () => {
|
||||
Users.update(
|
||||
{},
|
||||
{
|
||||
$unset: {
|
||||
'profile.hiddenMinicardLabelText': 1,
|
||||
},
|
||||
},
|
||||
noValidateMulti,
|
||||
);
|
||||
});
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue