From bb01558c5ca39d2275793e274f37f4e3f4de6013 Mon Sep 17 00:00:00 2001 From: Josh Kurz Date: Thu, 14 Feb 2013 02:00:35 -0500 Subject: [PATCH 1/2] updated calendar to take eventSources --- index.html | 26 +++++++++++++++++--------- js/app.js | 14 +++++++++++--- 2 files changed, 28 insertions(+), 12 deletions(-) diff --git a/index.html b/index.html index 39b6371..9787d47 100644 --- a/index.html +++ b/index.html @@ -17,6 +17,7 @@ + @@ -345,9 +346,9 @@

What?

Attach Angular objects to a calendar.

Why?

For easy integration with scope objects.

-

Click to add an Event!

+ - -
+

How?

@@ -367,11 +367,17 @@

How?

<div ui-calendar="{height: 450,editable: true}" class="span8 calendar" ng-model="events"></div> function CalendarCtrl($scope) { - var date = new Date(); + var date = new Date(); var d = date.getDate(); var m = date.getMonth(); var y = date.getFullYear(); - + + $scope.eventSource = { + url: "http://www.google.com/calendar/feeds/usa__en%40holiday.calendar.google.com/public/basic", + className: 'gcal-event', // an option! + currentTimezone: 'America/Chicago' // an option! + }; + $scope.events = [ {title: 'All Day Event',start: new Date(y, m, 1)}, {title: 'Long Event',start: new Date(y, m, d - 5),end: new Date(y, m, d - 2)}, @@ -379,9 +385,11 @@

How?

{id: 999,title: 'Repeating Event',start: new Date(y, m, d + 4, 16, 0),allDay: false}, {title: 'Birthday Party',start: new Date(y, m, d + 1, 19, 0),end: new Date(y, m, d + 1, 22, 30),allDay: false}, {title: 'Click for Google',start: new Date(y, m, 28),end: new Date(y, m, 29),url: 'http://google.com/'} - ] + ]; + + $scope.eventSources = [$scope.events, $scope.eventSource]; - $scope.addChild = function() { + $scope.addEvent = function() { $scope.events.push({ title: 'Open Sesame', start: new Date(y, m, 28), diff --git a/js/app.js b/js/app.js index 1e31a72..f0cb15c 100644 --- a/js/app.js +++ b/js/app.js @@ -192,7 +192,13 @@ function CalendarCtrl($scope) { var d = date.getDate(); var m = date.getMonth(); var y = date.getFullYear(); - + + $scope.eventSource = { + url: "http://www.google.com/calendar/feeds/usa__en%40holiday.calendar.google.com/public/basic", + className: 'gcal-event', // an option! + currentTimezone: 'America/Chicago' // an option! + }; + $scope.events = [ {title: 'All Day Event',start: new Date(y, m, 1)}, {title: 'Long Event',start: new Date(y, m, d - 5),end: new Date(y, m, d - 2)}, @@ -200,9 +206,11 @@ function CalendarCtrl($scope) { {id: 999,title: 'Repeating Event',start: new Date(y, m, d + 4, 16, 0),allDay: false}, {title: 'Birthday Party',start: new Date(y, m, d + 1, 19, 0),end: new Date(y, m, d + 1, 22, 30),allDay: false}, {title: 'Click for Google',start: new Date(y, m, 28),end: new Date(y, m, 29),url: 'http://google.com/'} - ] + ]; + + $scope.eventSources = [$scope.events, $scope.eventSource]; - $scope.addChild = function() { + $scope.addEvent = function() { $scope.events.push({ title: 'Open Sesame', start: new Date(y, m, 28), From 5ca24fa307034ed9d3f8682eef0600ec25901321 Mon Sep 17 00:00:00 2001 From: Josh Kurz Date: Thu, 14 Feb 2013 03:52:36 -0500 Subject: [PATCH 2/2] uncommented add Event button --- index.html | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/index.html b/index.html index 9787d47..4fc051f 100644 --- a/index.html +++ b/index.html @@ -346,7 +346,7 @@

What?

Attach Angular objects to a calendar.

Why?

For easy integration with scope objects.

- +