diff options
author | Lauri Ojansivu <x@xet7.org> | 2018-06-27 23:55:06 +0300 |
---|---|---|
committer | Lauri Ojansivu <x@xet7.org> | 2018-06-27 23:55:06 +0300 |
commit | 72d0db7a5919caf4c1c18a4bc1a6f22c372c2835 (patch) | |
tree | 5aaa4d76c8e454d30cf3d5862a689ebfce62d1da /client/components/boards | |
parent | ed0ef5b7d348df3fd1671ac44bfc8be41a296514 (diff) | |
parent | 0394a78ecea21c0174dd0b6f1d9d31947fa3b48e (diff) | |
download | wekan-72d0db7a5919caf4c1c18a4bc1a6f22c372c2835.tar.gz wekan-72d0db7a5919caf4c1c18a4bc1a6f22c372c2835.tar.bz2 wekan-72d0db7a5919caf4c1c18a4bc1a6f22c372c2835.zip |
Merge branch 'calendar' of https://github.com/TNick/wekan into TNick-calendar
Diffstat (limited to 'client/components/boards')
-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 |
3 files changed, 67 insertions, 1 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 b2640474..222cc404 100644 --- a/client/components/boards/boardHeader.js +++ b/client/components/boards/boardHeader.js @@ -89,9 +89,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'() { |