diff options
author | Nicu Tofan <nicu.tofan@gmail.com> | 2018-06-28 17:00:35 +0300 |
---|---|---|
committer | Nicu Tofan <nicu.tofan@gmail.com> | 2018-06-28 17:00:35 +0300 |
commit | 3eba6ef2856946925795f9cd370583be892344dd (patch) | |
tree | 11d3bb19678153f955647fbf4b3f6d2299933d7d /client | |
parent | b7d508e8c4cf858559e144053d119ceaebfa9697 (diff) | |
parent | ad54a8a48404a84b0bf5ff7dab5348be6dda574e (diff) | |
download | wekan-3eba6ef2856946925795f9cd370583be892344dd.tar.gz wekan-3eba6ef2856946925795f9cd370583be892344dd.tar.bz2 wekan-3eba6ef2856946925795f9cd370583be892344dd.zip |
Merge branch 'devel' into nested-tasks
Diffstat (limited to 'client')
-rw-r--r-- | client/components/boards/boardBody.jade | 2 | ||||
-rw-r--r-- | client/components/boards/boardBody.js | 62 | ||||
-rw-r--r-- | client/components/boards/boardHeader.js | 4 | ||||
-rw-r--r-- | client/components/cards/cardDate.js | 57 | ||||
-rw-r--r-- | client/components/cards/minicard.styl | 4 | ||||
-rw-r--r-- | client/components/lists/listBody.js | 11 | ||||
-rw-r--r-- | client/components/settings/invitationCode.js | 2 | ||||
-rw-r--r-- | client/components/swimlanes/swimlanes.js | 2 | ||||
-rw-r--r-- | client/components/users/userAvatar.jade | 2 | ||||
-rw-r--r-- | client/lib/inlinedform.js | 12 |
10 files changed, 124 insertions, 34 deletions
diff --git a/client/components/boards/boardBody.jade b/client/components/boards/boardBody.jade index 29a613b9..b480bc0f 100644 --- a/client/components/boards/boardBody.jade +++ b/client/components/boards/boardBody.jade @@ -25,3 +25,5 @@ template(name="boardBody") +swimlane(this) if isViewLists +listsGroup + if isViewCalendar + +fullcalendar(calendarOptions) diff --git a/client/components/boards/boardBody.js b/client/components/boards/boardBody.js index dfe7b8d2..935c550f 100644 --- a/client/components/boards/boardBody.js +++ b/client/components/boards/boardBody.js @@ -98,6 +98,12 @@ BlazeComponent.extendComponent({ return (currentUser.profile.boardView === 'board-view-lists'); }, + isViewCalendar() { + const currentUser = Meteor.user(); + if (!currentUser) return true; + return (currentUser.profile.boardView === 'board-view-cal'); + }, + openNewListForm() { if (this.isViewSwimlanes()) { this.childComponents('swimlane')[0] @@ -108,6 +114,62 @@ BlazeComponent.extendComponent({ } }, + calendarOptions() { + return { + id: 'calendar-view', + defaultView: 'basicWeek', + header: { + left: 'title', + center: 'agendaDay,listDay,timelineDay agendaWeek,listWeek,timelineWeek month,timelineMonth timelineYear', + right: 'today prev,next', + }, + views: { + basic: { + // options apply to basicWeek and basicDay views + }, + agenda: { + // options apply to agendaWeek and agendaDay views + }, + week: { + // options apply to basicWeek and agendaWeek views + }, + day: { + // options apply to basicDay and agendaDay views + }, + }, + themeSystem: 'jquery-ui', + height: 'parent', + /* TODO: lists as resources: https://fullcalendar.io/docs/vertical-resource-view */ + navLinks: true, + nowIndicator: true, + businessHours: { + // days of week. an array of zero-based day of week integers (0=Sunday) + dow: [ 1, 2, 3, 4, 5 ], // Monday - Thursday + start: '8:00', + end: '18:00', + }, + locale: TAPi18n.getLanguage(), + events(start, end, timezone, callback) { + const currentBoard = Boards.findOne(Session.get('currentBoard')); + const events = []; + currentBoard.cardsInInterval(start.toDate(), end.toDate()).forEach(function(card){ + events.push({ + id: card.id, + title: card.title, + start: card.startAt, + end: card.endAt, + url: FlowRouter.url('card', { + boardId: currentBoard._id, + slug: currentBoard.slug, + cardId: card._id, + }), + }); + }); + callback(events); + }, + }; + }, + events() { return [{ // XXX The board-overlay div should probably be moved to the parent diff --git a/client/components/boards/boardHeader.js b/client/components/boards/boardHeader.js index 865bb212..2dfd58c1 100644 --- a/client/components/boards/boardHeader.js +++ b/client/components/boards/boardHeader.js @@ -90,9 +90,11 @@ BlazeComponent.extendComponent({ 'click .js-toggle-board-view'() { const currentUser = Meteor.user(); if (currentUser.profile.boardView === 'board-view-swimlanes') { - currentUser.setBoardView('board-view-lists'); + 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'); } }, 'click .js-open-filter-view'() { diff --git a/client/components/cards/cardDate.js b/client/components/cards/cardDate.js index c3e0524d..02ea09ae 100644 --- a/client/components/cards/cardDate.js +++ b/client/components/cards/cardDate.js @@ -218,10 +218,13 @@ class CardReceivedDate extends CardDate { } classes() { - let classes = 'received-date' + ' '; - if (this.date.get().isBefore(this.now.get(), 'minute') && - this.now.get().isBefore(this.data().dueAt)) { - classes += 'current'; + let classes = 'received-date '; + const dueAt = this.data().dueAt; + if (dueAt) { + if (this.date.get().isBefore(this.now.get(), 'minute') && + this.now.get().isBefore(dueAt)) { + classes += 'current'; + } } return classes; } @@ -249,9 +252,12 @@ class CardStartDate extends CardDate { classes() { let classes = 'start-date' + ' '; - if (this.date.get().isBefore(this.now.get(), 'minute') && - this.now.get().isBefore(this.data().dueAt)) { - classes += 'current'; + const dueAt = this.data().dueAt; + if (dueAt) { + if (this.date.get().isBefore(this.now.get(), 'minute') && + this.now.get().isBefore(dueAt)) { + classes += 'current'; + } } return classes; } @@ -279,18 +285,23 @@ class CardDueDate extends CardDate { classes() { let classes = 'due-date' + ' '; + // if endAt exists & is < dueAt, dueAt doesn't need to be flagged - if ((this.data().endAt !== 0) && - (this.data().endAt !== null) && - (this.data().endAt !== '') && - (this.data().endAt !== undefined) && - (this.date.get().isBefore(this.data().endAt))) + const endAt = this.data().endAt; + const theDate = this.date.get(); + const now = this.now.get(); + + if ((endAt !== 0) && + (endAt !== null) && + (endAt !== '') && + (endAt !== undefined) && + (theDate.isBefore(endAt))) classes += 'current'; - else if (this.now.get().diff(this.date.get(), 'days') >= 2) + else if (now.diff(theDate, 'days') >= 2) classes += 'long-overdue'; - else if (this.now.get().diff(this.date.get(), 'minute') >= 0) + else if (now.diff(theDate, 'minute') >= 0) classes += 'due'; - else if (this.now.get().diff(this.date.get(), 'days') >= -1) + else if (now.diff(theDate, 'days') >= -1) classes += 'almost-due'; return classes; } @@ -318,12 +329,16 @@ class CardEndDate extends CardDate { classes() { let classes = 'end-date' + ' '; - if (this.data.dueAt.diff(this.date.get(), 'days') >= 2) - classes += 'long-overdue'; - else if (this.data.dueAt.diff(this.date.get(), 'days') > 0) - classes += 'due'; - else if (this.data.dueAt.diff(this.date.get(), 'days') <= 0) - classes += 'current'; + const dueAt = this.data.dueAt; + if (dueAt) { + const diff = dueAt.diff(this.date.get(), 'days'); + if (diff >= 2) + classes += 'long-overdue'; + else if (diff > 0) + classes += 'due'; + else if (diff <= 0) + classes += 'current'; + } return classes; } diff --git a/client/components/cards/minicard.styl b/client/components/cards/minicard.styl index 6c9414a7..90429dff 100644 --- a/client/components/cards/minicard.styl +++ b/client/components/cards/minicard.styl @@ -5,7 +5,7 @@ position: relative display: flex align-items: center - margin-bottom: 9px + margin-bottom: 2px &.placeholder background: darken(white, 20%) @@ -37,7 +37,7 @@ flex-wrap: wrap background-color: #fff min-height: 20px - box-shadow: 0 1px 2px rgba(0,0,0,.15) + box-shadow: 0 0px 16px rgba(0,0,0,0.15) inset border-radius: 2px color: #4d4d4d overflow: hidden diff --git a/client/components/lists/listBody.js b/client/components/lists/listBody.js index 34aeb8a8..0a10f7d5 100644 --- a/client/components/lists/listBody.js +++ b/client/components/lists/listBody.js @@ -36,17 +36,14 @@ BlazeComponent.extendComponent({ const members = formComponent.members.get(); const labelIds = formComponent.labels.get(); const customFields = formComponent.customFields.get(); - //console.log('members', members); - //console.log('labelIds', labelIds); - //console.log('customFields', customFields); - const boardId = this.data().board()._id; + const boardId = this.data().board(); let swimlaneId = ''; const boardView = Meteor.user().profile.boardView; if (boardView === 'board-view-swimlanes') swimlaneId = this.parentComponent().parentComponent().data()._id; - else if (boardView === 'board-view-lists') - swimlaneId = this.data().board().getDefaultSwimline()._id; + else if ((boardView === 'board-view-lists') || (boardView === 'board-view-cal')) + swimlaneId = boardId.getDefaultSwimline()._id; if (title) { const _id = Cards.insert({ @@ -55,7 +52,7 @@ BlazeComponent.extendComponent({ labelIds, customFields, listId: this.data()._id, - boardId: this.data().board()._id, + boardId: boardId._id, sort: sortIndex, swimlaneId, }); diff --git a/client/components/settings/invitationCode.js b/client/components/settings/invitationCode.js index c02f860f..a403d8ab 100644 --- a/client/components/settings/invitationCode.js +++ b/client/components/settings/invitationCode.js @@ -1,6 +1,6 @@ Template.invitationCode.onRendered(() => { const setting = Settings.findOne(); - if (setting || setting.disableRegistration) { + if (!setting || !setting.disableRegistration) { $('#invitationcode').hide(); } }); diff --git a/client/components/swimlanes/swimlanes.js b/client/components/swimlanes/swimlanes.js index 7965c2bc..c67fe6af 100644 --- a/client/components/swimlanes/swimlanes.js +++ b/client/components/swimlanes/swimlanes.js @@ -7,6 +7,8 @@ function currentCardIsInThisList(listId, swimlaneId) { return currentCard && currentCard.listId === listId; else if (currentUser.profile.boardView === 'board-view-swimlanes') return currentCard && currentCard.listId === listId && currentCard.swimlaneId === swimlaneId; + else if (currentUser.profile.boardView === 'board-view-cal') + return currentCard; else return false; } diff --git a/client/components/users/userAvatar.jade b/client/components/users/userAvatar.jade index 83e2c8d0..df2ac461 100644 --- a/client/components/users/userAvatar.jade +++ b/client/components/users/userAvatar.jade @@ -17,7 +17,7 @@ template(name="userAvatar") template(name="userAvatarInitials") svg.avatar.avatar-initials(viewBox="0 0 {{viewPortWidth}} 15") - text(x="50%" y="13" text-anchor="middle")= initials + text(x="50%" y="50%" text-anchor="middle" alignment-baseline="central")= initials template(name="userPopup") .board-member-menu diff --git a/client/lib/inlinedform.js b/client/lib/inlinedform.js index 56768a13..e5e4d4ed 100644 --- a/client/lib/inlinedform.js +++ b/client/lib/inlinedform.js @@ -75,6 +75,16 @@ InlinedForm = BlazeComponent.extendComponent({ EscapeActions.register('inlinedForm', () => { currentlyOpenedForm.get().close(); }, () => { return currentlyOpenedForm.get() !== null; }, { - noClickEscapeOn: '.js-inlined-form', + enabledOnClick: false, } ); + +// submit on click outside +document.addEventListener('click', function(evt) { + const openedForm = currentlyOpenedForm.get(); + const isClickOutside = $(evt.target).closest('.js-inlined-form').length === 0; + if (openedForm && isClickOutside) { + $('.js-inlined-form button[type=submit]').click(); + openedForm.close(); + } +}, true); |