├── .gitignore ├── CNAME ├── Gruntfile.coffee ├── angular-clndr.css ├── angular-clndr.css.map ├── angular-clndr.js ├── angular-clndr.min.js ├── bower.json ├── index.html ├── package.json ├── readme.md └── src ├── angular-clndr.coffee └── angular-clndr.sass /.gitignore: -------------------------------------------------------------------------------- 1 | # jetbrains 2 | idea/ 3 | /*.iml 4 | 5 | # osx 6 | .DS_Store 7 | .AppleDouble 8 | .LSOverride 9 | 10 | # windows 11 | Thumbs.db 12 | ehthumbs.db 13 | Desktop.ini 14 | 15 | # node 16 | logs 17 | *.log 18 | pids 19 | *.pid 20 | *.seed 21 | lib-cov 22 | coverage 23 | .grunt 24 | build/Release 25 | node_modules 26 | .lock-wscript 27 | 28 | # sass 29 | .sass-cache 30 | 31 | # bower 32 | bower_components/ 33 | build/ 34 | dist/ -------------------------------------------------------------------------------- /CNAME: -------------------------------------------------------------------------------- 1 | angular-clndr.10kb.nl -------------------------------------------------------------------------------- /Gruntfile.coffee: -------------------------------------------------------------------------------- 1 | module.exports = (grunt) -> 2 | require('load-grunt-tasks')(grunt) 3 | 4 | grunt.initConfig 5 | pkg: grunt.file.readJSON('package.json') 6 | 7 | connect: 8 | server: 9 | options: 10 | keepalive: true 11 | 12 | coffee: 13 | dist: 14 | src: './src/angular-clndr.coffee' 15 | dest: './angular-clndr.js' 16 | 17 | sass: 18 | dist: 19 | src: './src/angular-clndr.sass' 20 | dest: './angular-clndr.css' 21 | 22 | ngAnnotate: 23 | dist: 24 | src: './angular-clndr.js' 25 | dest: './angular-clndr.js' 26 | 27 | uglify: 28 | options: 29 | preserveComments: 'some' 30 | dist: 31 | src: './angular-clndr.js' 32 | dest: './angular-clndr.min.js' 33 | 34 | watch: 35 | coffee: 36 | files: './src/angular-clndr.coffee' 37 | tasks: ['coffee'] 38 | sass: 39 | files: './src/angular-clndr.sass' 40 | tasks: ['sass'] 41 | 42 | grunt.registerTask('default', ['coffee', 'ngAnnotate', 'uglify', 'sass']) 43 | grunt.registerTask('server', ['default', 'connect', 'watch']) -------------------------------------------------------------------------------- /angular-clndr.css: -------------------------------------------------------------------------------- 1 | .clndr { 2 | display: block; 3 | margin: 0 auto; 4 | max-width: 400px; } 5 | .clndr .clndr-controls { 6 | border-bottom: 1px solid #ccc; 7 | position: relative; } 8 | .clndr .clndr-controls .month { 9 | padding: 12px 0; 10 | text-align: center; } 11 | .clndr .clndr-controls .clndr-previous-button, .clndr .clndr-controls .clndr-next-button { 12 | cursor: pointer; 13 | top: 0px; 14 | left: 0px; 15 | padding: 12px; 16 | position: absolute; } 17 | .clndr .clndr-controls .clndr-next-button { 18 | left: auto; 19 | right: 0px; } 20 | .clndr .clndr-grid .days-of-the-week { 21 | width: 100%; } 22 | .clndr .clndr-grid .days-of-the-week .header-day { 23 | float: left; 24 | width: 14.28571%; 25 | padding: 12px 0; 26 | text-align: center; } 27 | .clndr .days .day, .clndr .days .empty { 28 | float: left; 29 | width: 14.28571%; 30 | padding: 12px 0; 31 | position: relative; 32 | text-align: center; } 33 | .clndr .days .day.today, .clndr .days .empty.today { 34 | background-color: #ccc; } 35 | .clndr .days .day .event-indicator, .clndr .days .empty .event-indicator { 36 | background-color: #3BB7E8; 37 | border-radius: 100%; 38 | color: #fff; 39 | cursor: pointer; 40 | font-size: 9px; 41 | height: 15px; 42 | line-height: 16px; 43 | position: absolute; 44 | right: 0px; 45 | top: 0px; 46 | width: 15px; } 47 | .clndr .days .day.adjacent-month, .clndr .days .day.inactive, .clndr .days .empty.adjacent-month, .clndr .days .empty.inactive { 48 | opacity: 0.3; } 49 | 50 | /*# sourceMappingURL=angular-clndr.css.map */ 51 | -------------------------------------------------------------------------------- /angular-clndr.css.map: -------------------------------------------------------------------------------- 1 | { 2 | "version": 3, 3 | "mappings": "AAAA,MAAM;EACJ,OAAO,EAAE,KAAK;EACd,MAAM,EAAE,MAAM;EACd,SAAS,EAAE,KAAK;EAEhB,sBAAe;IACb,aAAa,EAAE,cAAc;IAC7B,QAAQ,EAAE,QAAQ;IAElB,6BAAM;MACJ,OAAO,EAAE,MAAM;MACf,UAAU,EAAE,MAAM;IAEpB,wFAA0C;MACxC,MAAM,EAAE,OAAO;MACf,GAAG,EAAE,GAAG;MACR,IAAI,EAAE,GAAG;MACT,OAAO,EAAE,IAAI;MACb,QAAQ,EAAE,QAAQ;IAEpB,yCAAkB;MAChB,IAAI,EAAE,IAAI;MACV,KAAK,EAAE,GAAG;EAGZ,oCAAiB;IACf,KAAK,EAAE,IAAI;IAEX,gDAAW;MACT,KAAK,EAAE,IAAI;MACX,KAAK,EAAE,SAAS;MAChB,OAAO,EAAE,MAAM;MACf,UAAU,EAAE,MAAM;EAGtB,sCAAY;IACV,KAAK,EAAE,IAAI;IACX,KAAK,EAAE,SAAS;IAChB,OAAO,EAAE,MAAM;IACf,QAAQ,EAAE,QAAQ;IAClB,UAAU,EAAE,MAAM;IAElB,kDAAO;MACL,gBAAgB,EAAE,IAAI;IAExB,wEAAgB;MACd,gBAAgB,EAAE,OAAO;MACzB,aAAa,EAAE,IAAI;MACnB,KAAK,EAAE,IAAI;MACX,MAAM,EAAE,OAAO;MACf,SAAS,EAAE,GAAG;MACd,MAAM,EAAE,IAAI;MACZ,WAAW,EAAE,IAAI;MACjB,QAAQ,EAAE,QAAQ;MAClB,KAAK,EAAE,GAAG;MACV,GAAG,EAAE,GAAG;MACR,KAAK,EAAE,IAAI;IAEb,8HAA4B;MAC1B,OAAO,EAAE,GAAG", 4 | "sources": ["src/angular-clndr.sass"], 5 | "names": [], 6 | "file": "angular-clndr.css" 7 | } 8 | -------------------------------------------------------------------------------- /angular-clndr.js: -------------------------------------------------------------------------------- 1 | 2 | /*! 3 | * angular-clndr 0.3.0 4 | * 10KB, http://10kb.nl/ 5 | * License: MIT 6 | */ 7 | 8 | (function() { 9 | var TienClndrDirective, module; 10 | 11 | module = angular.module('tien.clndr', []); 12 | 13 | TienClndrDirective = function() { 14 | var controller, scope; 15 | scope = { 16 | clndr: '=tienClndrObject', 17 | events: '=tienClndrEvents', 18 | options: '=?tienClndrOptions' 19 | }; 20 | controller = [ 21 | "$scope", "$element", "$attrs", "$transclude", function($scope, $element, $attrs, $transclude) { 22 | return $transclude(function(clone, scope) { 23 | var options, render; 24 | $element.append(clone); 25 | $scope.$watch('events', function(val) { 26 | return $scope.clndr.setEvents(angular.copy(val || [])); 27 | }); 28 | render = function(data) { 29 | return angular.extend(scope, data); 30 | }; 31 | options = angular.extend($scope.options || {}, { 32 | render: render 33 | }); 34 | return $scope.clndr = angular.element("
").clndr(options); 35 | }); 36 | } 37 | ]; 38 | return { 39 | restrict: 'E', 40 | replace: true, 41 | transclude: true, 42 | scope: scope, 43 | controller: controller 44 | }; 45 | }; 46 | 47 | module.directive('tienClndr', TienClndrDirective); 48 | 49 | }).call(this); 50 | -------------------------------------------------------------------------------- /angular-clndr.min.js: -------------------------------------------------------------------------------- 1 | /*! 2 | * angular-clndr 0.3.0 3 | * 10KB, http://10kb.nl/ 4 | * License: MIT 5 | */ 6 | (function(){var a,b;b=angular.module("tien.clndr",[]),a=function(){var a,b;return b={clndr:"=tienClndrObject",events:"=tienClndrEvents",options:"=?tienClndrOptions"},a=["$scope","$element","$attrs","$transclude",function(a,b,c,d){return d(function(c,d){var e,f;return b.append(c),a.$watch("events",function(b){return a.clndr.setEvents(angular.copy(b||[]))}),f=function(a){return angular.extend(d,a)},e=angular.extend(a.options||{},{render:f}),a.clndr=angular.element("
").clndr(e)})}],{restrict:"E",replace:!0,transclude:!0,scope:b,controller:a}},b.directive("tienClndr",a)}).call(this); -------------------------------------------------------------------------------- /bower.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "angular-clndr", 3 | "description": "Angular directive for the CLNDR.js package.", 4 | "author": "10KB", 5 | "main": ["./angular-clndr.js", "./angular-clndr.css"], 6 | "ignore": [ 7 | "src", 8 | "Gruntfile.coffee", 9 | "package.json", 10 | "CNAME" 11 | ], 12 | "dependencies": { 13 | "angular": ">=1", 14 | "clndr": ">=1.2" 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | AngularJS Clndr Directive 6 | 7 | 8 | 16 | 17 | 18 |
19 |
20 |
21 |

