aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJames Lal <james@lightsofapollo.com>2012-07-08 13:51:20 -0700
committerJames Lal <james@lightsofapollo.com>2012-07-08 13:51:20 -0700
commit5a97196b49640117c546ad59cbfa31f974259f0b (patch)
treea27ea40a7d97043cc18e958266ff18aed8a68d34
parentdee456f357eb2c373988f7bc987eeabb8357050e (diff)
downloadjsCalDAV-5a97196b49640117c546ad59cbfa31f974259f0b.tar.gz
defaults for calendar query will now return data
-rw-r--r--lib/caldav/templates/calendar_data.js10
-rw-r--r--lib/caldav/templates/calendar_filter.js5
-rwxr-xr-xscripts/connect10
3 files changed, 23 insertions, 2 deletions
diff --git a/lib/caldav/templates/calendar_data.js b/lib/caldav/templates/calendar_data.js
index 2c24569..5fcc4e8 100644
--- a/lib/caldav/templates/calendar_data.js
+++ b/lib/caldav/templates/calendar_data.js
@@ -18,6 +18,10 @@
* @param {String} type iCal fieldset (VTODO, VEVENT,...).
*/
select: function(type, list) {
+ if (typeof(list) === 'undefined') {
+ list = true;
+ }
+
var struct = this.struct;
this._hasItems = true;
@@ -71,6 +75,10 @@
return output;
},
+ _defaultRender: function(template) {
+ return template.tag(['caldav', this.rootName]);
+ },
+
/**
* Renders CalendarData with a template.
*
@@ -79,7 +87,7 @@
*/
render: function(template) {
if (!this._hasItems) {
- return template.tag(['caldav', this.rootName]);
+ return this._defaultRender(template);
}
var struct = this.struct;
diff --git a/lib/caldav/templates/calendar_filter.js b/lib/caldav/templates/calendar_filter.js
index aebd9fe..a16f985 100644
--- a/lib/caldav/templates/calendar_filter.js
+++ b/lib/caldav/templates/calendar_filter.js
@@ -12,6 +12,11 @@
add: CalendarData.prototype.select,
+ _defaultRender: function(template) {
+ var inner = this._renderFieldset(template, { VCALENDAR: [{ VEVENT: true }] });
+ return template.tag(['caldav', this.rootName], inner);
+ },
+
compName: 'comp-filter',
rootName: 'filter'
};
diff --git a/scripts/connect b/scripts/connect
index d8a16ab..aa342f6 100755
--- a/scripts/connect
+++ b/scripts/connect
@@ -54,7 +54,15 @@ function getCalendarDetails(caluri) {
// found calendar home find calendars.
resources.send(function(err, data) {
- console.log(data);
+ var calendars = data.calendar;
+ var cal = calendars[Object.keys(calendars)[0]];
+ console.log(cal);
+ var query = cal.createQuery();
+
+ query.send(function(err, data, xhr) {
+ console.log(query.xhr.data);
+ console.log(err, data);
+ });
});
}