index.html 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287
  1. <!doctype html>
  2. <html lang="en" ng-app="materialExample">
  3. <head>
  4. <meta charset="utf-8">
  5. <meta http-equiv="X-UA-Compatible" content="IE=edge">
  6. <meta name="description" content="Alertify.js is a lightweight brower alert and dialog plugin.">
  7. <meta name="viewport" content="width=device-width, initial-scale=1">
  8. <title>Angular Material Calendar</title>
  9. <link href="https://fonts.googleapis.com/css?family=Roboto:light&lang=en" rel="stylesheet">
  10. <link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet">
  11. <link rel="stylesheet" href="https://storage.googleapis.com/code.getmdl.io/1.0.4/material.light_green-lime.min.css" />
  12. <link rel="stylesheet" href="/css/angular-material-min.css">
  13. <link rel="stylesheet" href="/css/styles.css">
  14. </head>
  15. <body>
  16. <div class="layout-transparent mdl-layout mdl-js-layout">
  17. <header class="mdl-layout__header mdl-layout__header--transparent">
  18. <div class="mdl-layout__header-row">
  19. <span class="mdl-layout-title ">Angular Material Calendar</span>
  20. <div class="mdl-layout-spacer"></div>
  21. <nav class="mdl-navigation">
  22. <a class="mdl-navigation__link" href="#getting-started">Getting Started</a>
  23. <a class="mdl-navigation__link" href="https://github.com/bradberger/angular-material-calendar">View on GitHub</a>
  24. </nav>
  25. </div>
  26. </header>
  27. <div class="mdl-layout__drawer">
  28. <span class="mdl-layout-title">Angular Material Calendar</span>
  29. <nav class="mdl-navigation">
  30. <a class="mdl-navigation__link" href="#getting-started">Getting Started</a>
  31. <a class="mdl-navigation__link" href="https://github.com/bradberger/angular-material-calendar">View on GitHub</a>
  32. </nav>
  33. </div>
  34. <main class="mdl-layout__content">
  35. <div class="container text-center">
  36. <h1 class="text--bold-shadow mdl-typography--display-4">Angular Material Calendar <small>v0.2.12</small></h1>
  37. <h3 class="text--bold-shadow mdl-typography--display-2">Flexible calendar directive for the Angular Material framework</h3>
  38. <a href="https://github.com/bradberger/angular-material-calendar/archive/master.zip" class="mdl-button mdl-button--large mdl-button--accent mdl-js-button mdl-button--raised mdl-js-ripple-effect">
  39. <i class="material-icons md-24">file_download</i>
  40. Download Now
  41. </a>
  42. </div>
  43. <div class="page-content">
  44. <div class="container">
  45. <h2 class="mdl-typeography--display-3" id="getting-started">Getting Started</h2>
  46. <div class="mdl-grid">
  47. <div class="mdl-cell mdl-cell--8-col mdl-cell--5-col-desktop left-col">
  48. <h4 class="mdl-typeograph--headline">Notes</h4>
  49. <p>
  50. This is still very much a work in progress, so expect to get
  51. your hands dirty and file issues. Nonetheless, it's being
  52. prepped for use in production and should get the job done.
  53. </p>
  54. </div>
  55. <div class="mdl-cell mdl-cell--8-col mdl-cell--7-col-desktop right-col">
  56. <h4 class="mdl-typeograph--headline">Via RawGit</h4>
  57. <pre>&lt;script src="https://cdn.rawgit.com/bradberger/angular-material-calendar/master/dist/angular-material-calendar.js"&gt;&lt;script&gt;</pre>
  58. <h4 class="mdl-typeograph--headline">Via Bower</h4>
  59. <pre>bower install --save material-calendar</pre>
  60. <h4 class="mdl-typeograph--headline">Via NPM</h4>
  61. <pre>npm install --save angular-material-calendar</pre>
  62. </div>
  63. </div>
  64. </div>
  65. <div class="container" ng-controller="calendarCtrl">
  66. <h2 class="mdl-typeography--display-3" id="usage">Usage</h2>
  67. <h3 class="mdl-typeography--display-1" id="demo">Demo</h3>
  68. <p>
  69. There's also a <a href="/fullscreen.html">fullscreen enabled demo here</a>.
  70. It's designed to fill up the horizontal and vertical space of
  71. the parent element, so fullscreen is easy to do.
  72. </p>
  73. <p>
  74. Or, if you prefer, go fullscreen with the demo calendar below
  75. by <a href="#" ng-click="fullscreen()">clicking here</a>.
  76. </p>
  77. <div style="height: 800px;">
  78. <calendar-md id="calendar-demo"
  79. flex layout layout-fill
  80. calendar-direction="direction"
  81. on-prev-month="prevMonth"
  82. on-next-month="nextMonth"
  83. on-day-click="dayClick"
  84. title-format="'MMMM y'"
  85. ng-model='selectedDate'
  86. day-format="dayFormat"
  87. day-label-format="'EEE'"
  88. day-label-tooltip-format="'EEEE'"
  89. day-tooltip-format="'fullDate'"
  90. week-starts-on="weekStartsOn"
  91. tooltips="true"
  92. day-content="setDayContent"
  93. disable-future-selection="disableFutureDates"></calendar-md>
  94. </div>
  95. <p>{{ msg || "Click on a date/button to get started"}}</p>
  96. <pre>$scope.selectedDate = {{ selectedDate | json }}</pre>
  97. <div class="mdl-grid">
  98. <div class="mdl-cell mdl-cell--12-col mdl-cell--6-col-desktop left-col">
  99. <section>
  100. <h5 class="mdl-typeography--headline">With All Options</h5>
  101. <p>
  102. While I'm working on the documentation, feel free to check
  103. out the example of it in action here.
  104. </p>
  105. <p>
  106. If you're brave, you might be able to poke around the
  107. example and figure things out! Better yet, why not help
  108. contribute to the documentation?
  109. </p>
  110. </section>
  111. <section>
  112. <h5 class="mdl-typeography--headline">First Day Of Week</h5>
  113. <p>
  114. You can easily change the first day of the week.
  115. </p>
  116. <md-input-container>
  117. <label>First day of week</label>
  118. <md-select ng-model="weekStartsOn" ng-change="">
  119. <md-option value="0">Sunday</md-option>
  120. <md-option value="1">Monday</md-option>
  121. <md-option value="2">Tuesday</md-option>
  122. <md-option value="3">Wednesday</md-option>
  123. <md-option value="4">Thursday</md-option>
  124. <md-option value="5">Friday</md-option>
  125. <md-option value="6">Saturday</md-option>
  126. </md-select>
  127. </md-input-container>
  128. </section>
  129. <section>
  130. <h5>Updating calendar data using the MaterialCalendarData service</h5>
  131. <p>
  132. To support scenarios where you wish to update the content of a
  133. given day without re-loading the containing scope a MaterialCalendarData
  134. service has been added. Just inject MaterialCalendarData and use the
  135. <code>setDayContent(date,content)</code> function
  136. </p>
  137. <p>
  138. <md-button ng-click="setContentViaService()">Make today a happy day</md-button>
  139. </p>
  140. </section>
  141. </div>
  142. <div class="mdl-cell mdl-cell--12-col mdl-cell--6-col-desktop right-col">
  143. <section>
  144. <h5 class="mdl-typeography--headline">Calendar Layout</h5>
  145. <p>You can also change the calendar layout dynamically.</p>
  146. <md-button ng-click="setDirection('vertical')">Agenda</md-button>
  147. <md-button ng-click="setDirection('horizontal')">Calendar</md-button>
  148. </section>
  149. <section>
  150. <h5 class="mdl-typeography--headline">Selecting Dates</h5>
  151. <p>
  152. You can select multiple dates. Just make sure your ng-model
  153. value is initialized as an array. This demo also demonstrates
  154. that if the ngModel is changed from outside the directive,
  155. the directive will detect that change. That means you can
  156. select dates programatically.
  157. </p>
  158. <p>
  159. <md-button ng-click="selectedDate = [];">Multiple dates</md-button>
  160. <md-button ng-click="selectedDate = false;">Single date</md-button>
  161. </p>
  162. </section>
  163. <section>
  164. <h5 class="mdl-typeography--headline">Tooltips</h5>
  165. <p>
  166. Since 0.2.9 tooltips are off by default, but can easily be enabled.
  167. See the example below.
  168. </p>
  169. </section>
  170. <section>
  171. <h5 class="mdl-typeography--headline">Disable future selection</h5>
  172. <p>
  173. If you don&apos;t want users selecting dates in the future then
  174. set the disable-future-selection attribute on the directive to true
  175. <md-button ng-click="disableFutureDates = !disableFutureDates;">Toggle future selection</md-button>
  176. </p>
  177. </section>
  178. </div>
  179. </div>
  180. <div class="mdl-grid">
  181. <div class="mdl-cell md-cell--12-col mdl-cell--12-col-desktop">
  182. <pre>
  183. &lt;calendar-md flex layout layout-fill
  184. calendar-direction="direction"
  185. on-prev-month="prevMonth"
  186. on-next-month="nextMonth"
  187. on-day-click="dayClick"
  188. title-format="'MMMM y'"
  189. ng-model='selectedDate'
  190. week-starts-on="firstDayOfWeek"
  191. &lt;--Set the initial month here. "8" is September. Defaults to current--&gt;
  192. data-start-month="8"
  193. &lt;--Set the initial year here. Defaults to current.--&gt;
  194. data-start-year="2014"
  195. tooltips="tooltips"
  196. day-format="dayFormat"
  197. day-label-format="'EEE'"
  198. day-label-tooltip-format="'EEEE'"
  199. day-tooltip-format="'fullDate'"
  200. day-content="setDayContent"
  201. disable-future-selection="false"
  202. &lt;-- Allows dates in the future to be disabled and unselectable. Defaults to false--&gt; &gt;&lt;/calendar-md&gt;
  203. &lt;script&gt;
  204. angular.module("materialExample", ["ngMaterial", "materialCalendar"]);
  205. angular.module("materialExample").controller("calendarCtrl", function($scope, $filter, $http, $q) {
  206. $scope.dayFormat = "d";
  207. // To select a single date, make sure the ngModel is not an array.
  208. $scope.selectedDate = null;
  209. // If you want multi-date select, initialize it as an array.
  210. $scope.selectedDate = [];
  211. $scope.firstDayOfWeek = 0; // First day of the week, 0 for Sunday, 1 for Monday, etc.
  212. $scope.setDirection = function(direction) {
  213. $scope.direction = direction;
  214. $scope.dayFormat = direction === "vertical" ? "EEEE, MMMM d" : "d";
  215. };
  216. $scope.dayClick = function(date) {
  217. $scope.msg = "You clicked " + $filter("date")(date, "MMM d, y h:mm:ss a Z");
  218. };
  219. $scope.prevMonth = function(data) {
  220. $scope.msg = "You clicked (prev) month " + data.month + ", " + data.year;
  221. };
  222. $scope.nextMonth = function(data) {
  223. $scope.msg = "You clicked (next) month " + data.month + ", " + data.year;
  224. };
  225. $scope.tooltips = true;
  226. $scope.setDayContent = function(date) {
  227. // You would inject any HTML you wanted for
  228. // that particular date here.
  229. return "&lt;p&gt;&lt;/p&gt;";
  230. // You could also use an $http function directly.
  231. return $http.get("/some/external/api");
  232. // You could also use a promise.
  233. var deferred = $q.defer();
  234. $timeout(function() {
  235. deferred.resolve("&lt;p&gt;&lt;/p&gt;");
  236. }, 1000);
  237. return deferred.promise;
  238. };
  239. });
  240. &lt;/script&gt:
  241. </pre>
  242. </div>
  243. </div>
  244. </div>
  245. </div>
  246. <footer>
  247. <div class="container">
  248. <p>Angular Material Calendar is released under the <a href="http://opensource.org/licenses/MIT">MPLv2 license</a>. &copy; 2015 <a href="https://bradb.net">Brad Berger</a> and contributors.
  249. </div>
  250. </footer>
  251. </main>
  252. </div>
  253. <script src="https://storage.googleapis.com/code.getmdl.io/1.0.4/material.min.js"></script>
  254. <script src="/js/angular.min.js"></script>
  255. <script src="/js/angular-animate.min.js"></script>
  256. <script src="/js/angular-aria.min.js"></script>
  257. <script src="/js/angular-sanitize.min.js"></script>
  258. <script src="/js/angular-material.min.js"></script>
  259. <script src="/js/angular-material-calendar.js"></script>
  260. <script src="/js/demo.js"></script>
  261. </body>
  262. </html>