angular-clndr

22 | 23 |

Angular directive for CLNDR.js

24 |
25 |
26 |
27 |

Getting Started

28 |
    29 |
  1. Install with bower: bower install --save angular-clndr
  2. 30 |
  3. Include angular-clndr.js.
  4. 31 |
  5. Make sure to include all CLNDR.js dependencies.
  6. 32 |
  7. Add tien.clndr to you app modules.
  8. 33 |
  9. Use the tien-clndr directive.
  10. 34 |
35 | 36 | If you don't like package managers, you can also directly download 37 | angular-clndr.js or 38 | angular-clndr.min.js. 39 |
40 |
41 |
42 |
43 |
44 |

Demo

45 | 46 | 47 |
48 |
49 | ‹ 50 |
51 |
52 | {{month}} 53 |
54 |
55 | › 56 |
57 |
58 |
59 |
60 |
61 | {{day}} 62 |
63 |
64 |
65 |
66 |
{{day.events.length}}
67 | {{day.day}} 68 |
69 |
70 |
71 |
72 |
73 |
74 | 75 | 76 | 77 | 78 | 79 | 80 | 101 | 102 |
103 |
104 |
105 |

Usage

106 |

107 | Use the tien-clndr directive as element, all childs of this element have 108 | CLNDR.js data available on the object provided with the tien-clndr-object 109 | attributes. With this object on the child's scope, you can for example ng-repeat over the 110 | days and render the template Angular-style. 111 |

