summaryrefslogtreecommitdiffstats
path: root/client/components/boards/boardHeader.js
diff options
context:
space:
mode:
Diffstat (limited to 'client/components/boards/boardHeader.js')
-rw-r--r--client/components/boards/boardHeader.js166
1 files changed, 144 insertions, 22 deletions
diff --git a/client/components/boards/boardHeader.js b/client/components/boards/boardHeader.js
index cb84c233..ffbb9b72 100644
--- a/client/components/boards/boardHeader.js
+++ b/client/components/boards/boardHeader.js
@@ -1,3 +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'() {
@@ -80,7 +84,27 @@ BlazeComponent.extendComponent({
const currentBoard = Boards.findOne(Session.get('currentBoard'));
return currentBoard && currentBoard.stars >= 2;
},
-
+ /*
+ showSort() {
+ return Meteor.user().hasSortBy();
+ },
+ directionClass() {
+ return this.currentDirection() === -1 ? DOWNCLS : UPCLS;
+ },
+ changeDirection() {
+ const direction = 0 - this.currentDirection() === -1 ? '-' : '';
+ Meteor.call('setListSortBy', direction + this.currentListSortBy());
+ },
+ currentDirection() {
+ return Meteor.user().getListSortByDirection();
+ },
+ currentListSortBy() {
+ return Meteor.user().getListSortBy();
+ },
+ listSortShortDesc() {
+ return `list-label-short-${this.currentListSortBy()}`;
+ },
+ */
events() {
return [
{
@@ -94,30 +118,25 @@ 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') {
+ // click on the text, popup choices
+ this.changeDirection();
+ } else {
+ // change the sort order
+ Popup.open('listsort')(evt);
+ }
+ },
+ */
'click .js-filter-reset'(event) {
event.stopPropagation();
Sidebar.setView();
@@ -126,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();
@@ -156,6 +172,40 @@ Template.boardHeaderBar.helpers({
!Meteor.user().isCommentOnly()
);
},
+ boardView() {
+ 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'() {
+ Utils.setBoardView('board-view-lists');
+ Popup.close();
+ },
+ 'click .js-open-swimlanes-view'() {
+ Utils.setBoardView('board-view-swimlanes');
+ Popup.close();
+ },
+ //'click .js-open-collapse-view'() {
+ // Utils.setBoardView('board-view-collapse');
+ //Popup.close();
+ 'click .js-open-cal-view'() {
+ Utils.setBoardView('board-view-cal');
+ Popup.close();
+ },
+ 'click .js-open-rules-view'() {
+ Modal.openWide('rulesMain');
+ Popup.close();
+ },
});
const CreateBoard = BlazeComponent.extendComponent({
@@ -277,3 +327,75 @@ BlazeComponent.extendComponent({
];
},
}).register('boardChangeWatchPopup');
+
+/*
+BlazeComponent.extendComponent({
+ onCreated() {
+ //this.sortBy = new ReactiveVar();
+ ////this.sortDirection = new ReactiveVar();
+ //this.setSortBy();
+ this.downClass = DOWNCLS;
+ this.upClass = UPCLS;
+ },
+ allowedSortValues() {
+ const types = [];
+ const pushed = {};
+ Meteor.user()
+ .getListSortTypes()
+ .forEach(type => {
+ const key = type.replace(/^-/, '');
+ if (pushed[key] === undefined) {
+ types.push({
+ name: key,
+ label: `list-label-${key}`,
+ shortLabel: `list-label-short-${key}`,
+ });
+ pushed[key] = 1;
+ }
+ });
+ return types;
+ },
+ Direction() {
+ return Meteor.user().getListSortByDirection() === -1
+ ? this.downClass
+ : this.upClass;
+ },
+ sortby() {
+ return Meteor.user().getListSortBy();
+ },
+
+ setSortBy(type = null) {
+ const user = Meteor.user();
+ if (type === null) {
+ type = user._getListSortBy();
+ } else {
+ let value = '';
+ if (type.map) {
+ // is an array
+ value = (type[1] === -1 ? '-' : '') + type[0];
+ }
+ Meteor.call('setListSortBy', value);
+ }
+ //this.sortBy.set(type[0]);
+ //this.sortDirection.set(type[1]);
+ },
+
+ events() {
+ return [
+ {
+ 'click .js-sort-by'(evt) {
+ evt.preventDefault();
+ const target = evt.target;
+ const sortby = target.getAttribute('name');
+ const down = !!target.querySelector(`.${this.upClass}`);
+ const direction = down ? -1 : 1;
+ this.setSortBy([sortby, direction]);
+ if (Utils.isMiniScreen) {
+ Popup.close();
+ }
+ },
+ },
+ ];
+ },
+}).register('listsortPopup');
+*/