From b7c5ba3d1b97bc33c95618cefbd0416d78a4d4dc Mon Sep 17 00:00:00 2001 From: Steffen Date: Thu, 29 Aug 2019 13:53:40 +0200 Subject: add card color to calendar event (#2651) --- client/components/boards/boardBody.js | 1 + client/components/boards/boardBody.styl | 78 +++++++++++++++++++++++++++++++++ 2 files changed, 79 insertions(+) (limited to 'client/components/boards') diff --git a/client/components/boards/boardBody.js b/client/components/boards/boardBody.js index 6cff5ab1..07cd306a 100644 --- a/client/components/boards/boardBody.js +++ b/client/components/boards/boardBody.js @@ -326,6 +326,7 @@ BlazeComponent.extendComponent({ slug: currentBoard.slug, cardId: card._id, }), + className: card.color ? `calendar-event-${card.color}` : null, }); }); callback(events); diff --git a/client/components/boards/boardBody.styl b/client/components/boards/boardBody.styl index dfaaa050..32207d82 100644 --- a/client/components/boards/boardBody.styl +++ b/client/components/boards/boardBody.styl @@ -53,3 +53,81 @@ position() padding: 0 0px 0px 0 overflow-x: hidden overflow-y: auto + +calendar-event-color(background, borderColor, color...) + background: background !important + border-color: borderColor + if color + color: color !important //overwrite text for better visibility + +.calendar-event-green + calendar-event-color(#3cb500, #2a8000, #ffffff) //White text for better visibility + +.calendar-event-yellow + calendar-event-color(#fad900, #c7ac00, #000) //Black text for better visibility + +.calendar-event-orange + calendar-event-color(#ff9f19, #cc7c14, #000) //Black text for better visibility + +.calendar-event-red + calendar-event-color(#eb4646, #b83737, #ffffff) //White text for better visibility + +.calendar-event-purple + calendar-event-color(#a632db, #7d26a6, #ffffff) //White text for better visibility + +.calendar-event-blue + calendar-event-color(#0079bf, #005a8a, #ffffff) //White text for better visibility + +.calendar-event-pink + calendar-event-color(#ff78cb, #cc62a3, #000) //Black text for better visibility + +.calendar-event-sky + calendar-event-color(#00c2e0, #0094ab, #ffffff) //White text for better visibility + +.calendar-event-black + calendar-event-color(#4d4d4d, #1a1a1a, #ffffff) //White text for better visibility + +.calendar-event-lime + calendar-event-color(#51e898, #3eb375, #000) //Black text for better visibility + +.calendar-event-silver + calendar-event-color(#c0c0c0, #8c8c8c, #000) //Black text for better visibility + +.calendar-event-peachpuff + calendar-event-color(#ffdab9, #ccaf95, #000) //Black text for better visibility + +.calendar-event-crimson + calendar-event-color(#dc143c, #a8112f, #ffffff) //White text for better visibility + +.calendar-event-plum + calendar-event-color(#dda0dd, #a87ba8, #000) //Black text for better visibility + +.calendar-event-darkgreen + calendar-event-color(#006400, #003000, #ffffff) //White text for better visibility + +.calendar-event-slateblue + calendar-event-color(#6a5acd, #4f4399, #ffffff) //White text for better visibility + +.calendar-event-magenta + calendar-event-color(#ff00ff, #cc00cc, #ffffff) //White text for better visibility + +.calendar-event-gold + calendar-event-color(#ffd700, #ccaa00, #000) //Black text for better visibility + +.calendar-event-navy + calendar-event-color(#000080, #000033, #ffffff) //White text for better visibility + +.calendar-event-gray + calendar-event-color(#808080, #333333, #ffffff) //White text for better visibility + +.calendar-event-saddlebrown + calendar-event-color(#8b4513, #572b0c, #ffffff) //White text for better visibility + +.calendar-event-paleturquoise + calendar-event-color(#afeeee, #8ababa, #000) //Black text for better visibility + +.calendar-event-mistyrose + calendar-event-color(#ffe4e1, #ccb8b6, #000) //Black text for better visibility + +.calendar-event-indigo + calendar-event-color(#4b0082, #2b004d, #ffffff) //White text for better visibility -- cgit v1.2.3-1-g7c22 From ff550e91103115e7b731dd80c4588b93b2d4c64f Mon Sep 17 00:00:00 2001 From: Lauri Ojansivu Date: Fri, 13 Sep 2019 03:45:55 +0300 Subject: Mobile and Desktop drag handles part 1. Thanks to xet7 ! Related #2081 --- client/components/boards/boardBody.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'client/components/boards') diff --git a/client/components/boards/boardBody.js b/client/components/boards/boardBody.js index 07cd306a..713b6cbc 100644 --- a/client/components/boards/boardBody.js +++ b/client/components/boards/boardBody.js @@ -89,7 +89,7 @@ BlazeComponent.extendComponent({ helper.append(list.clone()); return helper; }, - handle: '.js-swimlane-header', + handle: '.js-swimlane-header-handle', items: '.swimlane:not(.placeholder)', placeholder: 'swimlane placeholder', distance: 7, -- cgit v1.2.3-1-g7c22 From 57119868bbb49f47c7d0b51b9952df9bd83d46f5 Mon Sep 17 00:00:00 2001 From: Lauri Ojansivu Date: Sat, 14 Sep 2019 05:55:32 +0300 Subject: Revert drag handle changes. Thanks to Keelan ! Related #2704 --- client/components/boards/boardBody.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'client/components/boards') diff --git a/client/components/boards/boardBody.js b/client/components/boards/boardBody.js index 713b6cbc..07cd306a 100644 --- a/client/components/boards/boardBody.js +++ b/client/components/boards/boardBody.js @@ -89,7 +89,7 @@ BlazeComponent.extendComponent({ helper.append(list.clone()); return helper; }, - handle: '.js-swimlane-header-handle', + handle: '.js-swimlane-header', items: '.swimlane:not(.placeholder)', placeholder: 'swimlane placeholder', distance: 7, -- cgit v1.2.3-1-g7c22 From 03d7fc02ecc90690e1282d417f35b7e4561af066 Mon Sep 17 00:00:00 2001 From: Lauri Ojansivu Date: Tue, 17 Sep 2019 01:39:10 +0300 Subject: Drag handles. In Progress. --- client/components/boards/boardBody.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'client/components/boards') diff --git a/client/components/boards/boardBody.js b/client/components/boards/boardBody.js index 07cd306a..713b6cbc 100644 --- a/client/components/boards/boardBody.js +++ b/client/components/boards/boardBody.js @@ -89,7 +89,7 @@ BlazeComponent.extendComponent({ helper.append(list.clone()); return helper; }, - handle: '.js-swimlane-header', + handle: '.js-swimlane-header-handle', items: '.swimlane:not(.placeholder)', placeholder: 'swimlane placeholder', distance: 7, -- cgit v1.2.3-1-g7c22 From 62b72a03c4889377169411c8cdbf372c71cac1af Mon Sep 17 00:00:00 2001 From: "Sam X. Chen" Date: Thu, 26 Sep 2019 10:53:40 -0400 Subject: Add feature: Add due timeline into Calendar view --- client/components/boards/boardBody.js | 52 ++++++++++++++++++++++++----------- 1 file changed, 36 insertions(+), 16 deletions(-) (limited to 'client/components/boards') diff --git a/client/components/boards/boardBody.js b/client/components/boards/boardBody.js index 07cd306a..d64636f4 100644 --- a/client/components/boards/boardBody.js +++ b/client/components/boards/boardBody.js @@ -309,26 +309,46 @@ BlazeComponent.extendComponent({ events(start, end, timezone, callback) { const currentBoard = Boards.findOne(Session.get('currentBoard')); const events = []; + const pushEvent = function(card, title, start, end, extraCls) { + start = start || card.startAt; + end = end || card.endAt; + title = title || card.title; + const className = + (extraCls ? `${extraCls} ` : '') + + (card.color ? `calendar-event-${card.color}` : ''); + events.push({ + id: card._id, + title, + start, + end: end || card.endAt, + allDay: + Math.abs(end.getTime() - start.getTime()) / 1000 === 24 * 3600, + url: FlowRouter.url('card', { + boardId: currentBoard._id, + slug: currentBoard.slug, + cardId: card._id, + }), + className, + }); + }; currentBoard .cardsInInterval(start.toDate(), end.toDate()) .forEach(function(card) { - events.push({ - id: card._id, - title: card.title, - start: card.startAt, - end: card.endAt, - allDay: - Math.abs(card.endAt.getTime() - card.startAt.getTime()) / - 1000 === - 24 * 3600, - url: FlowRouter.url('card', { - boardId: currentBoard._id, - slug: currentBoard.slug, - cardId: card._id, - }), - className: card.color ? `calendar-event-${card.color}` : null, - }); + pushEvent(card); + }); + currentBoard + .cardsDueInBetween(start.toDate(), end.toDate()) + .forEach(function(card) { + pushEvent( + card, + `${card.title} ${TAPi18n.__('card-due')}`, + card.dueAt, + new Date(card.dueAt.getTime() + 36e5), + ); }); + events.sort(function(first, second) { + return first.id > second.id ? 1 : -1; + }); callback(events); }, eventResize(event, delta, revertFunc) { -- cgit v1.2.3-1-g7c22 From 5bc355f9a5e78df4c19764fdc4a343a46af4fdf8 Mon Sep 17 00:00:00 2001 From: Lauri Ojansivu Date: Thu, 3 Oct 2019 04:23:33 +0300 Subject: Drag handles. In progress. --- client/components/boards/boardBody.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'client/components/boards') diff --git a/client/components/boards/boardBody.js b/client/components/boards/boardBody.js index 47042ae7..d64636f4 100644 --- a/client/components/boards/boardBody.js +++ b/client/components/boards/boardBody.js @@ -89,7 +89,7 @@ BlazeComponent.extendComponent({ helper.append(list.clone()); return helper; }, - handle: '.js-swimlane-header-handle', + handle: '.js-swimlane-header', items: '.swimlane:not(.placeholder)', placeholder: 'swimlane placeholder', distance: 7, -- cgit v1.2.3-1-g7c22 From 7d6d3af54a2fc1fb68634725eb754b22f02fd430 Mon Sep 17 00:00:00 2001 From: Lauri Ojansivu Date: Tue, 29 Oct 2019 19:05:44 +0200 Subject: Add Features: allowing lists to be sorted by modifiedAt when not in draggable mode. Bug Fix #2093: the broken should be prior to file attachment feature introduced, and tested export board is working. Thanks to whowillcare ! ( xet7 merged this pull request manually from https://github.com/wekan/wekan/pull/2756 ) Closes #2093 --- client/components/boards/boardBody.js | 2 +- client/components/boards/boardHeader.jade | 18 ++++++ client/components/boards/boardHeader.js | 102 +++++++++++++++++++++++++++++- 3 files changed, 120 insertions(+), 2 deletions(-) (limited to 'client/components/boards') diff --git a/client/components/boards/boardBody.js b/client/components/boards/boardBody.js index d64636f4..47042ae7 100644 --- a/client/components/boards/boardBody.js +++ b/client/components/boards/boardBody.js @@ -89,7 +89,7 @@ BlazeComponent.extendComponent({ helper.append(list.clone()); return helper; }, - handle: '.js-swimlane-header', + handle: '.js-swimlane-header-handle', items: '.swimlane:not(.placeholder)', placeholder: 'swimlane placeholder', distance: 7, diff --git a/client/components/boards/boardHeader.jade b/client/components/boards/boardHeader.jade index fe533f95..175cc2c2 100644 --- a/client/components/boards/boardHeader.jade +++ b/client/components/boards/boardHeader.jade @@ -77,6 +77,10 @@ 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}} a.board-header-btn.js-open-filter-view( title="{{#if Filter.isActive}}{{_ 'filter-on-desc'}}{{else}}{{_ 'filter'}}{{/if}}" class="{{#if Filter.isActive}}emphasis{{/if}}") @@ -194,6 +198,20 @@ 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="boardChangeTitlePopup") form label diff --git a/client/components/boards/boardHeader.js b/client/components/boards/boardHeader.js index cb84c233..e14b1444 100644 --- a/client/components/boards/boardHeader.js +++ b/client/components/boards/boardHeader.js @@ -1,3 +1,5 @@ +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 +82,25 @@ 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 [ { @@ -118,6 +138,16 @@ BlazeComponent.extendComponent({ '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(); @@ -277,3 +307,73 @@ 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'); -- cgit v1.2.3-1-g7c22 From 274a997e62b421b034e1eb0b3a486813fe127240 Mon Sep 17 00:00:00 2001 From: Lauri Ojansivu Date: Wed, 13 Nov 2019 19:33:13 +0200 Subject: Fix card, list and swimlane move. Allow moving cards in multiselect mode. Closes #2771, closes #2743, closes #2704, related #2081 --- client/components/boards/boardBody.js | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) (limited to 'client/components/boards') diff --git a/client/components/boards/boardBody.js b/client/components/boards/boardBody.js index 47042ae7..82f12c40 100644 --- a/client/components/boards/boardBody.js +++ b/client/components/boards/boardBody.js @@ -89,7 +89,6 @@ BlazeComponent.extendComponent({ helper.append(list.clone()); return helper; }, - handle: '.js-swimlane-header-handle', items: '.swimlane:not(.placeholder)', placeholder: 'swimlane placeholder', distance: 7, @@ -193,6 +192,24 @@ BlazeComponent.extendComponent({ // ugly touch event hotfix enableClickOnTouch('.js-swimlane:not(.placeholder)'); + this.autorun(() => { + if ( + Utils.isMiniScreen() || + (!Utils.isMiniScreen() && Meteor.user().hasShowDesktopDragHandles()) + ) { + $swimlanesDom.sortable({ + handle: '.js-swimlane-header-handle', + }); + } else { + $swimlanesDom.sortable({ + handle: '.swimlane-header', + }); + } + + // Disable drag-dropping if the current user is not a board member or is comment only + $swimlanesDom.sortable('option', 'disabled', !userIsMember()); + }); + function userIsMember() { return ( Meteor.user() && -- cgit v1.2.3-1-g7c22 From 96abe3c6914ce37d9fb44da8fda375e40ad65c9e Mon Sep 17 00:00:00 2001 From: Lauri Ojansivu Date: Mon, 18 Nov 2019 22:23:49 +0200 Subject: 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 ! --- client/components/boards/boardBody.js | 29 ++++++-- client/components/boards/boardHeader.jade | 104 ++++++++++++++++++++-------- client/components/boards/boardHeader.js | 109 ++++++++++++++++++++++++------ 3 files changed, 188 insertions(+), 54 deletions(-) (limited to 'client/components/boards') diff --git a/client/components/boards/boardBody.js b/client/components/boards/boardBody.js index 82f12c40..8122a0b6 100644 --- a/client/components/boards/boardBody.js +++ b/client/components/boards/boardBody.js @@ -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'); diff --git a/client/components/boards/boardHeader.jade b/client/components/boards/boardHeader.jade index 175cc2c2..39221778 100644 --- a/client/components/boards/boardHeader.jade +++ b/client/components/boards/boardHeader.jade @@ -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 diff --git a/client/components/boards/boardHeader.js b/client/components/boards/boardHeader.js index e14b1444..1706f8e4 100644 --- a/client/components/boards/boardHeader.js +++ b/client/components/boards/boardHeader.js @@ -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'); +*/ -- cgit v1.2.3-1-g7c22 From 351d4767d7e93c90ac798769d6071da8730d834f Mon Sep 17 00:00:00 2001 From: Lauri Ojansivu Date: Tue, 19 Nov 2019 14:09:36 +0200 Subject: 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 ! --- client/components/boards/boardBody.js | 57 ++++++++++++++++++++++------------- 1 file changed, 36 insertions(+), 21 deletions(-) (limited to 'client/components/boards') diff --git a/client/components/boards/boardBody.js b/client/components/boards/boardBody.js index 8122a0b6..f00b8b1d 100644 --- a/client/components/boards/boardBody.js +++ b/client/components/boards/boardBody.js @@ -196,9 +196,20 @@ BlazeComponent.extendComponent({ const cookies = new Cookies(); 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 ( Utils.isMiniScreen() || - (!Utils.isMiniScreen() && cookies.has('showDesktopDragHandles')) + (!Utils.isMiniScreen() && showDesktopDragHandles) ) { $swimlanesDom.sortable({ handle: '.js-swimlane-header-handle', @@ -230,33 +241,36 @@ BlazeComponent.extendComponent({ }, isViewSwimlanes() { - import { Cookies } from 'meteor/ostrio:cookies'; - const cookies = new Cookies(); - const currentUser = Meteor.user(); - if (!currentUser) { + currentUser = Meteor.user(); + if (currentUser) { + return (currentUser.profile || {}).boardView === 'board-view-swimlanes'; + } else { + import { Cookies } from 'meteor/ostrio:cookies'; + const cookies = new Cookies(); 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) { + currentUser = Meteor.user(); + if (currentUser) { + return (currentUser.profile || {}).boardView === 'board-view-lists'; + } else { + import { Cookies } from 'meteor/ostrio:cookies'; + const cookies = new Cookies(); 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) { + currentUser = Meteor.user(); + if (currentUser) { + return (currentUser.profile || {}).boardView === 'board-view-cal'; + } else { + import { Cookies } from 'meteor/ostrio:cookies'; + const cookies = new Cookies(); return cookies.get('boardView') === 'board-view-cal'; } - return (currentUser.profile || {}).boardView === 'board-view-cal'; }, openNewListForm() { @@ -413,12 +427,13 @@ BlazeComponent.extendComponent({ }; }, isViewCalendar() { - import { Cookies } from 'meteor/ostrio:cookies'; - const cookies = new Cookies(); - const currentUser = Meteor.user(); - if (!currentUser) { + currentUser = Meteor.user(); + if (currentUser) { + return (currentUser.profile || {}).boardView === 'board-view-cal'; + } else { + import { Cookies } from 'meteor/ostrio:cookies'; + const cookies = new Cookies(); return cookies.get('boardView') === 'board-view-cal'; } - return (currentUser.profile || {}).boardView === 'board-view-cal'; }, }).register('calendarView'); -- cgit v1.2.3-1-g7c22 From 4786b0c18ddeb8f48525216eabebdced7159467d Mon Sep 17 00:00:00 2001 From: Lauri Ojansivu Date: Tue, 19 Nov 2019 21:42:00 +0200 Subject: Use database when logged in. Continued. Thanks to xet7 ! --- client/components/boards/boardHeader.js | 79 +++++++-------------------------- 1 file changed, 17 insertions(+), 62 deletions(-) (limited to 'client/components/boards') 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'() { -- cgit v1.2.3-1-g7c22 From 115d23f9293cad8a93f18f75a47a8a65756f71ce Mon Sep 17 00:00:00 2001 From: Lauri Ojansivu Date: Tue, 19 Nov 2019 21:55:43 +0200 Subject: Use database when logged in. Continued. Thanks to xet7 ! --- client/components/boards/boardBody.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'client/components/boards') diff --git a/client/components/boards/boardBody.js b/client/components/boards/boardBody.js index f00b8b1d..b10f55ab 100644 --- a/client/components/boards/boardBody.js +++ b/client/components/boards/boardBody.js @@ -199,7 +199,8 @@ BlazeComponent.extendComponent({ let showDesktopDragHandles = false; currentUser = Meteor.user(); if (currentUser) { - showDesktopDragHandles = (currentUser.profile || {}).showDesktopDragHandles; + showDesktopDragHandles = (currentUser.profile || {}) + .showDesktopDragHandles; } else { if (cookies.has('showDesktopDragHandles')) { showDesktopDragHandles = true; -- cgit v1.2.3-1-g7c22 From 788dd0a81a06efee165007a92780f9e8c2c754ac Mon Sep 17 00:00:00 2001 From: Lauri Ojansivu Date: Wed, 20 Nov 2019 21:10:11 +0200 Subject: Fix lint errors. --- client/components/boards/boardBody.js | 30 ++++++++++++++---------------- 1 file changed, 14 insertions(+), 16 deletions(-) (limited to 'client/components/boards') diff --git a/client/components/boards/boardBody.js b/client/components/boards/boardBody.js index b10f55ab..41b6f4ef 100644 --- a/client/components/boards/boardBody.js +++ b/client/components/boards/boardBody.js @@ -201,16 +201,14 @@ BlazeComponent.extendComponent({ if (currentUser) { showDesktopDragHandles = (currentUser.profile || {}) .showDesktopDragHandles; + } else if (cookies.has('showDesktopDragHandles')) { + showDesktopDragHandles = true; } else { - if (cookies.has('showDesktopDragHandles')) { - showDesktopDragHandles = true; - } else { - showDesktopDragHandles = false; - } + showDesktopDragHandles = false; } if ( - Utils.isMiniScreen() || - (!Utils.isMiniScreen() && showDesktopDragHandles) + Utils.isMiniScreen() + || (!Utils.isMiniScreen() && showDesktopDragHandles) ) { $swimlanesDom.sortable({ handle: '.js-swimlane-header-handle', @@ -227,9 +225,9 @@ BlazeComponent.extendComponent({ function userIsMember() { return ( - Meteor.user() && - Meteor.user().isBoardMember() && - !Meteor.user().isCommentOnly() + Meteor.user() + && Meteor.user().isBoardMember() + && !Meteor.user().isCommentOnly() ); } @@ -308,16 +306,16 @@ BlazeComponent.extendComponent({ scrollLeft(position = 0) { const swimlanes = this.$('.js-swimlanes'); - swimlanes && - swimlanes.animate({ + swimlanes + && swimlanes.animate({ scrollLeft: position, }); }, scrollTop(position = 0) { const swimlanes = this.$('.js-swimlanes'); - swimlanes && - swimlanes.animate({ + swimlanes + && swimlanes.animate({ scrollTop: position, }); }, @@ -361,8 +359,8 @@ BlazeComponent.extendComponent({ end = end || card.endAt; title = title || card.title; const className = - (extraCls ? `${extraCls} ` : '') + - (card.color ? `calendar-event-${card.color}` : ''); + (extraCls ? `${extraCls} ` : '') + + (card.color ? `calendar-event-${card.color}` : ''); events.push({ id: card._id, title, -- cgit v1.2.3-1-g7c22