112 |

113 | Optionally pass an array of events 114 | to the directive with the tien-clndr-events attribute. Events are available 115 | on the scope at day.events, as shown in the example below: 116 |

117 |

118 | To pass additional options on initialization of CLNDR, provide an options object to the 119 | tien-clndr-options attribute. See CLNDR Usage 120 | for all possible settings. Heads up: the tien-clndr-options object is only read 121 | once during transclusion! 122 |

123 |
<tien-clndr class="clndr" tien-clndr-object="clndr" tien-clndr-events="events">
124 |   <div class="clndr-controls">
125 |     <div class="clndr-previous-button" ng-click="clndr.back()">
126 |       &lsaquo;
127 |     </div>
128 |     <div class="month">
129 |       {{month}}
130 |     </div>
131 |     <div class="clndr-next-button" ng-click="clndr.forward()">
132 |       &rsaquo;
133 |     </div>
134 |   </div>
135 |   <div class="clndr-grid">
136 |     <div class="days-of-the-week">
137 |       <div class="header-day" ng-repeat="day in daysOfTheWeek track by $index">
138 |         {{day}}
139 |       </div>
140 |     </div>
141 |     <div class="days">
142 |       <div class="{{day.classes}}" ng-repeat="day in days">
143 |         <div class="event-indicator" ng-show="day.events.length" ng-click="showEvents(day.events)">{{day.events.length}}</div>
144 |         {{day.day}}
145 |       </div>
146 |     </div>
147 |   </div>
148 | </tien-clndr>
149 |
150 |
151 |
152 |
153 |
154 |

155 | angular-clndr 0.3.0 · Created by 10KB
156 | Based on CLNDR.js. 157 |

158 |

159 | GitHub Project 160 |

