mirror of
https://github.com/wekan/wekan.git
synced 2025-09-22 01:50:48 +02:00
Show cards in calendar
This commit is contained in:
parent
226d25ca94
commit
18467dfe40
5 changed files with 87 additions and 1 deletions
|
@ -85,3 +85,4 @@ cfs:gridfs
|
||||||
browser-policy
|
browser-policy
|
||||||
eluck:accounts-lockout
|
eluck:accounts-lockout
|
||||||
rzymek:fullcalendar
|
rzymek:fullcalendar
|
||||||
|
momentjs:moment@2.22.2
|
||||||
|
|
|
@ -103,7 +103,7 @@ mixmax:smart-disconnect@0.0.4
|
||||||
mobile-status-bar@1.0.14
|
mobile-status-bar@1.0.14
|
||||||
modules@0.11.0
|
modules@0.11.0
|
||||||
modules-runtime@0.9.1
|
modules-runtime@0.9.1
|
||||||
momentjs:moment@2.8.4
|
momentjs:moment@2.22.2
|
||||||
mongo@1.3.1
|
mongo@1.3.1
|
||||||
mongo-dev-server@1.1.0
|
mongo-dev-server@1.1.0
|
||||||
mongo-id@1.0.6
|
mongo-id@1.0.6
|
||||||
|
|
|
@ -25,3 +25,5 @@ template(name="boardBody")
|
||||||
+swimlane(this)
|
+swimlane(this)
|
||||||
if isViewLists
|
if isViewLists
|
||||||
+listsGroup
|
+listsGroup
|
||||||
|
if isViewCalendar
|
||||||
|
+fullcalendar(calendarOptions)
|
||||||
|
|
|
@ -114,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() {
|
events() {
|
||||||
return [{
|
return [{
|
||||||
// XXX The board-overlay div should probably be moved to the parent
|
// XXX The board-overlay div should probably be moved to the parent
|
||||||
|
|
|
@ -284,6 +284,33 @@ Boards.helpers({
|
||||||
|
|
||||||
return Cards.find(query, projection);
|
return Cards.find(query, projection);
|
||||||
},
|
},
|
||||||
|
|
||||||
|
cardsInInterval(start, end) {
|
||||||
|
return Cards.find({
|
||||||
|
$or: [
|
||||||
|
{
|
||||||
|
startAt: {
|
||||||
|
$lte: start,
|
||||||
|
}, endAt: {
|
||||||
|
$gte: start,
|
||||||
|
},
|
||||||
|
}, {
|
||||||
|
startAt: {
|
||||||
|
$lte: end,
|
||||||
|
}, endAt: {
|
||||||
|
$gte: end,
|
||||||
|
},
|
||||||
|
}, {
|
||||||
|
startAt: {
|
||||||
|
$gte: start,
|
||||||
|
}, endAt: {
|
||||||
|
$lte: end,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
],
|
||||||
|
});
|
||||||
|
},
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
Boards.mutations({
|
Boards.mutations({
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue