Skip to content

Commit 2f88648

Browse files
committed
Merge pull request #29 from joshkurz/master
Added the Calendar Demo
2 parents 2940a8d + 4e6ff34 commit 2f88648

File tree

5 files changed

+5939
-3
lines changed

5 files changed

+5939
-3
lines changed

angular-ui

Submodule angular-ui updated from 0eac4de to e67bbce

index.html

Lines changed: 67 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
<script src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.16/jquery-ui.min.js"></script>
77

88
<script src="lib/bootstrap/docs/assets/js/bootstrap.min.js"></script>
9-
<script src="http://code.angularjs.org/1.0.1/angular-1.0.1.min.js"></script>
9+
<script src="http://code.angularjs.org/1.0.3/angular.js"></script>
1010
<script src="angular-ui/build/angular-ui.js"></script>
1111
<script src="js/prettify.js"></script>
1212
<script src="lib/maskedinput/jquery.maskedinput.js"></script>
@@ -16,6 +16,7 @@
1616
<script src="http://fiddle.tinymce.com/tinymce/3.5.4.1/jquery.tinymce.js"></script>
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>
19+
<script src="lib/calendar/fullcalendar.js"></script>
1920
<script src="js/app.js"></script>
2021

2122
<link rel="stylesheet" href="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.16/themes/base/jquery-ui.css">
@@ -25,14 +26,15 @@
2526
<link rel="stylesheet" href="lib/select2/select2.css" >
2627
<link rel="stylesheet" href="lib/CodeMirror/lib/codemirror.css" >
2728
<link rel="stylesheet" href="lib/CodeMirror/theme/monokai.css" >
29+
<link rel="stylesheet" href="lib/calendar/fullcalendar.css" >
2830
<link rel="stylesheet" href="css/app.css" >
2931
</head>
3032
<body data-spy="scroll">
3133
<header class="navbar navbar-fixed-top">
3234
<div class="navbar-inner">
3335
<div class="container">
3436
<div class="dropdown">
35-
<a class="brand dropdown-toggle" role="button" data-toggle="dropdown">
37+
<a class="brand dropdown-toggle" role="button" data-toggle="dropdown">
3638
AngularUI
3739
<b class="caret"></b>
3840
</a>
@@ -60,6 +62,7 @@
6062
<li><a scrollto href="#directives-codemirror">CodeMirror IDE</a></li>
6163
<li><a scrollto href="#directives-event">Event Binder</a></li>
6264
<li><a scrollto href="#directives-map">Google Maps</a></li>
65+
<li><a scrollto href="#directives-calendar">Calendar</a></li>
6366
<li><a scrollto href="#directives-date">Date</a></li>
6467
<li><a scrollto href="#directives-keypress">Keypress</a></li>
6568
<li><a scrollto href="#directives-mask">Mask</a></li>
@@ -263,6 +266,68 @@ <h3>How?</h3>
263266
</div>
264267
</section>
265268

269+
<section id="directives-calendar" ng-controller="CalendarCtrl">
270+
<div class="page-header">
271+
<h1>Calendar</h1>
272+
</div>
273+
<div class="well">
274+
<div class="row">
275+
<div class="span3">
276+
<h3>What?</h3>
277+
<p>Attach Angular objects to a calendar.</p>
278+
<h3>Why?</h3>
279+
<p>For easy integration with scope objects.</p>
280+
<h4>Click to add an Event!</h4>
281+
</b>
282+
<button style="margin-bottom: 3px;" class="btn btn-primary" ng-click="addChild()">Add Child</button>
283+
<ul>
284+
<li ng-repeat="e in events">
285+
<p class="alert alert-info">
286+
{{e.title}}
287+
<a style="float: right; margin-top: -5px;" class="btn btn-danger" ng-click="remove($index)">x</a>
288+
</p>
289+
</li>
290+
</ul>
291+
292+
</div>
293+
294+
<div ui-calendar="{height: 450,editable: true}" class="span8 calendar" ng-model="events"></div>
295+
</div>
296+
</div>
297+
<h3>How?</h3>
298+
<pre class="prettyprint linenums">
299+
&lt;div ui-calendar="{height: 450,editable: true}" class="span8 calendar" ng-model="events"&gt;&lt;/div&gt;
300+
301+
function CalendarCtrl($scope) {
302+
var date = new Date();
303+
var d = date.getDate();
304+
var m = date.getMonth();
305+
var y = date.getFullYear();
306+
307+
$scope.events = [
308+
{title: 'All Day Event',start: new Date(y, m, 1)},
309+
{title: 'Long Event',start: new Date(y, m, d - 5),end: new Date(y, m, d - 2)},
310+
{id: 999,title: 'Repeating Event',start: new Date(y, m, d - 3, 16, 0),allDay: false},
311+
{id: 999,title: 'Repeating Event',start: new Date(y, m, d + 4, 16, 0),allDay: false},
312+
{title: 'Birthday Party',start: new Date(y, m, d + 1, 19, 0),end: new Date(y, m, d + 1, 22, 30),allDay: false},
313+
{title: 'Click for Google',start: new Date(y, m, 28),end: new Date(y, m, 29),url: 'http://google.com/'}
314+
]
315+
316+
$scope.addChild = function() {
317+
$scope.events.push({
318+
title: 'Open Sesame',
319+
start: new Date(y, m, 28),
320+
end: new Date(y, m, 29)
321+
});
322+
}
323+
324+
$scope.remove = function(index) {
325+
$scope.events.splice(index,1);
326+
}
327+
}
328+
</pre>
329+
</section>
330+
266331
<section id="directives-map" ng-controller="MapCtrl">
267332
<div class="page-header">
268333
<h1>Google Maps</h1>

js/app.js

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -142,4 +142,32 @@ function FormatCtrl($scope) {
142142
}
143143
};
144144
}
145+
146+
function CalendarCtrl($scope) {
147+
var date = new Date();
148+
var d = date.getDate();
149+
var m = date.getMonth();
150+
var y = date.getFullYear();
151+
152+
$scope.events = [
153+
{title: 'All Day Event',start: new Date(y, m, 1)},
154+
{title: 'Long Event',start: new Date(y, m, d - 5),end: new Date(y, m, d - 2)},
155+
{id: 999,title: 'Repeating Event',start: new Date(y, m, d - 3, 16, 0),allDay: false},
156+
{id: 999,title: 'Repeating Event',start: new Date(y, m, d + 4, 16, 0),allDay: false},
157+
{title: 'Birthday Party',start: new Date(y, m, d + 1, 19, 0),end: new Date(y, m, d + 1, 22, 30),allDay: false},
158+
{title: 'Click for Google',start: new Date(y, m, 28),end: new Date(y, m, 29),url: 'http://google.com/'}
159+
]
160+
161+
$scope.addChild = function() {
162+
$scope.events.push({
163+
title: 'Open Sesame',
164+
start: new Date(y, m, 28),
165+
end: new Date(y, m, 29)
166+
});
167+
}
168+
169+
$scope.remove = function(index) {
170+
$scope.events.splice(index,1);
171+
}
172+
}
145173
/* EOF */

0 commit comments

Comments
 (0)