diff options
author | Lauri Ojansivu <x@xet7.org> | 2019-11-19 21:42:00 +0200 |
---|---|---|
committer | Lauri Ojansivu <x@xet7.org> | 2019-11-19 21:42:00 +0200 |
commit | 4786b0c18ddeb8f48525216eabebdced7159467d (patch) | |
tree | dc0a52fc15d46b9f76125bce47418ee9ed4a5bb6 /client | |
parent | bc9512b75041501184ac53727c4a976edf2f4f67 (diff) | |
download | wekan-4786b0c18ddeb8f48525216eabebdced7159467d.tar.gz wekan-4786b0c18ddeb8f48525216eabebdced7159467d.tar.bz2 wekan-4786b0c18ddeb8f48525216eabebdced7159467d.zip |
Use database when logged in. Continued.
Thanks to xet7 !
Diffstat (limited to 'client')
-rw-r--r-- | client/components/boards/boardHeader.js | 79 | ||||
-rw-r--r-- | client/components/lists/listHeader.jade | 4 | ||||
-rw-r--r-- | client/lib/utils.js | 65 |
3 files changed, 50 insertions, 98 deletions
diff --git a/client/components/boards/boardHeader.js b/client/components/boards/boardHeader.js index 1706f8e4..ffbb9b72 100644 --- a/client/components/boards/boardHeader.js +++ b/client/components/boards/boardHeader.js @@ -173,78 +173,33 @@ Template.boardHeaderBar.helpers({ ); }, 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; - } - }, + return Utils.boardView(); + }, + //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'); - } - } + Utils.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'); - } - } + Utils.setBoardView('board-view-swimlanes'); Popup.close(); }, + //'click .js-open-collapse-view'() { + // Utils.setBoardView('board-view-collapse'); + //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'); - } + Utils.setBoardView('board-view-cal'); Popup.close(); }, 'click .js-open-rules-view'() { diff --git a/client/components/lists/listHeader.jade b/client/components/lists/listHeader.jade index 064303ee..631f68a0 100644 --- a/client/components/lists/listHeader.jade +++ b/client/components/lists/listHeader.jade @@ -39,8 +39,8 @@ template(name="listHeader") i.list-header-watch-icon.fa.fa-eye div.list-header-menu unless currentUser.isCommentOnly - if isBoardAdmin - a.fa.js-list-star.list-header-plus-icon(class="fa-star{{#unless starred}}-o{{/unless}}") + //if isBoardAdmin + // a.fa.js-list-star.list-header-plus-icon(class="fa-star{{#unless starred}}-o{{/unless}}") if canSeeAddCard a.js-add-card.fa.fa-plus.list-header-plus-icon a.fa.fa-navicon.js-open-list-menu diff --git a/client/lib/utils.js b/client/lib/utils.js index 7b4990e7..80ec412c 100644 --- a/client/lib/utils.js +++ b/client/lib/utils.js @@ -3,26 +3,18 @@ Utils = { 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'); + if (currentUser) { + Meteor.user().setBoardView(view); + } else { + if (view === 'board-view-lists') { + cookies.set('boardView', 'board-view-lists'); //true + } else if (view === 'board-view-swimlanes') { + cookies.set('boardView', 'board-view-swimlanes'); //true + //} else if (view === 'board-view-collapse') { + // cookies.set('boardView', 'board-view-swimlane'); //true + // cookies.set('collapseSwimlane', 'true'); //true + } else if (view === 'board-view-cal') { + cookies.set('boardView', 'board-view-cal'); //true } } }, @@ -35,21 +27,26 @@ Utils = { }, 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'; + currentUser = Meteor.user(); + if (currentUser) { + return (currentUser.profile || {}).boardView } else { - return false; + 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; + } } }, |