Skip to content

Commit fd2f24b

Browse files
committed
Merge pull request #51 from joshkurz/master
updated CalendarCtrl to work with angular-ui v0.4.0
2 parents d59f185 + 5ca24fa commit fd2f24b

File tree

2 files changed

+26
-10
lines changed

2 files changed

+26
-10
lines changed

index.html

Lines changed: 15 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
<script src="http://fiddle.tinymce.com/tinymce/3.5.4.1/tiny_mce_jquery_src.js"></script>
1818
<script src="http://maps.googleapis.com/maps/api/js?sensor=false"></script>
1919
<script src="lib/calendar/fullcalendar.js"></script>
20+
<script src="http://arshaw.com/js/fullcalendar-1.5.3/fullcalendar/gcal.js"></script>
2021
<script src="js/app.js"></script>
2122

2223
<link rel="stylesheet" href="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.16/themes/base/jquery-ui.css">
@@ -347,7 +348,7 @@ <h3>Why?</h3>
347348
<p>For easy integration with scope objects.</p>
348349
<h4>Click to add an Event!</h4>
349350
</b>
350-
<button style="margin-bottom: 3px;" class="btn btn-primary" ng-click="addChild()">Add Child</button>
351+
<button style="margin-bottom: 3px;" class="btn btn-primary" ng-click="addEvent()">Add Event</button>
351352
<ul>
352353
<li ng-repeat="e in events">
353354
<p class="alert alert-info">
@@ -358,30 +359,37 @@ <h4>Click to add an Event!</h4>
358359
</ul>
359360

360361
</div>
361-
362-
<div ui-calendar="{height: 450,editable: true}" class="span8 calendar" ng-model="events"></div>
362+
<div ui-calendar="{height: 450,editable: true}" class="span8 calendar" ng-model="eventSources"></div>
363363
</div>
364364
</div>
365365
<h3>How?</h3>
366366
<pre class="prettyprint linenums">
367367
&lt;div ui-calendar="{height: 450,editable: true}" class="span8 calendar" ng-model="events"&gt;&lt;/div&gt;
368368

369369
function CalendarCtrl($scope) {
370-
var date = new Date();
370+
var date = new Date();
371371
var d = date.getDate();
372372
var m = date.getMonth();
373373
var y = date.getFullYear();
374-
374+
375+
$scope.eventSource = {
376+
url: "http://www.google.com/calendar/feeds/usa__en%40holiday.calendar.google.com/public/basic",
377+
className: 'gcal-event', // an option!
378+
currentTimezone: 'America/Chicago' // an option!
379+
};
380+
375381
$scope.events = [
376382
{title: 'All Day Event',start: new Date(y, m, 1)},
377383
{title: 'Long Event',start: new Date(y, m, d - 5),end: new Date(y, m, d - 2)},
378384
{id: 999,title: 'Repeating Event',start: new Date(y, m, d - 3, 16, 0),allDay: false},
379385
{id: 999,title: 'Repeating Event',start: new Date(y, m, d + 4, 16, 0),allDay: false},
380386
{title: 'Birthday Party',start: new Date(y, m, d + 1, 19, 0),end: new Date(y, m, d + 1, 22, 30),allDay: false},
381387
{title: 'Click for Google',start: new Date(y, m, 28),end: new Date(y, m, 29),url: 'http://google.com/'}
382-
]
388+
];
389+
390+
$scope.eventSources = [$scope.events, $scope.eventSource];
383391

384-
$scope.addChild = function() {
392+
$scope.addEvent = function() {
385393
$scope.events.push({
386394
title: 'Open Sesame',
387395
start: new Date(y, m, 28),

js/app.js

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -192,17 +192,25 @@ function CalendarCtrl($scope) {
192192
var d = date.getDate();
193193
var m = date.getMonth();
194194
var y = date.getFullYear();
195-
195+
196+
$scope.eventSource = {
197+
url: "http://www.google.com/calendar/feeds/usa__en%40holiday.calendar.google.com/public/basic",
198+
className: 'gcal-event', // an option!
199+
currentTimezone: 'America/Chicago' // an option!
200+
};
201+
196202
$scope.events = [
197203
{title: 'All Day Event',start: new Date(y, m, 1)},
198204
{title: 'Long Event',start: new Date(y, m, d - 5),end: new Date(y, m, d - 2)},
199205
{id: 999,title: 'Repeating Event',start: new Date(y, m, d - 3, 16, 0),allDay: false},
200206
{id: 999,title: 'Repeating Event',start: new Date(y, m, d + 4, 16, 0),allDay: false},
201207
{title: 'Birthday Party',start: new Date(y, m, d + 1, 19, 0),end: new Date(y, m, d + 1, 22, 30),allDay: false},
202208
{title: 'Click for Google',start: new Date(y, m, 28),end: new Date(y, m, 29),url: 'http://google.com/'}
203-
]
209+
];
210+
211+
$scope.eventSources = [$scope.events, $scope.eventSource];
204212

205-
$scope.addChild = function() {
213+
$scope.addEvent = function() {
206214
$scope.events.push({
207215
title: 'Open Sesame',
208216
start: new Date(y, m, 28),

0 commit comments

Comments
 (0)