Skip to content

Instantly share code, notes, and snippets.

@fxdgear
Created November 20, 2012 23:42
Show Gist options
  • Save fxdgear/4122046 to your computer and use it in GitHub Desktop.
Save fxdgear/4122046 to your computer and use it in GitHub Desktop.
{
events: function(start, end, callback) {
$.ajax({
url: '{% url api_dispatch_list resource_name="coachactivitypost" api_name="v1" %}',
dataType: 'json',
type: 'GET',
data: {
start_time__gte: dateFormat(start, "yyyy-mm-dd"),
start_time__lt: dateFormat(end, "yyyy-mm-dd"),
status: 4,
author:{{object.pk}}
},
success: function(data, success, xf) {
var events = [];
var distance = 0;
$.each(data.objects, function() {
if (this.distance){
distance += Math.round(this.distance);
}
events.push({
id: this.resource_uri,
title: this.title,
start: this.start_time,
end: this.end,
url: this.url,
allDay: false,
})
});
$('#id-sched-count').text(events.length);
value = Math.round(0.000621371 * distance);
$('#id-distance-sched').text(Math.round( value ));
callback(events);
}
});
// ...
},
color: 'yellow', // an option!
textColor: 'black' // an option!
},
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment