-
-
Notifications
You must be signed in to change notification settings - Fork 55
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
added monthly view / calendar and project color field
- Loading branch information
1 parent
eb2c1e4
commit 7238588
Showing
21 changed files
with
2,051 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
<template name="calendar"> | ||
<div class="row"> | ||
<div id="cal"> | ||
</div> | ||
</div> | ||
</template> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
import { Meteor } from 'meteor/meteor' | ||
import { Template } from 'meteor/templating' | ||
import moment from 'moment' | ||
import Timecards from '../../api/timecards/timecards.js' | ||
import './calendar.html' | ||
import 'fullcalendar' | ||
import 'fullcalendar/dist/fullcalendar.css' | ||
|
||
|
||
Template.calendar.onRendered(function trackmonthRendered() { | ||
let self = this; | ||
This comment has been minimized.
Sorry, something went wrong. |
||
self.fc = $('#cal'); | ||
self.autorun(() => { | ||
//let periodTimecardsSub = self.subscribe('periodTimecards', {startDate: moment().startOf('month').toDate(), endDate: moment().endOf('month').toDate(), userId: 'all'}) | ||
self.fc.fullCalendar({ | ||
header: { center: 'month,basicWeek' }, | ||
events: function (start, end, tz, callback) { | ||
//subscribe only to specified date range | ||
self.periodTimecardsSub = self.subscribe('periodTimecards', {startDate: start.toDate(), endDate: end.toDate(), userId: 'all'}) | ||
//find all, because we've already subscribed to a specific range | ||
var events = Timecards.find().map(function (it) { | ||
return { | ||
title: it.task, | ||
start: it.date, | ||
allDay: true | ||
}; | ||
}); | ||
callback(events); | ||
} | ||
}) | ||
if (self.periodTimecardsSub.ready()) { | ||
self.fc.fullCalendar('refetchEvents'); | ||
} | ||
}) | ||
}) | ||
/* | ||
Template.calendar.helpers({ | ||
events: function () { | ||
var fc = $('#cal'); | ||
return function (start, end, tz, callback) { | ||
//subscribe only to specified date range | ||
Meteor.subscribe('periodTimecards', start.toDate(), end.toDate(), 'all', function () { | ||
//trigger event rendering when collection is downloaded | ||
fc.fullCalendar('refetchEvents'); | ||
}); | ||
//find all, because we've already subscribed to a specific range | ||
var events = Timecards.find().map(function (it) { | ||
return { | ||
title: it.date.toISOString(), | ||
start: it.date, | ||
allDay: true | ||
}; | ||
}); | ||
console.log(events) | ||
callback(events); | ||
}; | ||
}, | ||
onEventClicked: function() { | ||
return function(calEvent, jsEvent, view) { | ||
alert("Event clicked: "+calEvent.title); | ||
} | ||
} | ||
}); | ||
*/ |
Oops, something went wrong.
@philogosoph self = this assignments are not needed with ecmascript 2015 arrow functions as used below