161 |
162 |
163 |
164 |
165 | 166 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "angular-clndr", 3 | "author": "10KB", 4 | "repository": "https://github.com/10kb/angular-clndr.git", 5 | "licenses": [ 6 | { 7 | "type": "MIT", 8 | "url": "http://10kb.mit-license.org" 9 | } 10 | ], 11 | "dependencies": {}, 12 | "devDependencies": { 13 | "grunt": "~0.4.5", 14 | "grunt-contrib-coffee": "^0.11.0", 15 | "grunt-contrib-connect": "~0.8.0", 16 | "grunt-contrib-sass": "^0.7.4", 17 | "grunt-contrib-uglify": "^0.5.1", 18 | "grunt-contrib-watch": "^0.6.1", 19 | "grunt-ng-annotate": "^0.3.2", 20 | "load-grunt-tasks": "^0.6.0" 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /readme.md: -------------------------------------------------------------------------------- 1 | angular-clndr 2 | ============= 3 | 4 | An angular directive for [CLNDR.js](https://kylestetz.github.io/CLNDR/). With this directive you can render the 5 | CLNDR-template Angular-style. 6 | 7 | Brought to you by [10KB](https://10kb.nl/). 8 | 9 | ## Demo 10 | 11 | You can find a demo on the [homepage](http://angular-clndr.10kb.nl). 12 | 13 | ## Usage & configuration 14 | 15 | For a complete documentation check the [homepage](http://angular-clndr.10kb.nl). 16 | 17 | Directive usage: 18 | ```html 19 | 20 |
21 |
22 | ‹ 23 |
24 |
25 | {{month}} 26 |
27 |
28 | › 29 |
30 |
31 |
32 |
33 |
34 | {{day}} 35 |
36 |
37 |
38 |
39 |
{{day.events.length}}
40 | {{day.day}} 41 |
42 |
43 |
44 |
45 | ``` 46 | 47 | ## License 48 | 49 | angular-clndr is released under the [MIT license](https://10kb.mit-license.org/). 50 | -------------------------------------------------------------------------------- /src/angular-clndr.coffee: -------------------------------------------------------------------------------- 1 | ###! 2 | # angular-clndr 0.3.0 3 | # 10KB, http://10kb.nl/ 4 | # License: MIT 5 | ### 6 | 7 | module = angular.module('tien.clndr', []) 8 | 9 | TienClndrDirective = -> 10 | scope = 11 | clndr: '=tienClndrObject' 12 | events: '=tienClndrEvents' 13 | options: '=?tienClndrOptions' 14 | 15 | controller = ["$scope", "$element", "$attrs", "$transclude", ($scope, $element, $attrs, $transclude) -> 16 | $transclude (clone, scope) -> 17 | $element.append(clone) 18 | 19 | # watch events from tien-clndr-events attribute 20 | $scope.$watch 'events', (val) -> 21 | $scope.clndr.setEvents(angular.copy(val || [])) 22 | 23 | # extend all CLNDR data to scope 24 | render = (data) -> 25 | angular.extend(scope, data) 26 | 27 | # create options object for optional CLNDR settings 28 | options = angular.extend($scope.options || {}, render: render) 29 | 30 | # init CLNDR in virtual DOM-element 31 | $scope.clndr = angular.element("
").clndr(options) 32 | ] 33 | return {restrict: 'E', replace: true, transclude: true, scope: scope, controller: controller} 34 | 35 | module.directive('tienClndr', TienClndrDirective) -------------------------------------------------------------------------------- /src/angular-clndr.sass: -------------------------------------------------------------------------------- 1 | .clndr 2 | display: block 3 | margin: 0 auto 4 | max-width: 400px 5 | 6 | .clndr-controls 7 | border-bottom: 1px solid #ccc 8 | position: relative 9 | 10 | .month 11 | padding: 12px 0 12 | text-align: center 13 | 14 | .clndr-previous-button, .clndr-next-button 15 | cursor: pointer 16 | top: 0px 17 | left: 0px 18 | padding: 12px 19 | position: absolute 20 | 21 | .clndr-next-button 22 | left: auto 23 | right: 0px 24 | 25 | .clndr-grid 26 | .days-of-the-week 27 | width: 100% 28 | 29 | .header-day 30 | float: left 31 | width: (100% / 7) 32 | padding: 12px 0 33 | text-align: center 34 | 35 | .days 36 | .day, .empty 37 | float: left 38 | width: (100% / 7) 39 | padding: 12px 0 40 | position: relative 41 | text-align: center 42 | 43 | &.today 44 | background-color: #ccc 45 | 46 | .event-indicator 47 | background-color: #3BB7E8 48 | border-radius: 100% 49 | color: #fff 50 | cursor: pointer 51 | font-size: 9px 52 | height: 15px 53 | line-height: 16px 54 | position: absolute 55 | right: 0px 56 | top: 0px 57 | width: 15px 58 | 59 | &.adjacent-month, &.inactive 60 | opacity: 0.3 61 | --------------------------------------------------------------------------------