forked from 10KB/angular-clndr
-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
166 lines (161 loc) · 8.16 KB
/
index.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>AngularJS Clndr Directive</title>
<link href="//maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css" rel="stylesheet">
<link href="angular-clndr.css" rel="stylesheet">
<style>
body {
margin-top: 1em;
}
p {
line-height: 24px;
}
</style>
</head>
<body class="container">
<div class="row">
<div class="col-lg-10 col-lg-offset-1 col-md-12">
<div class="jumbotron">
<h1>angular-clndr</h1>
<p>Angular directive for CLNDR.js</p>
</div>
<div class="row">
<div class="col-md-12">
<h2>Getting Started</h2>
<ol>
<li>Install with bower: <code>bower install --save angular-clndr</code></li>
<li>Include <code>angular-clndr.js</code>.</li>
<li>Make sure to include all CLNDR.js dependencies.</li>
<li>Add <code>tien.clndr</code> to you app modules.</li>
<li>Use the <code>tien-clndr</code> directive.</li>
</ol>
If you don't like package managers, you can also directly download
<a href="./angular-clndr.js">angular-clndr.js</a> or
<a href="./angular-clndr.min.js">angular-clndr.min.js</a>.
</div>
</div>
<hr>
<div class="row" ng-app="clndrApp">
<div class="col-md-12" ng-controller="DemoCtrl">
<h2>Demo</h2>
<tien-clndr class="clndr" tien-clndr-object="clndr" tien-clndr-events="events" tien-clndr-options="options">
<div class="clndr-controls">
<div class="clndr-previous-button" ng-click="clndr.back()">
‹
</div>
<div class="month">
{{month}}
</div>
<div class="clndr-next-button" ng-click="clndr.forward()">
›
</div>
</div>
<div class="clndr-grid">
<div class="days-of-the-week">
<div class="header-day" ng-repeat="day in daysOfTheWeek track by $index">
{{day}}
</div>
</div>
<div class="days">
<div class="{{day.classes}}" ng-repeat="day in days">
<div class="event-indicator" ng-show="day.events.length" ng-click="showEvents(day.events)">{{day.events.length}}</div>
{{day.day}}
</div>
</div>
</div>
</tien-clndr>
</div>
</div>
<script src="//ajax.googleapis.com/ajax/libs/jquery/2.1.4/jquery.min.js"></script>
<script src="//ajax.googleapis.com/ajax/libs/angularjs/1.4.1/angular.min.js"></script>
<script src="//kylestetz.github.io/CLNDR/js/moment.js"></script>
<script src="//kylestetz.github.io/CLNDR/js/clndr.js"></script>
<script src="angular-clndr.js"></script>
<script>
app = angular.module('clndrApp', ['tien.clndr']);
app.controller('DemoCtrl', function ($scope) {
$scope.options = {
weekOffset: 1,
daysOfTheWeek: ['ZO', 'MA', 'DI', 'WO', 'DO', 'VR', 'ZA'],
constraints: {
startDate: moment().subtract(1, 'months').format('YYYY-MM-15'),
endDate: moment().add(2, 'months').format('YYYY-MM-15')
}
};
$scope.events = [
{ date: moment().add(3, 'days').format(), title: "Happy days" },
{ date: moment().subtract(5, 'days').format(), title: "Good old days" },
{ date: moment().subtract(5, 'days').format(), title: "And some more" }
];
$scope.showEvents = function(events) {
alert(events.map(function(e) { return e.title }).join("\n"));
};
});
</script>
<hr>
<div class="row">
<div class="col-md-12">
<h2>Usage</h2>
<p>
Use the <code>tien-clndr</code> directive as element, all childs of this element have
CLNDR.js data available on the object provided with the <code>tien-clndr-object</code>
attributes. With this object on the child's scope, you can for example ng-repeat over the
days and render the template Angular-style.
</p>
<p>
Optionally pass an <a href="https://github.com/kylestetz/CLNDR#pass-in-your-events">array of events</a>
to the directive with the <code>tien-clndr-events</code> attribute. Events are available
on the scope at <code>day.events</code>, as shown in the example below:
</p>
<p>
To pass additional options on initialization of CLNDR, provide an options object to the
<code>tien-clndr-options</code> attribute. See <a href="https://github.com/kylestetz/CLNDR#usage">CLNDR Usage</a>
for all possible settings. Heads up: the <code>tien-clndr-options</code> object is only read
once during transclusion!
</p>
<pre><code><tien-clndr class="clndr" tien-clndr-object="clndr" tien-clndr-events="events">
<div class="clndr-controls">
<div class="clndr-previous-button" ng-click="clndr.back()">
&lsaquo;
</div>
<div class="month">
{{month}}
</div>
<div class="clndr-next-button" ng-click="clndr.forward()">
&rsaquo;
</div>
</div>
<div class="clndr-grid">
<div class="days-of-the-week">
<div class="header-day" ng-repeat="day in daysOfTheWeek track by $index">
{{day}}
</div>
</div>
<div class="days">
<div class="{{day.classes}}" ng-repeat="day in days">
<div class="event-indicator" ng-show="day.events.length" ng-click="showEvents(day.events)">{{day.events.length}}</div>
{{day.day}}
</div>
</div>
</div>
</tien-clndr></code></pre>
</div>
</div>
<hr>
<div class="row">
<div class="col-md-12">
<p class="text-center">
angular-clndr 0.3.0 · Created by <a href="http://10kb.nl/">10KB</a><br>
Based on <a href="http://kylestetz.github.io/CLNDR/">CLNDR.js</a>.
</p>
<p class="text-center">
<a href="https://github.com/10KB/angular-clndr">GitHub Project</a>
</p>
</div>
</div>
</div>
</div>
</body>
</html>