rails-angularstrap 2.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (148) hide show
  1. checksums.yaml +7 -0
  2. data/README.md +89 -0
  3. data/Rakefile +2 -0
  4. data/lib/rails/angularstrap.rb +8 -0
  5. data/lib/rails/angularstrap/version.rb +5 -0
  6. data/vendor/assets/javascripts/angular-strap/LICENSE.md +21 -0
  7. data/vendor/assets/javascripts/angular-strap/README.md +112 -0
  8. data/vendor/assets/javascripts/angular-strap/angular-strap.nuspec +23 -0
  9. data/vendor/assets/javascripts/angular-strap/bower.json +53 -0
  10. data/vendor/assets/javascripts/angular-strap/dist/angular-strap.js +5014 -0
  11. data/vendor/assets/javascripts/angular-strap/dist/angular-strap.min.js +11 -0
  12. data/vendor/assets/javascripts/angular-strap/dist/angular-strap.min.js.map +1 -0
  13. data/vendor/assets/javascripts/angular-strap/dist/angular-strap.tpl.js +89 -0
  14. data/vendor/assets/javascripts/angular-strap/dist/angular-strap.tpl.min.js +8 -0
  15. data/vendor/assets/javascripts/angular-strap/dist/modules/affix.js +249 -0
  16. data/vendor/assets/javascripts/angular-strap/dist/modules/affix.min.js +9 -0
  17. data/vendor/assets/javascripts/angular-strap/dist/modules/affix.min.js.map +1 -0
  18. data/vendor/assets/javascripts/angular-strap/dist/modules/alert.js +120 -0
  19. data/vendor/assets/javascripts/angular-strap/dist/modules/alert.min.js +9 -0
  20. data/vendor/assets/javascripts/angular-strap/dist/modules/alert.min.js.map +1 -0
  21. data/vendor/assets/javascripts/angular-strap/dist/modules/alert.tpl.js +14 -0
  22. data/vendor/assets/javascripts/angular-strap/dist/modules/alert.tpl.min.js +8 -0
  23. data/vendor/assets/javascripts/angular-strap/dist/modules/aside.js +96 -0
  24. data/vendor/assets/javascripts/angular-strap/dist/modules/aside.min.js +9 -0
  25. data/vendor/assets/javascripts/angular-strap/dist/modules/aside.min.js.map +1 -0
  26. data/vendor/assets/javascripts/angular-strap/dist/modules/aside.tpl.js +14 -0
  27. data/vendor/assets/javascripts/angular-strap/dist/modules/aside.tpl.min.js +8 -0
  28. data/vendor/assets/javascripts/angular-strap/dist/modules/button.js +177 -0
  29. data/vendor/assets/javascripts/angular-strap/dist/modules/button.min.js +9 -0
  30. data/vendor/assets/javascripts/angular-strap/dist/modules/button.min.js.map +1 -0
  31. data/vendor/assets/javascripts/angular-strap/dist/modules/collapse.js +273 -0
  32. data/vendor/assets/javascripts/angular-strap/dist/modules/collapse.min.js +9 -0
  33. data/vendor/assets/javascripts/angular-strap/dist/modules/collapse.min.js.map +1 -0
  34. data/vendor/assets/javascripts/angular-strap/dist/modules/date-formatter.js +61 -0
  35. data/vendor/assets/javascripts/angular-strap/dist/modules/date-formatter.min.js +9 -0
  36. data/vendor/assets/javascripts/angular-strap/dist/modules/date-formatter.min.js.map +1 -0
  37. data/vendor/assets/javascripts/angular-strap/dist/modules/date-parser.js +273 -0
  38. data/vendor/assets/javascripts/angular-strap/dist/modules/date-parser.min.js +9 -0
  39. data/vendor/assets/javascripts/angular-strap/dist/modules/date-parser.min.js.map +1 -0
  40. data/vendor/assets/javascripts/angular-strap/dist/modules/datepicker.js +640 -0
  41. data/vendor/assets/javascripts/angular-strap/dist/modules/datepicker.min.js +9 -0
  42. data/vendor/assets/javascripts/angular-strap/dist/modules/datepicker.min.js.map +1 -0
  43. data/vendor/assets/javascripts/angular-strap/dist/modules/datepicker.tpl.js +14 -0
  44. data/vendor/assets/javascripts/angular-strap/dist/modules/datepicker.tpl.min.js +8 -0
  45. data/vendor/assets/javascripts/angular-strap/dist/modules/debounce.js +62 -0
  46. data/vendor/assets/javascripts/angular-strap/dist/modules/debounce.min.js +9 -0
  47. data/vendor/assets/javascripts/angular-strap/dist/modules/debounce.min.js.map +1 -0
  48. data/vendor/assets/javascripts/angular-strap/dist/modules/dimensions.js +156 -0
  49. data/vendor/assets/javascripts/angular-strap/dist/modules/dimensions.min.js +9 -0
  50. data/vendor/assets/javascripts/angular-strap/dist/modules/dimensions.min.js.map +1 -0
  51. data/vendor/assets/javascripts/angular-strap/dist/modules/dropdown.js +149 -0
  52. data/vendor/assets/javascripts/angular-strap/dist/modules/dropdown.min.js +9 -0
  53. data/vendor/assets/javascripts/angular-strap/dist/modules/dropdown.min.js.map +1 -0
  54. data/vendor/assets/javascripts/angular-strap/dist/modules/dropdown.tpl.js +14 -0
  55. data/vendor/assets/javascripts/angular-strap/dist/modules/dropdown.tpl.min.js +8 -0
  56. data/vendor/assets/javascripts/angular-strap/dist/modules/modal.js +349 -0
  57. data/vendor/assets/javascripts/angular-strap/dist/modules/modal.min.js +9 -0
  58. data/vendor/assets/javascripts/angular-strap/dist/modules/modal.min.js.map +1 -0
  59. data/vendor/assets/javascripts/angular-strap/dist/modules/modal.tpl.js +14 -0
  60. data/vendor/assets/javascripts/angular-strap/dist/modules/modal.tpl.min.js +8 -0
  61. data/vendor/assets/javascripts/angular-strap/dist/modules/navbar.js +72 -0
  62. data/vendor/assets/javascripts/angular-strap/dist/modules/navbar.min.js +9 -0
  63. data/vendor/assets/javascripts/angular-strap/dist/modules/navbar.min.js.map +1 -0
  64. data/vendor/assets/javascripts/angular-strap/dist/modules/parse-options.js +76 -0
  65. data/vendor/assets/javascripts/angular-strap/dist/modules/parse-options.min.js +9 -0
  66. data/vendor/assets/javascripts/angular-strap/dist/modules/parse-options.min.js.map +1 -0
  67. data/vendor/assets/javascripts/angular-strap/dist/modules/popover.js +112 -0
  68. data/vendor/assets/javascripts/angular-strap/dist/modules/popover.min.js +9 -0
  69. data/vendor/assets/javascripts/angular-strap/dist/modules/popover.min.js.map +1 -0
  70. data/vendor/assets/javascripts/angular-strap/dist/modules/popover.tpl.js +14 -0
  71. data/vendor/assets/javascripts/angular-strap/dist/modules/popover.tpl.min.js +8 -0
  72. data/vendor/assets/javascripts/angular-strap/dist/modules/raf.js +61 -0
  73. data/vendor/assets/javascripts/angular-strap/dist/modules/raf.min.js +9 -0
  74. data/vendor/assets/javascripts/angular-strap/dist/modules/raf.min.js.map +1 -0
  75. data/vendor/assets/javascripts/angular-strap/dist/modules/scrollspy.js +261 -0
  76. data/vendor/assets/javascripts/angular-strap/dist/modules/scrollspy.min.js +9 -0
  77. data/vendor/assets/javascripts/angular-strap/dist/modules/scrollspy.min.js.map +1 -0
  78. data/vendor/assets/javascripts/angular-strap/dist/modules/select.js +325 -0
  79. data/vendor/assets/javascripts/angular-strap/dist/modules/select.min.js +9 -0
  80. data/vendor/assets/javascripts/angular-strap/dist/modules/select.min.js.map +1 -0
  81. data/vendor/assets/javascripts/angular-strap/dist/modules/select.tpl.js +14 -0
  82. data/vendor/assets/javascripts/angular-strap/dist/modules/select.tpl.min.js +8 -0
  83. data/vendor/assets/javascripts/angular-strap/dist/modules/tab.js +186 -0
  84. data/vendor/assets/javascripts/angular-strap/dist/modules/tab.min.js +9 -0
  85. data/vendor/assets/javascripts/angular-strap/dist/modules/tab.min.js.map +1 -0
  86. data/vendor/assets/javascripts/angular-strap/dist/modules/tab.tpl.js +14 -0
  87. data/vendor/assets/javascripts/angular-strap/dist/modules/tab.tpl.min.js +8 -0
  88. data/vendor/assets/javascripts/angular-strap/dist/modules/timepicker.js +485 -0
  89. data/vendor/assets/javascripts/angular-strap/dist/modules/timepicker.min.js +9 -0
  90. data/vendor/assets/javascripts/angular-strap/dist/modules/timepicker.min.js.map +1 -0
  91. data/vendor/assets/javascripts/angular-strap/dist/modules/timepicker.tpl.js +14 -0
  92. data/vendor/assets/javascripts/angular-strap/dist/modules/timepicker.tpl.min.js +8 -0
  93. data/vendor/assets/javascripts/angular-strap/dist/modules/tooltip.js +690 -0
  94. data/vendor/assets/javascripts/angular-strap/dist/modules/tooltip.min.js +9 -0
  95. data/vendor/assets/javascripts/angular-strap/dist/modules/tooltip.min.js.map +1 -0
  96. data/vendor/assets/javascripts/angular-strap/dist/modules/tooltip.tpl.js +14 -0
  97. data/vendor/assets/javascripts/angular-strap/dist/modules/tooltip.tpl.min.js +8 -0
  98. data/vendor/assets/javascripts/angular-strap/dist/modules/typeahead.js +266 -0
  99. data/vendor/assets/javascripts/angular-strap/dist/modules/typeahead.min.js +9 -0
  100. data/vendor/assets/javascripts/angular-strap/dist/modules/typeahead.min.js.map +1 -0
  101. data/vendor/assets/javascripts/angular-strap/dist/modules/typeahead.tpl.js +14 -0
  102. data/vendor/assets/javascripts/angular-strap/dist/modules/typeahead.tpl.min.js +8 -0
  103. data/vendor/assets/javascripts/angular-strap/gulpfile.js +489 -0
  104. data/vendor/assets/javascripts/angular-strap/package.json +73 -0
  105. data/vendor/assets/javascripts/angular-strap/src/affix/affix.js +258 -0
  106. data/vendor/assets/javascripts/angular-strap/src/alert/alert.js +113 -0
  107. data/vendor/assets/javascripts/angular-strap/src/alert/alert.tpl.html +4 -0
  108. data/vendor/assets/javascripts/angular-strap/src/aside/aside.js +89 -0
  109. data/vendor/assets/javascripts/angular-strap/src/aside/aside.tpl.html +14 -0
  110. data/vendor/assets/javascripts/angular-strap/src/button/button.js +174 -0
  111. data/vendor/assets/javascripts/angular-strap/src/collapse/collapse.js +266 -0
  112. data/vendor/assets/javascripts/angular-strap/src/datepicker/datepicker.js +633 -0
  113. data/vendor/assets/javascripts/angular-strap/src/datepicker/datepicker.tpl.html +33 -0
  114. data/vendor/assets/javascripts/angular-strap/src/dropdown/dropdown.js +143 -0
  115. data/vendor/assets/javascripts/angular-strap/src/dropdown/dropdown.tpl.html +6 -0
  116. data/vendor/assets/javascripts/angular-strap/src/helpers/date-formatter.js +54 -0
  117. data/vendor/assets/javascripts/angular-strap/src/helpers/date-parser.js +266 -0
  118. data/vendor/assets/javascripts/angular-strap/src/helpers/debounce.js +55 -0
  119. data/vendor/assets/javascripts/angular-strap/src/helpers/dimensions.js +212 -0
  120. data/vendor/assets/javascripts/angular-strap/src/helpers/parse-options.js +69 -0
  121. data/vendor/assets/javascripts/angular-strap/src/helpers/raf.js +54 -0
  122. data/vendor/assets/javascripts/angular-strap/src/modal/modal.js +348 -0
  123. data/vendor/assets/javascripts/angular-strap/src/modal/modal.tpl.html +14 -0
  124. data/vendor/assets/javascripts/angular-strap/src/module.js +19 -0
  125. data/vendor/assets/javascripts/angular-strap/src/navbar/navbar.js +65 -0
  126. data/vendor/assets/javascripts/angular-strap/src/popover/popover.js +111 -0
  127. data/vendor/assets/javascripts/angular-strap/src/popover/popover.tpl.html +5 -0
  128. data/vendor/assets/javascripts/angular-strap/src/scrollspy/scrollspy.js +254 -0
  129. data/vendor/assets/javascripts/angular-strap/src/select/select.js +321 -0
  130. data/vendor/assets/javascripts/angular-strap/src/select/select.tpl.html +14 -0
  131. data/vendor/assets/javascripts/angular-strap/src/tab/tab.js +183 -0
  132. data/vendor/assets/javascripts/angular-strap/src/tab/tab.tpl.html +7 -0
  133. data/vendor/assets/javascripts/angular-strap/src/timepicker/timepicker.js +493 -0
  134. data/vendor/assets/javascripts/angular-strap/src/timepicker/timepicker.tpl.html +62 -0
  135. data/vendor/assets/javascripts/angular-strap/src/tooltip/tooltip.js +806 -0
  136. data/vendor/assets/javascripts/angular-strap/src/tooltip/tooltip.tpl.html +4 -0
  137. data/vendor/assets/javascripts/angular-strap/src/typeahead/typeahead.js +262 -0
  138. data/vendor/assets/javascripts/angular-strap/src/typeahead/typeahead.tpl.html +5 -0
  139. data/vendor/assets/javascripts/angular/README.md +64 -0
  140. data/vendor/assets/javascripts/angular/angular-csp.css +13 -0
  141. data/vendor/assets/javascripts/angular/angular.js +26181 -0
  142. data/vendor/assets/javascripts/angular/angular.min.js +250 -0
  143. data/vendor/assets/javascripts/angular/angular.min.js.gzip +0 -0
  144. data/vendor/assets/javascripts/angular/angular.min.js.map +8 -0
  145. data/vendor/assets/javascripts/angular/bower.json +8 -0
  146. data/vendor/assets/javascripts/angular/index.js +2 -0
  147. data/vendor/assets/javascripts/angular/package.json +25 -0
  148. metadata +237 -0
@@ -0,0 +1,9 @@
1
+ /**
2
+ * angular-strap
3
+ * @version v2.1.6 - 2015-01-11
4
+ * @link http://mgcrea.github.io/angular-strap
5
+ * @author Olivier Louvignes (olivier@mg-crea.com)
6
+ * @license MIT License, http://www.opensource.org/licenses/MIT
7
+ */
8
+ "use strict";angular.module("mgcrea.ngStrap.tooltip",["mgcrea.ngStrap.helpers.dimensions"]).provider("$tooltip",function(){var t=this.defaults={animation:"am-fade",customClass:"",prefixClass:"tooltip",prefixEvent:"tooltip",container:!1,target:!1,placement:"top",template:"tooltip/tooltip.tpl.html",contentTemplate:!1,trigger:"hover focus",keyboard:!1,html:!1,show:!1,title:"",type:"",delay:0,autoClose:!1,bsEnabled:!0};this.$get=["$window","$rootScope","$compile","$q","$templateCache","$http","$animate","$sce","dimensions","$$rAF","$timeout",function(e,n,o,i,a,l,r,s,u,c,f){function p(e,i){function a(){K.$emit(O.prefixEvent+".show",F)}function l(){if(K.$emit(O.prefixEvent+".hide",F),q===W){if(R&&"focus"===O.trigger)return e[0].blur();P()}}function p(){var t=O.trigger.split(" ");angular.forEach(t,function(t){"click"===t?e.on("click",F.toggle):"manual"!==t&&(e.on("hover"===t?"mouseenter":"focus",F.enter),e.on("hover"===t?"mouseleave":"blur",F.leave),"button"===A&&"hover"!==t&&e.on($?"touchstart":"mousedown",F.$onFocusElementMouseDown))})}function v(){for(var t=O.trigger.split(" "),n=t.length;n--;){var o=t[n];"click"===o?e.off("click",F.toggle):"manual"!==o&&(e.off("hover"===o?"mouseenter":"focus",F.enter),e.off("hover"===o?"mouseleave":"blur",F.leave),"button"===A&&"hover"!==o&&e.off($?"touchstart":"mousedown",F.$onFocusElementMouseDown))}}function y(){"focus"!==O.trigger?q.on("keyup",F.$onKeyUp):e.on("keyup",F.$onFocusKeyUp)}function k(){"focus"!==O.trigger?q.off("keyup",F.$onKeyUp):e.off("keyup",F.$onFocusKeyUp)}function S(){f(function(){q.on("click",E),w.on("click",F.hide),z=!0},0,!1)}function C(){z&&(q.off("click",E),w.off("click",F.hide),z=!1)}function E(t){t.stopPropagation()}function x(t){t=t||O.target||e;var n=t[0],o=n.getBoundingClientRect();null===o.width&&(o=angular.extend({},o,{width:o.right-o.left,height:o.bottom-o.top}));var i;return i="body"===O.container?u.offset(n):u.position(n),angular.extend({},o,i)}function D(t,e,n,o){var i,a=t.split("-");switch(a[0]){case"right":i={top:e.top+e.height/2-o/2,left:e.left+e.width};break;case"bottom":i={top:e.top+e.height,left:e.left+e.width/2-n/2};break;case"left":i={top:e.top+e.height/2-o/2,left:e.left-n};break;default:i={top:e.top-o,left:e.left+e.width/2-n/2}}if(!a[1])return i;if("top"===a[0]||"bottom"===a[0])switch(a[1]){case"left":i.left=e.left;break;case"right":i.left=e.left+e.width-n}else if("left"===a[0]||"right"===a[0])switch(a[1]){case"top":i.top=e.top-o;break;case"bottom":i.top=e.top+e.height}return i}function T(t,e){q.css({top:t+"px",left:e+"px"})}function P(){clearTimeout(H),F.$isShown&&null!==q&&(O.autoClose&&C(),O.keyboard&&k()),B&&(B.$destroy(),B=null),q&&(q.remove(),q=F.$element=null)}var F={},A=e[0].nodeName.toLowerCase(),O=F.$options=angular.extend({},t,i);F.$promise=g(O.template);var K=F.$scope=O.scope&&O.scope.$new()||n.$new();if(O.delay&&angular.isString(O.delay)){var U=O.delay.split(",").map(parseFloat);O.delay=U.length>1?{show:U[0],hide:U[1]}:U[0]}F.$id=O.id||e.attr("id")||"",O.title&&(K.title=s.trustAsHtml(O.title)),K.$setEnabled=function(t){K.$$postDigest(function(){F.setEnabled(t)})},K.$hide=function(){K.$$postDigest(function(){F.hide()})},K.$show=function(){K.$$postDigest(function(){F.show()})},K.$toggle=function(){K.$$postDigest(function(){F.toggle()})},F.$isShown=K.$isShown=!1;var H,M;O.contentTemplate&&(F.$promise=F.$promise.then(function(t){var e=angular.element(t);return g(O.contentTemplate).then(function(t){var n=d('[ng-bind="content"]',e[0]);return n.length||(n=d('[ng-bind="title"]',e[0])),n.removeAttr("ng-bind").html(t),e[0].outerHTML})}));var j,q,L,N,B;F.$promise.then(function(t){angular.isObject(t)&&(t=t.data),O.html&&(t=t.replace(b,'ng-bind-html="')),t=m.apply(t),L=t,j=o(t),F.init()}),F.init=function(){O.delay&&angular.isNumber(O.delay)&&(O.delay={show:O.delay,hide:O.delay}),"self"===O.container?N=e:angular.isElement(O.container)?N=O.container:O.container&&(N=d(O.container)),p(),O.target&&(O.target=angular.isElement(O.target)?O.target:d(O.target)),O.show&&K.$$postDigest(function(){"focus"===O.trigger?e[0].focus():F.show()})},F.destroy=function(){v(),P(),K.$destroy()},F.enter=function(){return clearTimeout(H),M="in",O.delay&&O.delay.show?void(H=setTimeout(function(){"in"===M&&F.show()},O.delay.show)):F.show()},F.show=function(){if(O.bsEnabled&&!F.$isShown){K.$emit(O.prefixEvent+".show.before",F);var t,n;O.container?(t=N,n=N[0].lastChild?angular.element(N[0].lastChild):null):(t=null,n=e),q&&P(),B=F.$scope.$new(),q=F.$element=j(B,function(){}),q.css({top:"-9999px",left:"-9999px",display:"block",visibility:"hidden"}),O.animation&&q.addClass(O.animation),O.type&&q.addClass(O.prefixClass+"-"+O.type),O.customClass&&q.addClass(O.customClass);var o=r.enter(q,t,n,a);o&&o.then&&o.then(a),F.$isShown=K.$isShown=!0,h(K),c(function(){F.$applyPlacement(),q&&q.css({visibility:"visible"})}),O.keyboard&&("focus"!==O.trigger&&F.focus(),y()),O.autoClose&&S()}},F.leave=function(){return clearTimeout(H),M="out",O.delay&&O.delay.hide?void(H=setTimeout(function(){"out"===M&&F.hide()},O.delay.hide)):F.hide()};var R,W;F.hide=function(t){if(F.$isShown){K.$emit(O.prefixEvent+".hide.before",F),R=t,W=q;var e=r.leave(q,l);e&&e.then&&e.then(l),F.$isShown=K.$isShown=!1,h(K),O.keyboard&&null!==q&&k(),O.autoClose&&null!==q&&C()}},F.toggle=function(){F.$isShown?F.leave():F.enter()},F.focus=function(){q[0].focus()},F.setEnabled=function(t){O.bsEnabled=t},F.$applyPlacement=function(){if(q){var n=O.placement,o=/\s?auto?\s?/i,i=o.test(n);i&&(n=n.replace(o,"")||t.placement),q.addClass(O.placement);var a=x(),l=q.prop("offsetWidth"),r=q.prop("offsetHeight");if(i){var s=n,u=O.container?angular.element(document.querySelector(O.container)):e.parent(),c=x(u);s.indexOf("bottom")>=0&&a.bottom+r>c.bottom?n=s.replace("bottom","top"):s.indexOf("top")>=0&&a.top-r<c.top&&(n=s.replace("top","bottom")),("right"===s||"bottom-left"===s||"top-left"===s)&&a.right+l>c.width?n="right"===s?"left":n.replace("left","right"):("left"===s||"bottom-right"===s||"top-right"===s)&&a.left-l<c.left&&(n="left"===s?"right":n.replace("right","left")),q.removeClass(s).addClass(n)}var f=D(n,a,l,r);T(f.top,f.left)}},F.$onKeyUp=function(t){27===t.which&&F.$isShown&&(F.hide(),t.stopPropagation())},F.$onFocusKeyUp=function(t){27===t.which&&(e[0].blur(),t.stopPropagation())},F.$onFocusElementMouseDown=function(t){t.preventDefault(),t.stopPropagation(),F.$isShown?e[0].blur():e[0].focus()};var z=!1;return F}function h(t){t.$$phase||t.$root&&t.$root.$$phase||t.$digest()}function d(t,e){return angular.element((e||document).querySelectorAll(t))}function g(t){return v[t]?v[t]:v[t]=i.when(a.get(t)||l.get(t)).then(function(e){return angular.isObject(e)?(a.put(t,e.data),e.data):e})}var m=String.prototype.trim,$="createTouch"in e.document,b=/ng-bind="/gi,w=angular.element(e.document),v={};return p}]}).directive("bsTooltip",["$window","$location","$sce","$tooltip","$$rAF",function(t,e,n,o,i){return{restrict:"EAC",scope:!0,link:function(t,e,a){var l={scope:t};angular.forEach(["template","contentTemplate","placement","container","target","delay","trigger","keyboard","html","animation","backdropAnimation","type","customClass","id"],function(t){angular.isDefined(a[t])&&(l[t]=a[t])}),t.hasOwnProperty("title")||(t.title=""),a.$observe("title",function(e){if(angular.isDefined(e)||!t.hasOwnProperty("title")){var o=t.title;t.title=n.trustAsHtml(e),angular.isDefined(o)&&i(function(){r&&r.$applyPlacement()})}}),a.bsTooltip&&t.$watch(a.bsTooltip,function(e,n){angular.isObject(e)?angular.extend(t,e):t.title=e,angular.isDefined(n)&&i(function(){r&&r.$applyPlacement()})},!0),a.bsShow&&t.$watch(a.bsShow,function(t){r&&angular.isDefined(t)&&(angular.isString(t)&&(t=!!t.match(/true|,?(tooltip),?/i)),t===!0?r.show():r.hide())}),a.bsEnabled&&t.$watch(a.bsEnabled,function(t){r&&angular.isDefined(t)&&(angular.isString(t)&&(t=!!t.match(/true|1|,?(tooltip),?/i)),r.setEnabled(t===!1?!1:!0))});var r=o(e,l);t.$on("$destroy",function(){r&&r.destroy(),l=null,r=null})}}}]);
9
+ //# sourceMappingURL=tooltip.min.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["tooltip/tooltip.js"],"names":[],"mappings":"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","file":"tooltip.min.js","sourcesContent":["'use strict';\n\nangular.module('mgcrea.ngStrap.tooltip', ['mgcrea.ngStrap.helpers.dimensions'])\n\n .provider('$tooltip', function() {\n\n var defaults = this.defaults = {\n animation: 'am-fade',\n customClass: '',\n prefixClass: 'tooltip',\n prefixEvent: 'tooltip',\n container: false,\n target: false,\n placement: 'top',\n template: 'tooltip/tooltip.tpl.html',\n contentTemplate: false,\n trigger: 'hover focus',\n keyboard: false,\n html: false,\n show: false,\n title: '',\n type: '',\n delay: 0,\n autoClose: false,\n bsEnabled: true\n };\n\n this.$get = function($window, $rootScope, $compile, $q, $templateCache, $http, $animate, $sce, dimensions, $$rAF, $timeout) {\n\n var trim = String.prototype.trim;\n var isTouch = 'createTouch' in $window.document;\n var htmlReplaceRegExp = /ng-bind=\"/ig;\n var $body = angular.element($window.document);\n\n function TooltipFactory(element, config) {\n\n var $tooltip = {};\n\n // Common vars\n var nodeName = element[0].nodeName.toLowerCase();\n var options = $tooltip.$options = angular.extend({}, defaults, config);\n $tooltip.$promise = fetchTemplate(options.template);\n var scope = $tooltip.$scope = options.scope && options.scope.$new() || $rootScope.$new();\n if(options.delay && angular.isString(options.delay)) {\n var split = options.delay.split(',').map(parseFloat);\n options.delay = split.length > 1 ? {show: split[0], hide: split[1]} : split[0];\n }\n\n // store $id to identify the triggering element in events\n // give priority to options.id, otherwise, try to use\n // element id if defined\n $tooltip.$id = options.id || element.attr('id') || '';\n\n // Support scope as string options\n if(options.title) {\n scope.title = $sce.trustAsHtml(options.title);\n }\n\n // Provide scope helpers\n scope.$setEnabled = function(isEnabled) {\n scope.$$postDigest(function() {\n $tooltip.setEnabled(isEnabled);\n });\n };\n scope.$hide = function() {\n scope.$$postDigest(function() {\n $tooltip.hide();\n });\n };\n scope.$show = function() {\n scope.$$postDigest(function() {\n $tooltip.show();\n });\n };\n scope.$toggle = function() {\n scope.$$postDigest(function() {\n $tooltip.toggle();\n });\n };\n // Publish isShown as a protected var on scope\n $tooltip.$isShown = scope.$isShown = false;\n\n // Private vars\n var timeout, hoverState;\n\n // Support contentTemplate option\n if(options.contentTemplate) {\n $tooltip.$promise = $tooltip.$promise.then(function(template) {\n var templateEl = angular.element(template);\n return fetchTemplate(options.contentTemplate)\n .then(function(contentTemplate) {\n var contentEl = findElement('[ng-bind=\"content\"]', templateEl[0]);\n if(!contentEl.length) contentEl = findElement('[ng-bind=\"title\"]', templateEl[0]);\n contentEl.removeAttr('ng-bind').html(contentTemplate);\n return templateEl[0].outerHTML;\n });\n });\n }\n\n // Fetch, compile then initialize tooltip\n var tipLinker, tipElement, tipTemplate, tipContainer, tipScope;\n $tooltip.$promise.then(function(template) {\n if(angular.isObject(template)) template = template.data;\n if(options.html) template = template.replace(htmlReplaceRegExp, 'ng-bind-html=\"');\n template = trim.apply(template);\n tipTemplate = template;\n tipLinker = $compile(template);\n $tooltip.init();\n });\n\n $tooltip.init = function() {\n\n // Options: delay\n if (options.delay && angular.isNumber(options.delay)) {\n options.delay = {\n show: options.delay,\n hide: options.delay\n };\n }\n\n // Replace trigger on touch devices ?\n // if(isTouch && options.trigger === defaults.trigger) {\n // options.trigger.replace(/hover/g, 'click');\n // }\n\n // Options : container\n if(options.container === 'self') {\n tipContainer = element;\n } else if(angular.isElement(options.container)) {\n tipContainer = options.container;\n } else if(options.container) {\n tipContainer = findElement(options.container);\n }\n\n // Options: trigger\n bindTriggerEvents();\n\n // Options: target\n if(options.target) {\n options.target = angular.isElement(options.target) ? options.target : findElement(options.target);\n }\n\n // Options: show\n if(options.show) {\n scope.$$postDigest(function() {\n options.trigger === 'focus' ? element[0].focus() : $tooltip.show();\n });\n }\n\n };\n\n $tooltip.destroy = function() {\n\n // Unbind events\n unbindTriggerEvents();\n\n // Remove element\n destroyTipElement();\n\n // Destroy scope\n scope.$destroy();\n\n };\n\n $tooltip.enter = function() {\n\n clearTimeout(timeout);\n hoverState = 'in';\n if (!options.delay || !options.delay.show) {\n return $tooltip.show();\n }\n\n timeout = setTimeout(function() {\n if (hoverState ==='in') $tooltip.show();\n }, options.delay.show);\n\n };\n\n $tooltip.show = function() {\n if (!options.bsEnabled || $tooltip.$isShown) return;\n\n scope.$emit(options.prefixEvent + '.show.before', $tooltip);\n var parent, after;\n if (options.container) {\n parent = tipContainer;\n if (tipContainer[0].lastChild) {\n after = angular.element(tipContainer[0].lastChild);\n } else {\n after = null;\n }\n } else {\n parent = null;\n after = element;\n }\n\n\n // Hide any existing tipElement\n if(tipElement) destroyTipElement();\n // Fetch a cloned element linked from template\n tipScope = $tooltip.$scope.$new();\n tipElement = $tooltip.$element = tipLinker(tipScope, function(clonedElement, scope) {});\n\n // Set the initial positioning. Make the tooltip invisible\n // so IE doesn't try to focus on it off screen.\n tipElement.css({top: '-9999px', left: '-9999px', display: 'block', visibility: 'hidden'});\n\n // Options: animation\n if(options.animation) tipElement.addClass(options.animation);\n // Options: type\n if(options.type) tipElement.addClass(options.prefixClass + '-' + options.type);\n // Options: custom classes\n if(options.customClass) tipElement.addClass(options.customClass);\n\n // Support v1.3+ $animate\n // https://github.com/angular/angular.js/commit/bf0f5502b1bbfddc5cdd2f138efd9188b8c652a9\n var promise = $animate.enter(tipElement, parent, after, enterAnimateCallback);\n if(promise && promise.then) promise.then(enterAnimateCallback);\n\n $tooltip.$isShown = scope.$isShown = true;\n safeDigest(scope);\n $$rAF(function () {\n $tooltip.$applyPlacement();\n\n // Once placed, make the tooltip visible\n if(tipElement) tipElement.css({visibility: 'visible'});\n }); // var a = bodyEl.offsetWidth + 1; ?\n\n // Bind events\n if(options.keyboard) {\n if(options.trigger !== 'focus') {\n $tooltip.focus();\n }\n bindKeyboardEvents();\n }\n\n if(options.autoClose) {\n bindAutoCloseEvents();\n }\n\n };\n\n function enterAnimateCallback() {\n scope.$emit(options.prefixEvent + '.show', $tooltip);\n }\n\n $tooltip.leave = function() {\n\n clearTimeout(timeout);\n hoverState = 'out';\n if (!options.delay || !options.delay.hide) {\n return $tooltip.hide();\n }\n timeout = setTimeout(function () {\n if (hoverState === 'out') {\n $tooltip.hide();\n }\n }, options.delay.hide);\n\n };\n\n var _blur;\n var _tipToHide;\n $tooltip.hide = function(blur) {\n\n if(!$tooltip.$isShown) return;\n scope.$emit(options.prefixEvent + '.hide.before', $tooltip);\n\n // store blur value for leaveAnimateCallback to use\n _blur = blur;\n\n // store current tipElement reference to use\n // in leaveAnimateCallback\n _tipToHide = tipElement;\n\n // Support v1.3+ $animate\n // https://github.com/angular/angular.js/commit/bf0f5502b1bbfddc5cdd2f138efd9188b8c652a9\n var promise = $animate.leave(tipElement, leaveAnimateCallback);\n if(promise && promise.then) promise.then(leaveAnimateCallback);\n\n $tooltip.$isShown = scope.$isShown = false;\n safeDigest(scope);\n\n // Unbind events\n if(options.keyboard && tipElement !== null) {\n unbindKeyboardEvents();\n }\n\n if(options.autoClose && tipElement !== null) {\n unbindAutoCloseEvents();\n }\n };\n\n function leaveAnimateCallback() {\n scope.$emit(options.prefixEvent + '.hide', $tooltip);\n\n // check if current tipElement still references\n // the same element when hide was called\n if (tipElement === _tipToHide) {\n // Allow to blur the input when hidden, like when pressing enter key\n if(_blur && options.trigger === 'focus') {\n return element[0].blur();\n }\n\n // clean up child scopes\n destroyTipElement();\n }\n }\n\n $tooltip.toggle = function() {\n $tooltip.$isShown ? $tooltip.leave() : $tooltip.enter();\n };\n\n $tooltip.focus = function() {\n tipElement[0].focus();\n };\n\n $tooltip.setEnabled = function(isEnabled) {\n options.bsEnabled = isEnabled;\n };\n\n // Protected methods\n\n $tooltip.$applyPlacement = function() {\n if(!tipElement) return;\n\n // Determine if we're doing an auto or normal placement\n var placement = options.placement,\n autoToken = /\\s?auto?\\s?/i,\n autoPlace = autoToken.test(placement);\n\n if (autoPlace) {\n placement = placement.replace(autoToken, '') || defaults.placement;\n }\n\n // Need to add the position class before we get\n // the offsets\n tipElement.addClass(options.placement);\n\n // Get the position of the target element\n // and the height and width of the tooltip so we can center it.\n var elementPosition = getPosition(),\n tipWidth = tipElement.prop('offsetWidth'),\n tipHeight = tipElement.prop('offsetHeight');\n\n // If we're auto placing, we need to check the positioning\n if (autoPlace) {\n var originalPlacement = placement;\n var container = options.container ? angular.element(document.querySelector(options.container)) : element.parent();\n var containerPosition = getPosition(container);\n\n // Determine if the vertical placement\n if (originalPlacement.indexOf('bottom') >= 0 && elementPosition.bottom + tipHeight > containerPosition.bottom) {\n placement = originalPlacement.replace('bottom', 'top');\n } else if (originalPlacement.indexOf('top') >= 0 && elementPosition.top - tipHeight < containerPosition.top) {\n placement = originalPlacement.replace('top', 'bottom');\n }\n\n // Determine the horizontal placement\n // The exotic placements of left and right are opposite of the standard placements. Their arrows are put on the left/right\n // and flow in the opposite direction of their placement.\n if ((originalPlacement === 'right' || originalPlacement === 'bottom-left' || originalPlacement === 'top-left') &&\n elementPosition.right + tipWidth > containerPosition.width) {\n\n placement = originalPlacement === 'right' ? 'left' : placement.replace('left', 'right');\n } else if ((originalPlacement === 'left' || originalPlacement === 'bottom-right' || originalPlacement === 'top-right') &&\n elementPosition.left - tipWidth < containerPosition.left) {\n\n placement = originalPlacement === 'left' ? 'right' : placement.replace('right', 'left');\n }\n\n tipElement.removeClass(originalPlacement).addClass(placement);\n }\n\n // Get the tooltip's top and left coordinates to center it with this directive.\n var tipPosition = getCalculatedOffset(placement, elementPosition, tipWidth, tipHeight);\n applyPlacementCss(tipPosition.top, tipPosition.left);\n };\n\n $tooltip.$onKeyUp = function(evt) {\n if (evt.which === 27 && $tooltip.$isShown) {\n $tooltip.hide();\n evt.stopPropagation();\n }\n };\n\n $tooltip.$onFocusKeyUp = function(evt) {\n if (evt.which === 27) {\n element[0].blur();\n evt.stopPropagation();\n }\n };\n\n $tooltip.$onFocusElementMouseDown = function(evt) {\n evt.preventDefault();\n evt.stopPropagation();\n // Some browsers do not auto-focus buttons (eg. Safari)\n $tooltip.$isShown ? element[0].blur() : element[0].focus();\n };\n\n // bind/unbind events\n function bindTriggerEvents() {\n var triggers = options.trigger.split(' ');\n angular.forEach(triggers, function(trigger) {\n if(trigger === 'click') {\n element.on('click', $tooltip.toggle);\n } else if(trigger !== 'manual') {\n element.on(trigger === 'hover' ? 'mouseenter' : 'focus', $tooltip.enter);\n element.on(trigger === 'hover' ? 'mouseleave' : 'blur', $tooltip.leave);\n nodeName === 'button' && trigger !== 'hover' && element.on(isTouch ? 'touchstart' : 'mousedown', $tooltip.$onFocusElementMouseDown);\n }\n });\n }\n\n function unbindTriggerEvents() {\n var triggers = options.trigger.split(' ');\n for (var i = triggers.length; i--;) {\n var trigger = triggers[i];\n if(trigger === 'click') {\n element.off('click', $tooltip.toggle);\n } else if(trigger !== 'manual') {\n element.off(trigger === 'hover' ? 'mouseenter' : 'focus', $tooltip.enter);\n element.off(trigger === 'hover' ? 'mouseleave' : 'blur', $tooltip.leave);\n nodeName === 'button' && trigger !== 'hover' && element.off(isTouch ? 'touchstart' : 'mousedown', $tooltip.$onFocusElementMouseDown);\n }\n }\n }\n\n function bindKeyboardEvents() {\n if(options.trigger !== 'focus') {\n tipElement.on('keyup', $tooltip.$onKeyUp);\n } else {\n element.on('keyup', $tooltip.$onFocusKeyUp);\n }\n }\n\n function unbindKeyboardEvents() {\n if(options.trigger !== 'focus') {\n tipElement.off('keyup', $tooltip.$onKeyUp);\n } else {\n element.off('keyup', $tooltip.$onFocusKeyUp);\n }\n }\n\n var _autoCloseEventsBinded = false;\n function bindAutoCloseEvents() {\n // use timeout to hookup the events to prevent\n // event bubbling from being processed imediately.\n $timeout(function() {\n // Stop propagation when clicking inside tooltip\n tipElement.on('click', stopEventPropagation);\n\n // Hide when clicking outside tooltip\n $body.on('click', $tooltip.hide);\n\n _autoCloseEventsBinded = true;\n }, 0, false);\n }\n\n function unbindAutoCloseEvents() {\n if (_autoCloseEventsBinded) {\n tipElement.off('click', stopEventPropagation);\n $body.off('click', $tooltip.hide);\n _autoCloseEventsBinded = false;\n }\n }\n\n function stopEventPropagation(event) {\n event.stopPropagation();\n }\n\n // Private methods\n\n function getPosition($element) {\n $element = $element || (options.target || element);\n\n var el = $element[0];\n\n var elRect = el.getBoundingClientRect();\n if (elRect.width === null) {\n // width and height are missing in IE8, so compute them manually; see https://github.com/twbs/bootstrap/issues/14093\n elRect = angular.extend({}, elRect, { width: elRect.right - elRect.left, height: elRect.bottom - elRect.top });\n }\n\n var elPos;\n if (options.container === 'body') {\n elPos = dimensions.offset(el);\n } else {\n elPos = dimensions.position(el);\n }\n\n return angular.extend({}, elRect, elPos);\n }\n\n function getCalculatedOffset(placement, position, actualWidth, actualHeight) {\n var offset;\n var split = placement.split('-');\n\n switch (split[0]) {\n case 'right':\n offset = {\n top: position.top + position.height / 2 - actualHeight / 2,\n left: position.left + position.width\n };\n break;\n case 'bottom':\n offset = {\n top: position.top + position.height,\n left: position.left + position.width / 2 - actualWidth / 2\n };\n break;\n case 'left':\n offset = {\n top: position.top + position.height / 2 - actualHeight / 2,\n left: position.left - actualWidth\n };\n break;\n default:\n offset = {\n top: position.top - actualHeight,\n left: position.left + position.width / 2 - actualWidth / 2\n };\n break;\n }\n\n if(!split[1]) {\n return offset;\n }\n\n // Add support for corners @todo css\n if(split[0] === 'top' || split[0] === 'bottom') {\n switch (split[1]) {\n case 'left':\n offset.left = position.left;\n break;\n case 'right':\n offset.left = position.left + position.width - actualWidth;\n }\n } else if(split[0] === 'left' || split[0] === 'right') {\n switch (split[1]) {\n case 'top':\n offset.top = position.top - actualHeight;\n break;\n case 'bottom':\n offset.top = position.top + position.height;\n }\n }\n\n return offset;\n }\n\n function applyPlacementCss(top, left) {\n tipElement.css({ top: top + 'px', left: left + 'px' });\n }\n\n function destroyTipElement() {\n // Cancel pending callbacks\n clearTimeout(timeout);\n\n if($tooltip.$isShown && tipElement !== null) {\n if(options.autoClose) {\n unbindAutoCloseEvents();\n }\n\n if(options.keyboard) {\n unbindKeyboardEvents();\n }\n }\n\n if(tipScope) {\n tipScope.$destroy();\n tipScope = null;\n }\n\n if(tipElement) {\n tipElement.remove();\n tipElement = $tooltip.$element = null;\n }\n }\n\n return $tooltip;\n\n }\n\n // Helper functions\n\n function safeDigest(scope) {\n scope.$$phase || (scope.$root && scope.$root.$$phase) || scope.$digest();\n }\n\n function findElement(query, element) {\n return angular.element((element || document).querySelectorAll(query));\n }\n\n var fetchPromises = {};\n function fetchTemplate(template) {\n if(fetchPromises[template]) return fetchPromises[template];\n return (fetchPromises[template] = $q.when($templateCache.get(template) || $http.get(template))\n .then(function(res) {\n if(angular.isObject(res)) {\n $templateCache.put(template, res.data);\n return res.data;\n }\n return res;\n }));\n }\n\n return TooltipFactory;\n\n };\n\n })\n\n .directive('bsTooltip', function($window, $location, $sce, $tooltip, $$rAF) {\n\n return {\n restrict: 'EAC',\n scope: true,\n link: function postLink(scope, element, attr, transclusion) {\n\n // Directive options\n var options = {scope: scope};\n angular.forEach(['template', 'contentTemplate', 'placement', 'container', 'target', 'delay', 'trigger', 'keyboard', 'html', 'animation', 'backdropAnimation', 'type', 'customClass', 'id'], function(key) {\n if(angular.isDefined(attr[key])) options[key] = attr[key];\n });\n\n // overwrite inherited title value when no value specified\n // fix for angular 1.3.1 531a8de72c439d8ddd064874bf364c00cedabb11\n if (!scope.hasOwnProperty('title')){\n scope.title = '';\n }\n\n // Observe scope attributes for change\n attr.$observe('title', function(newValue) {\n if (angular.isDefined(newValue) || !scope.hasOwnProperty('title')) {\n var oldValue = scope.title;\n scope.title = $sce.trustAsHtml(newValue);\n angular.isDefined(oldValue) && $$rAF(function() {\n tooltip && tooltip.$applyPlacement();\n });\n }\n });\n\n // Support scope as an object\n attr.bsTooltip && scope.$watch(attr.bsTooltip, function(newValue, oldValue) {\n if(angular.isObject(newValue)) {\n angular.extend(scope, newValue);\n } else {\n scope.title = newValue;\n }\n angular.isDefined(oldValue) && $$rAF(function() {\n tooltip && tooltip.$applyPlacement();\n });\n }, true);\n\n // Visibility binding support\n attr.bsShow && scope.$watch(attr.bsShow, function(newValue, oldValue) {\n if(!tooltip || !angular.isDefined(newValue)) return;\n if(angular.isString(newValue)) newValue = !!newValue.match(/true|,?(tooltip),?/i);\n newValue === true ? tooltip.show() : tooltip.hide();\n });\n\n // Enabled binding support\n attr.bsEnabled && scope.$watch(attr.bsEnabled, function(newValue, oldValue) {\n // console.warn('scope.$watch(%s)', attr.bsEnabled, newValue, oldValue);\n if(!tooltip || !angular.isDefined(newValue)) return;\n if(angular.isString(newValue)) newValue = !!newValue.match(/true|1|,?(tooltip),?/i);\n newValue === false ? tooltip.setEnabled(false) : tooltip.setEnabled(true);\n });\n\n // Initialize popover\n var tooltip = $tooltip(element, options);\n\n // Garbage collection\n scope.$on('$destroy', function() {\n if(tooltip) tooltip.destroy();\n options = null;\n tooltip = null;\n });\n\n }\n };\n\n });\n"],"sourceRoot":"/source/"}
@@ -0,0 +1,14 @@
1
+ /**
2
+ * angular-strap
3
+ * @version v2.1.6 - 2015-01-11
4
+ * @link http://mgcrea.github.io/angular-strap
5
+ * @author Olivier Louvignes (olivier@mg-crea.com)
6
+ * @license MIT License, http://www.opensource.org/licenses/MIT
7
+ */
8
+ 'use strict';
9
+
10
+ angular.module('mgcrea.ngStrap.tooltip').run(['$templateCache', function($templateCache) {
11
+
12
+ $templateCache.put('tooltip/tooltip.tpl.html', '<div class="tooltip in" ng-show="title"><div class="tooltip-arrow"></div><div class="tooltip-inner" ng-bind="title"></div></div>');
13
+
14
+ }]);
@@ -0,0 +1,8 @@
1
+ /**
2
+ * angular-strap
3
+ * @version v2.1.6 - 2015-01-11
4
+ * @link http://mgcrea.github.io/angular-strap
5
+ * @author Olivier Louvignes (olivier@mg-crea.com)
6
+ * @license MIT License, http://www.opensource.org/licenses/MIT
7
+ */
8
+ "use strict";angular.module("mgcrea.ngStrap.tooltip").run(["$templateCache",function(t){t.put("tooltip/tooltip.tpl.html",'<div class="tooltip in" ng-show="title"><div class="tooltip-arrow"></div><div class="tooltip-inner" ng-bind="title"></div></div>')}]);
@@ -0,0 +1,266 @@
1
+ /**
2
+ * angular-strap
3
+ * @version v2.1.6 - 2015-01-11
4
+ * @link http://mgcrea.github.io/angular-strap
5
+ * @author Olivier Louvignes (olivier@mg-crea.com)
6
+ * @license MIT License, http://www.opensource.org/licenses/MIT
7
+ */
8
+ 'use strict';
9
+
10
+ angular.module('mgcrea.ngStrap.typeahead', ['mgcrea.ngStrap.tooltip', 'mgcrea.ngStrap.helpers.parseOptions'])
11
+
12
+ .provider('$typeahead', function() {
13
+
14
+ var defaults = this.defaults = {
15
+ animation: 'am-fade',
16
+ prefixClass: 'typeahead',
17
+ prefixEvent: '$typeahead',
18
+ placement: 'bottom-left',
19
+ template: 'typeahead/typeahead.tpl.html',
20
+ trigger: 'focus',
21
+ container: false,
22
+ keyboard: true,
23
+ html: false,
24
+ delay: 0,
25
+ minLength: 1,
26
+ filter: 'filter',
27
+ limit: 6,
28
+ comparator: ''
29
+ };
30
+
31
+ this.$get = ["$window", "$rootScope", "$tooltip", "$timeout", function($window, $rootScope, $tooltip, $timeout) {
32
+
33
+ var bodyEl = angular.element($window.document.body);
34
+
35
+ function TypeaheadFactory(element, controller, config) {
36
+
37
+ var $typeahead = {};
38
+
39
+ // Common vars
40
+ var options = angular.extend({}, defaults, config);
41
+
42
+ $typeahead = $tooltip(element, options);
43
+ var parentScope = config.scope;
44
+ var scope = $typeahead.$scope;
45
+
46
+ scope.$resetMatches = function(){
47
+ scope.$matches = [];
48
+ scope.$activeIndex = 0;
49
+ };
50
+ scope.$resetMatches();
51
+
52
+ scope.$activate = function(index) {
53
+ scope.$$postDigest(function() {
54
+ $typeahead.activate(index);
55
+ });
56
+ };
57
+
58
+ scope.$select = function(index, evt) {
59
+ scope.$$postDigest(function() {
60
+ $typeahead.select(index);
61
+ });
62
+ };
63
+
64
+ scope.$isVisible = function() {
65
+ return $typeahead.$isVisible();
66
+ };
67
+
68
+ // Public methods
69
+
70
+ $typeahead.update = function(matches) {
71
+ scope.$matches = matches;
72
+ if(scope.$activeIndex >= matches.length) {
73
+ scope.$activeIndex = 0;
74
+ }
75
+ };
76
+
77
+ $typeahead.activate = function(index) {
78
+ scope.$activeIndex = index;
79
+ };
80
+
81
+ $typeahead.select = function(index) {
82
+ var value = scope.$matches[index].value;
83
+ // console.log('$setViewValue', value);
84
+ controller.$setViewValue(value);
85
+ controller.$render();
86
+ scope.$resetMatches();
87
+ if(parentScope) parentScope.$digest();
88
+ // Emit event
89
+ scope.$emit(options.prefixEvent + '.select', value, index, $typeahead);
90
+ };
91
+
92
+ // Protected methods
93
+
94
+ $typeahead.$isVisible = function() {
95
+ if(!options.minLength || !controller) {
96
+ return !!scope.$matches.length;
97
+ }
98
+ // minLength support
99
+ return scope.$matches.length && angular.isString(controller.$viewValue) && controller.$viewValue.length >= options.minLength;
100
+ };
101
+
102
+ $typeahead.$getIndex = function(value) {
103
+ var l = scope.$matches.length, i = l;
104
+ if(!l) return;
105
+ for(i = l; i--;) {
106
+ if(scope.$matches[i].value === value) break;
107
+ }
108
+ if(i < 0) return;
109
+ return i;
110
+ };
111
+
112
+ $typeahead.$onMouseDown = function(evt) {
113
+ // Prevent blur on mousedown
114
+ evt.preventDefault();
115
+ evt.stopPropagation();
116
+ };
117
+
118
+ $typeahead.$onKeyDown = function(evt) {
119
+ if(!/(38|40|13)/.test(evt.keyCode)) return;
120
+
121
+ // Let ngSubmit pass if the typeahead tip is hidden
122
+ if($typeahead.$isVisible()) {
123
+ evt.preventDefault();
124
+ evt.stopPropagation();
125
+ }
126
+
127
+ // Select with enter
128
+ if(evt.keyCode === 13 && scope.$matches.length) {
129
+ $typeahead.select(scope.$activeIndex);
130
+ }
131
+
132
+ // Navigate with keyboard
133
+ else if(evt.keyCode === 38 && scope.$activeIndex > 0) scope.$activeIndex--;
134
+ else if(evt.keyCode === 40 && scope.$activeIndex < scope.$matches.length - 1) scope.$activeIndex++;
135
+ else if(angular.isUndefined(scope.$activeIndex)) scope.$activeIndex = 0;
136
+ scope.$digest();
137
+ };
138
+
139
+ // Overrides
140
+
141
+ var show = $typeahead.show;
142
+ $typeahead.show = function() {
143
+ show();
144
+ // use timeout to hookup the events to prevent
145
+ // event bubbling from being processed imediately.
146
+ $timeout(function() {
147
+ $typeahead.$element.on('mousedown', $typeahead.$onMouseDown);
148
+ if(options.keyboard) {
149
+ element.on('keydown', $typeahead.$onKeyDown);
150
+ }
151
+ }, 0, false);
152
+ };
153
+
154
+ var hide = $typeahead.hide;
155
+ $typeahead.hide = function() {
156
+ $typeahead.$element.off('mousedown', $typeahead.$onMouseDown);
157
+ if(options.keyboard) {
158
+ element.off('keydown', $typeahead.$onKeyDown);
159
+ }
160
+ hide();
161
+ };
162
+
163
+ return $typeahead;
164
+
165
+ }
166
+
167
+ TypeaheadFactory.defaults = defaults;
168
+ return TypeaheadFactory;
169
+
170
+ }];
171
+
172
+ })
173
+
174
+ .directive('bsTypeahead', ["$window", "$parse", "$q", "$typeahead", "$parseOptions", function($window, $parse, $q, $typeahead, $parseOptions) {
175
+
176
+ var defaults = $typeahead.defaults;
177
+
178
+ return {
179
+ restrict: 'EAC',
180
+ require: 'ngModel',
181
+ link: function postLink(scope, element, attr, controller) {
182
+
183
+ // Directive options
184
+ var options = {scope: scope};
185
+ angular.forEach(['placement', 'container', 'delay', 'trigger', 'keyboard', 'html', 'animation', 'template', 'filter', 'limit', 'minLength', 'watchOptions', 'selectMode', 'comparator', 'id'], function(key) {
186
+ if(angular.isDefined(attr[key])) options[key] = attr[key];
187
+ });
188
+
189
+ // Build proper ngOptions
190
+ var filter = options.filter || defaults.filter;
191
+ var limit = options.limit || defaults.limit;
192
+ var comparator = options.comparator || defaults.comparator;
193
+
194
+ var ngOptions = attr.ngOptions;
195
+ if(filter) ngOptions += ' | ' + filter + ':$viewValue';
196
+ if (comparator) ngOptions += ':' + comparator;
197
+ if(limit) ngOptions += ' | limitTo:' + limit;
198
+ var parsedOptions = $parseOptions(ngOptions);
199
+
200
+ // Initialize typeahead
201
+ var typeahead = $typeahead(element, controller, options);
202
+
203
+ // Watch options on demand
204
+ if(options.watchOptions) {
205
+ // Watch ngOptions values before filtering for changes, drop function calls
206
+ var watchedOptions = parsedOptions.$match[7].replace(/\|.+/, '').replace(/\(.*\)/g, '').trim();
207
+ scope.$watch(watchedOptions, function (newValue, oldValue) {
208
+ // console.warn('scope.$watch(%s)', watchedOptions, newValue, oldValue);
209
+ parsedOptions.valuesFn(scope, controller).then(function (values) {
210
+ typeahead.update(values);
211
+ controller.$render();
212
+ });
213
+ }, true);
214
+ }
215
+
216
+ // Watch model for changes
217
+ scope.$watch(attr.ngModel, function(newValue, oldValue) {
218
+ // console.warn('$watch', element.attr('ng-model'), newValue);
219
+ scope.$modelValue = newValue; // Publish modelValue on scope for custom templates
220
+ parsedOptions.valuesFn(scope, controller)
221
+ .then(function(values) {
222
+ // Prevent input with no future prospect if selectMode is truthy
223
+ // @TODO test selectMode
224
+ if(options.selectMode && !values.length && newValue.length > 0) {
225
+ controller.$setViewValue(controller.$viewValue.substring(0, controller.$viewValue.length - 1));
226
+ return;
227
+ }
228
+ if(values.length > limit) values = values.slice(0, limit);
229
+ var isVisible = typeahead.$isVisible();
230
+ isVisible && typeahead.update(values);
231
+ // Do not re-queue an update if a correct value has been selected
232
+ if(values.length === 1 && values[0].value === newValue) return;
233
+ !isVisible && typeahead.update(values);
234
+ // Queue a new rendering that will leverage collection loading
235
+ controller.$render();
236
+ });
237
+ });
238
+
239
+ // modelValue -> $formatters -> viewValue
240
+ controller.$formatters.push(function(modelValue) {
241
+ // console.warn('$formatter("%s"): modelValue=%o (%o)', element.attr('ng-model'), modelValue, typeof modelValue);
242
+ var displayValue = parsedOptions.displayValue(modelValue);
243
+ return displayValue === undefined ? '' : displayValue;
244
+ });
245
+
246
+ // Model rendering in view
247
+ controller.$render = function () {
248
+ // console.warn('$render', element.attr('ng-model'), 'controller.$modelValue', typeof controller.$modelValue, controller.$modelValue, 'controller.$viewValue', typeof controller.$viewValue, controller.$viewValue);
249
+ if(controller.$isEmpty(controller.$viewValue)) return element.val('');
250
+ var index = typeahead.$getIndex(controller.$modelValue);
251
+ var selected = angular.isDefined(index) ? typeahead.$scope.$matches[index].label : controller.$viewValue;
252
+ selected = angular.isObject(selected) ? parsedOptions.displayValue(selected) : selected;
253
+ element.val(selected ? selected.toString().replace(/<(?:.|\n)*?>/gm, '').trim() : '');
254
+ };
255
+
256
+ // Garbage collection
257
+ scope.$on('$destroy', function() {
258
+ if (typeahead) typeahead.destroy();
259
+ options = null;
260
+ typeahead = null;
261
+ });
262
+
263
+ }
264
+ };
265
+
266
+ }]);
@@ -0,0 +1,9 @@
1
+ /**
2
+ * angular-strap
3
+ * @version v2.1.6 - 2015-01-11
4
+ * @link http://mgcrea.github.io/angular-strap
5
+ * @author Olivier Louvignes (olivier@mg-crea.com)
6
+ * @license MIT License, http://www.opensource.org/licenses/MIT
7
+ */
8
+ "use strict";angular.module("mgcrea.ngStrap.typeahead",["mgcrea.ngStrap.tooltip","mgcrea.ngStrap.helpers.parseOptions"]).provider("$typeahead",function(){var e=this.defaults={animation:"am-fade",prefixClass:"typeahead",prefixEvent:"$typeahead",placement:"bottom-left",template:"typeahead/typeahead.tpl.html",trigger:"focus",container:!1,keyboard:!0,html:!1,delay:0,minLength:1,filter:"filter",limit:6,comparator:""};this.$get=["$window","$rootScope","$tooltip","$timeout",function(t,n,a,i){function o(t,n,o){var r={},l=angular.extend({},e,o);r=a(t,l);var c=o.scope,s=r.$scope;s.$resetMatches=function(){s.$matches=[],s.$activeIndex=0},s.$resetMatches(),s.$activate=function(e){s.$$postDigest(function(){r.activate(e)})},s.$select=function(e){s.$$postDigest(function(){r.select(e)})},s.$isVisible=function(){return r.$isVisible()},r.update=function(e){s.$matches=e,s.$activeIndex>=e.length&&(s.$activeIndex=0)},r.activate=function(e){s.$activeIndex=e},r.select=function(e){var t=s.$matches[e].value;n.$setViewValue(t),n.$render(),s.$resetMatches(),c&&c.$digest(),s.$emit(l.prefixEvent+".select",t,e,r)},r.$isVisible=function(){return l.minLength&&n?s.$matches.length&&angular.isString(n.$viewValue)&&n.$viewValue.length>=l.minLength:!!s.$matches.length},r.$getIndex=function(e){var t=s.$matches.length,n=t;if(t){for(n=t;n--&&s.$matches[n].value!==e;);if(!(0>n))return n}},r.$onMouseDown=function(e){e.preventDefault(),e.stopPropagation()},r.$onKeyDown=function(e){/(38|40|13)/.test(e.keyCode)&&(r.$isVisible()&&(e.preventDefault(),e.stopPropagation()),13===e.keyCode&&s.$matches.length?r.select(s.$activeIndex):38===e.keyCode&&s.$activeIndex>0?s.$activeIndex--:40===e.keyCode&&s.$activeIndex<s.$matches.length-1?s.$activeIndex++:angular.isUndefined(s.$activeIndex)&&(s.$activeIndex=0),s.$digest())};var u=r.show;r.show=function(){u(),i(function(){r.$element.on("mousedown",r.$onMouseDown),l.keyboard&&t.on("keydown",r.$onKeyDown)},0,!1)};var $=r.hide;return r.hide=function(){r.$element.off("mousedown",r.$onMouseDown),l.keyboard&&t.off("keydown",r.$onKeyDown),$()},r}angular.element(t.document.body);return o.defaults=e,o}]}).directive("bsTypeahead",["$window","$parse","$q","$typeahead","$parseOptions",function(e,t,n,a,i){var o=a.defaults;return{restrict:"EAC",require:"ngModel",link:function(e,t,n,r){var l={scope:e};angular.forEach(["placement","container","delay","trigger","keyboard","html","animation","template","filter","limit","minLength","watchOptions","selectMode","comparator","id"],function(e){angular.isDefined(n[e])&&(l[e]=n[e])});var c=l.filter||o.filter,s=l.limit||o.limit,u=l.comparator||o.comparator,$=n.ngOptions;c&&($+=" | "+c+":$viewValue"),u&&($+=":"+u),s&&($+=" | limitTo:"+s);var d=i($),f=a(t,r,l);if(l.watchOptions){var p=d.$match[7].replace(/\|.+/,"").replace(/\(.*\)/g,"").trim();e.$watch(p,function(){d.valuesFn(e,r).then(function(e){f.update(e),r.$render()})},!0)}e.$watch(n.ngModel,function(t){e.$modelValue=t,d.valuesFn(e,r).then(function(e){if(l.selectMode&&!e.length&&t.length>0)return void r.$setViewValue(r.$viewValue.substring(0,r.$viewValue.length-1));e.length>s&&(e=e.slice(0,s));var n=f.$isVisible();n&&f.update(e),(1!==e.length||e[0].value!==t)&&(!n&&f.update(e),r.$render())})}),r.$formatters.push(function(e){var t=d.displayValue(e);return void 0===t?"":t}),r.$render=function(){if(r.$isEmpty(r.$viewValue))return t.val("");var e=f.$getIndex(r.$modelValue),n=angular.isDefined(e)?f.$scope.$matches[e].label:r.$viewValue;n=angular.isObject(n)?d.displayValue(n):n,t.val(n?n.toString().replace(/<(?:.|\n)*?>/gm,"").trim():"")},e.$on("$destroy",function(){f&&f.destroy(),l=null,f=null})}}}]);
9
+ //# sourceMappingURL=typeahead.min.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["typeahead/typeahead.js"],"names":[],"mappings":"qBASM,OAAA,4BAAa,yBAAA,iDAEb,aAAU,cAEV,GAAW,KAAA,UACX,UAAU,UACV,YAAM,YACN,YAAO,aACP,UAAW,cACX,SAAQ,+BACR,QAAO,QACP,WAAA,sBAGF,MAAK,cAEH,OAAI,iBAEJ,WAAS,sFAOP,GAAsB,EAAS,EAAA,GAE/B,GAAI,MAGF,EAAM,QAAW,UAAA,EAAA,WAGnB,IAAA,GAAM,EAAA,mBAGJ,cAAmB,aACjB,kDAKF,UAAM,SAAa,KACjB,aAAW,8BAKb,QAAO,SAAW,8CAMlB,WAAiB,WACjB,MAAG,GAAM,cAKX,EAAW,OAAA,SAAW,GACpB,EAAM,SAAA,kDAMN,SAAW,SAAc,GACzB,EAAA,aAAW,wBAIX,GAAA,GAAY,EAAA,SAAQ,GAAc,uDAKpC,GAAW,EAAa,YAEpB,MAAS,EAAM,YAAS,UAAA,EAAA,EAAA,4BAM5B,MAAA,GAAW,WAAY,EAIhB,EAAM,SAAS,QAAG,QAAiB,SAAA,EAAA,aAAA,EAAA,WAAA,QAAA,EAAA,YAHhC,EAAM,SAAS,UAMhB,UAAA,SAAA,qCAGT,IAAA,EAAA,EAAW,+BAGT,KAAI,EAAJ,gBAII,aAAkB,SAAI,sBAG1B,EAAG,2EAOD,EAAW,uDAMG,OAAX,SAAW,EAAY,SAAM,OAClC,EAAM,OAAA,EAAA,gEAKc,KAAlB,EAAO,SAAW,EAAA,aAAA,EAAA,SAAA,OAAA,EAAA,EAAA,eACtB,QAAkB,YAAW,EAAA,gBAAA,EAAA,aAAA,GAC3B,EAAA,eAKE,GAAG,EAAQ,OACT,KAAW,4BAKb,EAAO,SAAW,GAAA,YAAA,EAAA,cACtB,EAAW,UACT,EAAW,GAAA,UAAa,EAAa,aAEnC,GAAA,0CAKJ,EAAO,SAAA,IAAA,YAAA,EAAA,wDAIT,OA/HM,QAAU,QAAQ,EAAW,SAAU,YAsIhD,GAAU,SAAA,kBAOD,eAAS,UAAgB,SAAS,KAAM,aAAY,gBAAA,SAAA,EAAA,EAAA,EAAA,EAAA,oCAKnD,+CAKL,GAAI,IAAQ,MAAQ,EACpB,SAAI,SAAa,YAAQ,YAAc,QAAS,UAAA,WAAA,OAAA,YAAA,WAAA,SAAA,QAAA,YAAA,eAAA,aAAA,aAAA,MAAA,SAAA,yCAKhD,IAAG,GAAO,EAAA,QAAa,EAAgB,OACnC,EAAA,EAAgB,OAAA,EAAc,mCAG9B,EAAY,EAAA,sDAGb,IAAA,GAAQ,cAAc,8BAOnB,aAAW,IAEZ,GAAA,EAAA,OAAA,GAAA,QAAA,OAAA,IAAA,QAAA,UAAA,IAAA,8DAIC,EAAO,OAAK,mBAGhB,KAIE,OAAG,EAAQ,QAAA,SAAe,KAExB,YAAA,uBAEC,SAAO,0CAKT,WADD,GAAU,cAAgB,EAAU,WAAU,UAAU,EAAA,EAAA,WAAA,OAAA,GAGxD,GAAA,OAAW,IAAA,EAAA,EAAA,MAAA,EAAA,0EAKf,GAAW,EAAiB,OAAA,GAE1B,EAAI,eAKN,EAAW,YAAU,KAAA,SAAY,GAE/B,GAAG,GAAW,EAAS,aAAW,EAClC,OAAsB,UAAlB,EAA4B,GAAA,qEAOlC,IAAM,GAAI,EAAY,UAAW,EAAA,aAC3B,EAAW,QAAA,UAAU,GAAA,EAAA,OAAA,SAAA,GAAA,MAAA,EAAA,UACzB,GAAU,QAAA,SAAA,GAAA,EAAA,aAAA,GAAA,EACV,EAAA,IAAY,EAAA,EAAA,WAAA,QAAA,iBAAA,IAAA,OAAA,gDAMjB,EAAA","file":"typeahead.min.js","sourcesContent":["'use strict';\n\nangular.module('mgcrea.ngStrap.typeahead', ['mgcrea.ngStrap.tooltip', 'mgcrea.ngStrap.helpers.parseOptions'])\n\n .provider('$typeahead', function() {\n\n var defaults = this.defaults = {\n animation: 'am-fade',\n prefixClass: 'typeahead',\n prefixEvent: '$typeahead',\n placement: 'bottom-left',\n template: 'typeahead/typeahead.tpl.html',\n trigger: 'focus',\n container: false,\n keyboard: true,\n html: false,\n delay: 0,\n minLength: 1,\n filter: 'filter',\n limit: 6,\n comparator: ''\n };\n\n this.$get = function($window, $rootScope, $tooltip, $timeout) {\n\n var bodyEl = angular.element($window.document.body);\n\n function TypeaheadFactory(element, controller, config) {\n\n var $typeahead = {};\n\n // Common vars\n var options = angular.extend({}, defaults, config);\n\n $typeahead = $tooltip(element, options);\n var parentScope = config.scope;\n var scope = $typeahead.$scope;\n\n scope.$resetMatches = function(){\n scope.$matches = [];\n scope.$activeIndex = 0;\n };\n scope.$resetMatches();\n\n scope.$activate = function(index) {\n scope.$$postDigest(function() {\n $typeahead.activate(index);\n });\n };\n\n scope.$select = function(index, evt) {\n scope.$$postDigest(function() {\n $typeahead.select(index);\n });\n };\n\n scope.$isVisible = function() {\n return $typeahead.$isVisible();\n };\n\n // Public methods\n\n $typeahead.update = function(matches) {\n scope.$matches = matches;\n if(scope.$activeIndex >= matches.length) {\n scope.$activeIndex = 0;\n }\n };\n\n $typeahead.activate = function(index) {\n scope.$activeIndex = index;\n };\n\n $typeahead.select = function(index) {\n var value = scope.$matches[index].value;\n // console.log('$setViewValue', value);\n controller.$setViewValue(value);\n controller.$render();\n scope.$resetMatches();\n if(parentScope) parentScope.$digest();\n // Emit event\n scope.$emit(options.prefixEvent + '.select', value, index, $typeahead);\n };\n\n // Protected methods\n\n $typeahead.$isVisible = function() {\n if(!options.minLength || !controller) {\n return !!scope.$matches.length;\n }\n // minLength support\n return scope.$matches.length && angular.isString(controller.$viewValue) && controller.$viewValue.length >= options.minLength;\n };\n\n $typeahead.$getIndex = function(value) {\n var l = scope.$matches.length, i = l;\n if(!l) return;\n for(i = l; i--;) {\n if(scope.$matches[i].value === value) break;\n }\n if(i < 0) return;\n return i;\n };\n\n $typeahead.$onMouseDown = function(evt) {\n // Prevent blur on mousedown\n evt.preventDefault();\n evt.stopPropagation();\n };\n\n $typeahead.$onKeyDown = function(evt) {\n if(!/(38|40|13)/.test(evt.keyCode)) return;\n\n // Let ngSubmit pass if the typeahead tip is hidden\n if($typeahead.$isVisible()) {\n evt.preventDefault();\n evt.stopPropagation();\n }\n\n // Select with enter\n if(evt.keyCode === 13 && scope.$matches.length) {\n $typeahead.select(scope.$activeIndex);\n }\n\n // Navigate with keyboard\n else if(evt.keyCode === 38 && scope.$activeIndex > 0) scope.$activeIndex--;\n else if(evt.keyCode === 40 && scope.$activeIndex < scope.$matches.length - 1) scope.$activeIndex++;\n else if(angular.isUndefined(scope.$activeIndex)) scope.$activeIndex = 0;\n scope.$digest();\n };\n\n // Overrides\n\n var show = $typeahead.show;\n $typeahead.show = function() {\n show();\n // use timeout to hookup the events to prevent\n // event bubbling from being processed imediately.\n $timeout(function() {\n $typeahead.$element.on('mousedown', $typeahead.$onMouseDown);\n if(options.keyboard) {\n element.on('keydown', $typeahead.$onKeyDown);\n }\n }, 0, false);\n };\n\n var hide = $typeahead.hide;\n $typeahead.hide = function() {\n $typeahead.$element.off('mousedown', $typeahead.$onMouseDown);\n if(options.keyboard) {\n element.off('keydown', $typeahead.$onKeyDown);\n }\n hide();\n };\n\n return $typeahead;\n\n }\n\n TypeaheadFactory.defaults = defaults;\n return TypeaheadFactory;\n\n };\n\n })\n\n .directive('bsTypeahead', function($window, $parse, $q, $typeahead, $parseOptions) {\n\n var defaults = $typeahead.defaults;\n\n return {\n restrict: 'EAC',\n require: 'ngModel',\n link: function postLink(scope, element, attr, controller) {\n\n // Directive options\n var options = {scope: scope};\n angular.forEach(['placement', 'container', 'delay', 'trigger', 'keyboard', 'html', 'animation', 'template', 'filter', 'limit', 'minLength', 'watchOptions', 'selectMode', 'comparator', 'id'], function(key) {\n if(angular.isDefined(attr[key])) options[key] = attr[key];\n });\n\n // Build proper ngOptions\n var filter = options.filter || defaults.filter;\n var limit = options.limit || defaults.limit;\n var comparator = options.comparator || defaults.comparator;\n\n var ngOptions = attr.ngOptions;\n if(filter) ngOptions += ' | ' + filter + ':$viewValue';\n if (comparator) ngOptions += ':' + comparator;\n if(limit) ngOptions += ' | limitTo:' + limit;\n var parsedOptions = $parseOptions(ngOptions);\n\n // Initialize typeahead\n var typeahead = $typeahead(element, controller, options);\n\n // Watch options on demand\n if(options.watchOptions) {\n // Watch ngOptions values before filtering for changes, drop function calls\n var watchedOptions = parsedOptions.$match[7].replace(/\\|.+/, '').replace(/\\(.*\\)/g, '').trim();\n scope.$watch(watchedOptions, function (newValue, oldValue) {\n // console.warn('scope.$watch(%s)', watchedOptions, newValue, oldValue);\n parsedOptions.valuesFn(scope, controller).then(function (values) {\n typeahead.update(values);\n controller.$render();\n });\n }, true);\n }\n\n // Watch model for changes\n scope.$watch(attr.ngModel, function(newValue, oldValue) {\n // console.warn('$watch', element.attr('ng-model'), newValue);\n scope.$modelValue = newValue; // Publish modelValue on scope for custom templates\n parsedOptions.valuesFn(scope, controller)\n .then(function(values) {\n // Prevent input with no future prospect if selectMode is truthy\n // @TODO test selectMode\n if(options.selectMode && !values.length && newValue.length > 0) {\n controller.$setViewValue(controller.$viewValue.substring(0, controller.$viewValue.length - 1));\n return;\n }\n if(values.length > limit) values = values.slice(0, limit);\n var isVisible = typeahead.$isVisible();\n isVisible && typeahead.update(values);\n // Do not re-queue an update if a correct value has been selected\n if(values.length === 1 && values[0].value === newValue) return;\n !isVisible && typeahead.update(values);\n // Queue a new rendering that will leverage collection loading\n controller.$render();\n });\n });\n\n // modelValue -> $formatters -> viewValue\n controller.$formatters.push(function(modelValue) {\n // console.warn('$formatter(\"%s\"): modelValue=%o (%o)', element.attr('ng-model'), modelValue, typeof modelValue);\n var displayValue = parsedOptions.displayValue(modelValue);\n return displayValue === undefined ? '' : displayValue;\n });\n\n // Model rendering in view\n controller.$render = function () {\n // console.warn('$render', element.attr('ng-model'), 'controller.$modelValue', typeof controller.$modelValue, controller.$modelValue, 'controller.$viewValue', typeof controller.$viewValue, controller.$viewValue);\n if(controller.$isEmpty(controller.$viewValue)) return element.val('');\n var index = typeahead.$getIndex(controller.$modelValue);\n var selected = angular.isDefined(index) ? typeahead.$scope.$matches[index].label : controller.$viewValue;\n selected = angular.isObject(selected) ? parsedOptions.displayValue(selected) : selected;\n element.val(selected ? selected.toString().replace(/<(?:.|\\n)*?>/gm, '').trim() : '');\n };\n\n // Garbage collection\n scope.$on('$destroy', function() {\n if (typeahead) typeahead.destroy();\n options = null;\n typeahead = null;\n });\n\n }\n };\n\n });\n"],"sourceRoot":"/source/"}
@@ -0,0 +1,14 @@
1
+ /**
2
+ * angular-strap
3
+ * @version v2.1.6 - 2015-01-11
4
+ * @link http://mgcrea.github.io/angular-strap
5
+ * @author Olivier Louvignes (olivier@mg-crea.com)
6
+ * @license MIT License, http://www.opensource.org/licenses/MIT
7
+ */
8
+ 'use strict';
9
+
10
+ angular.module('mgcrea.ngStrap.typeahead').run(['$templateCache', function($templateCache) {
11
+
12
+ $templateCache.put('typeahead/typeahead.tpl.html', '<ul tabindex="-1" class="typeahead dropdown-menu" ng-show="$isVisible()" role="select"><li role="presentation" ng-repeat="match in $matches" ng-class="{active: $index == $activeIndex}"><a role="menuitem" tabindex="-1" ng-click="$select($index, $event)" ng-bind="match.label"></a></li></ul>');
13
+
14
+ }]);
@@ -0,0 +1,8 @@
1
+ /**
2
+ * angular-strap
3
+ * @version v2.1.6 - 2015-01-11
4
+ * @link http://mgcrea.github.io/angular-strap
5
+ * @author Olivier Louvignes (olivier@mg-crea.com)
6
+ * @license MIT License, http://www.opensource.org/licenses/MIT
7
+ */
8
+ "use strict";angular.module("mgcrea.ngStrap.typeahead").run(["$templateCache",function(e){e.put("typeahead/typeahead.tpl.html",'<ul tabindex="-1" class="typeahead dropdown-menu" ng-show="$isVisible()" role="select"><li role="presentation" ng-repeat="match in $matches" ng-class="{active: $index == $activeIndex}"><a role="menuitem" tabindex="-1" ng-click="$select($index, $event)" ng-bind="match.label"></a></li></ul>')}]);
@@ -0,0 +1,489 @@
1
+ 'use strict';
2
+ // bower install angular#^1.2 --save; bower install angular-animate#^1.2 angular-i18n#^1.2 angular-mocks#^1.2 angular-route#^1.2 angular-sanitize#^1.2 angular-scenario#^1.2 --save-dev
3
+ // bower install angular#^1.3 --save; bower install angular-animate#^1.3 angular-i18n#^1.3 angular-mocks#^1.3 angular-route#^1.3 angular-sanitize#^1.3 angular-scenario#^1.3 --save-dev
4
+
5
+ var gulp = require('gulp');
6
+ var path = require('path');
7
+ var util = require('util');
8
+ var gutil = require('gulp-util');
9
+ var merge = require('merge-stream');
10
+ var changed = require('gulp-changed');
11
+ var rename = require('gulp-rename');
12
+ var pkg = require('./package.json');
13
+ var chalk = require('chalk');
14
+ var fs = require('fs');
15
+
16
+ // CONFIG
17
+ //
18
+
19
+ var src = {
20
+ cwd: 'src',
21
+ dist: 'dist',
22
+ scripts: '*/*.js',
23
+ index: 'module.js',
24
+ templates: '*/*.tpl.html',
25
+ };
26
+
27
+ var docs = {
28
+ cwd: 'docs',
29
+ tmp: '.tmp',
30
+ dist: 'pages',
31
+ index: 'index.html',
32
+ views: 'views/**/*.html',
33
+ scripts: 'scripts/**/*.js',
34
+ images: 'images/{,*/}*.{jpg,png,svg}',
35
+ styles: 'styles/*.less',
36
+ watch: {
37
+ styles: 'styles/**/*.less'
38
+ }
39
+ };
40
+
41
+ var ports = {
42
+ docs: 9090,
43
+ pages: 9090
44
+ };
45
+
46
+ var banner = gutil.template('/**\n' +
47
+ ' * <%= pkg.name %>\n' +
48
+ ' * @version v<%= pkg.version %> - <%= today %>\n' +
49
+ ' * @link <%= pkg.homepage %>\n' +
50
+ ' * @author <%= pkg.author.name %> (<%= pkg.author.email %>)\n' +
51
+ ' * @license MIT License, http://www.opensource.org/licenses/MIT\n' +
52
+ ' */\n', {file: '', pkg: pkg, today: new Date().toISOString().substr(0, 10)});
53
+
54
+
55
+ // CLEAN
56
+ //
57
+ var clean = require('gulp-clean');
58
+ gulp.task('clean:tmp', function() {
59
+ return gulp.src(['.tmp/*'], {read: false})
60
+ .pipe(clean());
61
+ });
62
+ gulp.task('clean:test', function() {
63
+ return gulp.src(['test/.tmp/*', 'test/coverage/*'], {read: false})
64
+ .pipe(clean());
65
+ });
66
+ gulp.task('clean:dist', function() {
67
+ return gulp.src([src.dist + '/*'], {read: false})
68
+ .pipe(clean());
69
+ });
70
+ gulp.task('clean:pages', function() {
71
+ return gulp.src([docs.dist + '/*', '!' + docs.dist + '/1.0', '!' + docs.dist + '/static', '!' + docs.dist + '/dist', '!' + docs.dist + '/.git'], {read: false})
72
+ .pipe(clean());
73
+ });
74
+
75
+
76
+ // CONNECT
77
+ //
78
+ var connect = require('gulp-connect');
79
+ gulp.task('connect:docs', function() {
80
+ connect.server({
81
+ root: ['.tmp', '.dev', docs.cwd, src.cwd],
82
+ port: ports.docs,
83
+ livereload: true
84
+ });
85
+ });
86
+ gulp.task('connect:pages', function() {
87
+ connect.server({
88
+ root: [docs.dist],
89
+ port: ports.pages,
90
+ });
91
+ });
92
+ var chrome = require('gulp-open');
93
+ gulp.task('open:docs', function(){
94
+ gulp.src(docs.index, {cwd: docs.cwd})
95
+ .pipe(chrome('', {url: 'http://localhost:' + ports.docs}));
96
+ });
97
+ gulp.task('open:pages', function(){
98
+ gulp.src(docs.index, {cwd: docs.dist})
99
+ .pipe(chrome('', {url: 'http://localhost:' + ports.pages}));
100
+ });
101
+
102
+
103
+ // WATCH
104
+ //
105
+
106
+ var watch = require('gulp-watch');
107
+ gulp.task('watch:docs', function() {
108
+ watch(docs.scripts, {cwd: docs.cwd}, function(files) {
109
+ return files.pipe(connect.reload());
110
+ });
111
+ watch(docs.watch.styles, {cwd: docs.cwd}, function(files) {
112
+ return gulp.start('styles:docs');
113
+ });
114
+ watch([docs.index, docs.views], {cwd: docs.cwd}, function(files) {
115
+ return files.pipe(connect.reload());
116
+ });
117
+ });
118
+ gulp.task('watch:dev', function() {
119
+ watch(src.scripts, {cwd: src.cwd}, function(files) {
120
+ return files.pipe(connect.reload());
121
+ });
122
+ });
123
+
124
+
125
+ // SCRIPTS
126
+ //
127
+ var uglify = require('gulp-uglify');
128
+ var ngAnnotate = require('gulp-ng-annotate');
129
+ var ngmin = require('gulp-ngmin');
130
+ var concat = require('gulp-concat-util');
131
+ var sourcemaps = require('gulp-sourcemaps');
132
+ gulp.task('scripts:dist', function(foo) {
133
+
134
+ var merged = merge(
135
+
136
+ // Build unified package
137
+ gulp.src([src.index, src.scripts], {cwd: src.cwd})
138
+ .pipe(sourcemaps.init())
139
+ .pipe(ngAnnotate())
140
+ .pipe(concat(pkg.name + '.js', {process: function(src) { return '// Source: ' + path.basename(this.path) + '\n' + (src.trim() + '\n').replace(/(^|\n)[ \t]*('use strict'|"use strict");?\s*/g, '$1'); }}))
141
+ .pipe(concat.header('(function(window, document, undefined) {\n\'use strict\';\n'))
142
+ .pipe(concat.footer('\n})(window, document);\n'))
143
+ .pipe(concat.header(banner))
144
+ .pipe(gulp.dest(src.dist))
145
+ .pipe(rename(function(path) { path.extname = '.min.js'; }))
146
+ .pipe(uglify())
147
+ .pipe(concat.header(banner))
148
+ .pipe(sourcemaps.write('./'))
149
+ .pipe(gulp.dest(src.dist)),
150
+
151
+ // Build individual modules
152
+ gulp.src(src.scripts, {cwd: src.cwd})
153
+ .pipe(sourcemaps.init())
154
+ .pipe(ngAnnotate())
155
+ .pipe(rename(function(path){ path.dirname = ''; })) // flatten
156
+ .pipe(concat.header(banner))
157
+ .pipe(gulp.dest(path.join(src.dist, 'modules')))
158
+ .pipe(rename(function(path) { path.extname = '.min.js'; }))
159
+ .pipe(uglify())
160
+ .pipe(concat.header(banner))
161
+ .pipe(sourcemaps.write('./'))
162
+ .pipe(gulp.dest(path.join(src.dist, 'modules')))
163
+
164
+ );
165
+
166
+ merged.on('error', function(err) {
167
+ gutil.log(chalk.red(util.format('Plugin error: %s', err.message)));
168
+ });
169
+
170
+ return merged;
171
+
172
+ });
173
+ gulp.task('scripts:pages', function(foo) {
174
+
175
+ var merged = merge(
176
+
177
+ // Build unified package
178
+ gulp.src([src.index, src.scripts], {cwd: src.cwd})
179
+ .pipe(sourcemaps.init())
180
+ .pipe(ngmin())
181
+ .pipe(concat(pkg.name + '.js', {process: function(src) { return '// Source: ' + path.basename(this.path) + '\n' + (src.trim() + '\n').replace(/(^|\n)[ \t]*('use strict'|"use strict");?\s*/g, '$1'); }}))
182
+ .pipe(concat.header('(function(window, document, undefined) {\n\'use strict\';\n'))
183
+ .pipe(concat.footer('\n})(window, document);\n'))
184
+ .pipe(concat.header(banner))
185
+ .pipe(gulp.dest(path.join(docs.dist, 'scripts')))
186
+ .pipe(rename(function(path) { path.extname = '.min.js'; }))
187
+ .pipe(uglify())
188
+ .pipe(concat.header(banner))
189
+ .pipe(sourcemaps.write('./'))
190
+ .pipe(gulp.dest(path.join(docs.dist, 'scripts')))
191
+
192
+ );
193
+
194
+ merged.on('error', function(err) {
195
+ gutil.log(chalk.red(util.format('Plugin error: %s', err.message)));
196
+ });
197
+
198
+ return merged;
199
+
200
+ });
201
+
202
+ // TEMPLATES
203
+ //
204
+ var ngtemplate = require('gulp-ngtemplate');
205
+ var uglify = require('gulp-uglify');
206
+ var ngmin = require('gulp-ngmin');
207
+ var createModuleName = function(src) { return 'mgcrea.ngStrap.' + src.split(path.sep)[0]; };
208
+ gulp.task('templates:dist', function() {
209
+
210
+ var merged = merge(
211
+
212
+ // Build unified package
213
+ gulp.src(src.templates, {cwd: src.cwd})
214
+ .pipe(htmlmin({removeComments: true, collapseWhitespace: true}))
215
+ .pipe(ngtemplate({module: createModuleName}))
216
+ .pipe(ngAnnotate())
217
+ .pipe(concat(pkg.name + '.tpl.js', {process: function(src) { return '// Source: ' + path.basename(this.path) + '\n' + (src.trim() + '\n').replace(/(^|\n)[ \t]*('use strict'|"use strict");?\s*/g, '$1'); }}))
218
+ .pipe(concat.header('(function(window, document, undefined) {\n\'use strict\';\n\n'))
219
+ .pipe(concat.footer('\n\n})(window, document);\n'))
220
+ .pipe(concat.header(banner))
221
+ .pipe(gulp.dest(src.dist))
222
+ .pipe(rename(function(path) { path.extname = '.min.js'; }))
223
+ .pipe(uglify())
224
+ .pipe(concat.header(banner))
225
+ .pipe(gulp.dest(src.dist)),
226
+
227
+ // Build individual modules
228
+ gulp.src(src.templates, {cwd: src.cwd})
229
+ .pipe(htmlmin({removeComments: true, collapseWhitespace: true}))
230
+ .pipe(ngtemplate({module: createModuleName}))
231
+ .pipe(ngAnnotate())
232
+ .pipe(rename(function(path){ path.dirname = ''; })) // flatten
233
+ .pipe(concat.header(banner))
234
+ .pipe(gulp.dest(path.join(src.dist, 'modules')))
235
+ .pipe(rename(function(path) { path.extname = '.min.js'; }))
236
+ .pipe(uglify())
237
+ .pipe(concat.header(banner))
238
+ .pipe(gulp.dest(path.join(src.dist, 'modules')))
239
+
240
+ );
241
+
242
+ merged.on('error', function(err) {
243
+ gutil.log(chalk.red(util.format('Plugin error: %s', err.message)));
244
+ });
245
+
246
+ return merged;
247
+
248
+ });
249
+ gulp.task('templates:pages', function() {
250
+
251
+ var merged = merge(
252
+
253
+ // Build docs partials
254
+ gulp.src(['views/sidebar.html', 'views/partials/*.html'], {cwd: docs.cwd, base: docs.cwd})
255
+ .pipe(htmlmin({removeComments: true, collapseWhitespace: true}))
256
+ .pipe(ngtemplate({module: 'mgcrea.ngStrapDocs'}))
257
+ .pipe(ngAnnotate())
258
+ .pipe(concat('docs.tpl.js', {process: function(src) { return '// Source: ' + path.basename(this.path) + '\n' + (src.trim() + '\n').replace(/(^|\n)[ \t]*('use strict'|"use strict");?\s*/g, '$1'); }}))
259
+ .pipe(concat.header('(function(window, document, undefined) {\n\'use strict\';\n\n'))
260
+ .pipe(concat.footer('\n\n})(window, document);\n'))
261
+ .pipe(gulp.dest(path.join(docs.dist, 'scripts')))
262
+ .pipe(rename(function(path) { path.extname = '.min.js'; }))
263
+ .pipe(uglify())
264
+ .pipe(concat.header(banner))
265
+ .pipe(gulp.dest(path.join(docs.dist, 'scripts'))),
266
+
267
+ // Build demo partials
268
+ gulp.src('*/docs/*.tpl.demo.html', {cwd: src.cwd})
269
+ .pipe(htmlmin({removeComments: true, collapseWhitespace: true}))
270
+ .pipe(ngtemplate({module: 'mgcrea.ngStrapDocs'}))
271
+ .pipe(ngAnnotate())
272
+ .pipe(concat('demo.tpl.js', {process: function(src) { return '// Source: ' + path.basename(this.path) + '\n' + (src.trim() + '\n').replace(/(^|\n)[ \t]*('use strict'|"use strict");?\s*/g, '$1'); }}))
273
+ .pipe(concat.header('(function(window, document, undefined) {\n\'use strict\';\n\n'))
274
+ .pipe(concat.footer('\n\n})(window, document);\n'))
275
+ .pipe(concat.header(banner))
276
+ .pipe(gulp.dest(path.join(docs.dist, 'scripts')))
277
+ .pipe(rename(function(path) { path.extname = '.min.js'; }))
278
+ .pipe(uglify())
279
+ .pipe(concat.header(banner))
280
+ .pipe(gulp.dest(path.join(docs.dist, 'scripts'))),
281
+
282
+ // Build unified package
283
+ gulp.src(src.templates, {cwd: src.cwd})
284
+ .pipe(htmlmin({removeComments: true, collapseWhitespace: true}))
285
+ .pipe(ngtemplate({module: createModuleName}))
286
+ .pipe(ngAnnotate())
287
+ .pipe(concat(pkg.name + '.tpl.js', {process: function(src) { return '// Source: ' + path.basename(this.path) + '\n' + (src.trim() + '\n').replace(/(^|\n)[ \t]*('use strict'|"use strict");?\s*/g, '$1'); }}))
288
+ .pipe(concat.header('(function(window, document, undefined) {\n\'use strict\';\n\n'))
289
+ .pipe(concat.footer('\n\n})(window, document);\n'))
290
+ .pipe(concat.header(banner))
291
+ .pipe(gulp.dest(path.join(docs.dist, 'scripts')))
292
+ .pipe(rename(function(path) { path.extname = '.min.js'; }))
293
+ .pipe(uglify())
294
+ .pipe(concat.header(banner))
295
+ .pipe(gulp.dest(path.join(docs.dist, 'scripts')))
296
+
297
+ );
298
+
299
+ merged.on('error', function(err) {
300
+ gutil.log(chalk.red(util.format('Plugin error: %s', err.message)));
301
+ });
302
+
303
+ return merged;
304
+
305
+ });
306
+ gulp.task('templates:test', function() {
307
+
308
+ // Build individual modules
309
+ return gulp.src(src.templates, {cwd: src.cwd})
310
+ .pipe(htmlmin({removeComments: true, collapseWhitespace: true}))
311
+ .pipe(ngtemplate({module: createModuleName}))
312
+ .pipe(ngmin())
313
+ .pipe(rename(function(path){ path.dirname = ''; })) // flatten
314
+ .pipe(concat.header(banner))
315
+ .pipe(gulp.dest('test/.tmp/templates'));
316
+
317
+ });
318
+
319
+
320
+ // STYLES
321
+ //
322
+ var prefix = require('gulp-autoprefixer');
323
+ var less = require('gulp-less');
324
+ var safeLess = merge(less());
325
+ safeLess.on('error', function(err) {
326
+ gutil.log(chalk.red(util.format('Plugin error: %s', err.message)));
327
+ });
328
+ gulp.task('styles:docs', function() {
329
+ return gulp.src(docs.styles, {cwd: docs.cwd, base: docs.cwd})
330
+ .pipe(changed('.tmp/styles'))
331
+ .pipe(less())
332
+ .pipe(prefix('last 1 version'))
333
+ .pipe(gulp.dest(docs.tmp))
334
+ .pipe(connect.reload());
335
+ });
336
+ gulp.task('styles:pages', function() {
337
+ return gulp.src(docs.styles, {cwd: docs.cwd, base: docs.cwd})
338
+ .pipe(safeLess)
339
+ .pipe(prefix('last 1 version', '> 1%', 'ie 8'))
340
+ .pipe(concat.header(banner))
341
+ .pipe(gulp.dest(docs.dist));
342
+ });
343
+
344
+
345
+ // VIEWS
346
+ //
347
+ var htmlmin = require('gulp-htmlmin');
348
+ var usemin = require('gulp-usemin');
349
+ var nginclude = require('gulp-nginclude');
350
+ var cleancss = require('gulp-cleancss');
351
+ gulp.task('views:pages', function() {
352
+
353
+ var merged = merge(
354
+
355
+ // Build views
356
+ // gulp.src(docs.views, {cwd: docs.cwd})
357
+ // .pipe(htmlmin({collapseWhitespace: true}))
358
+ // .pipe(gulp.dest(docs.dist)),
359
+
360
+ // Build index
361
+ gulp.src(docs.index, {cwd: docs.cwd})
362
+ .pipe(nginclude({assetsDirs: [src.cwd]}))
363
+ .pipe(usemin({
364
+ js: [ngmin(), uglify(), concat.header(banner)],
365
+ lib: ['concat'], // supeseeded by scripts:pages & templates:pages
366
+ css: [cleancss(), concat.header(banner)]
367
+ }))
368
+ .pipe(gulp.dest(docs.dist))
369
+
370
+ );
371
+
372
+ merged.on('error', function(err) {
373
+ gutil.log(chalk.red(util.format('Plugin error: %s', err.message)));
374
+ });
375
+
376
+ return merged;
377
+ });
378
+
379
+
380
+ // TEST
381
+ //
382
+ var jshint = require('gulp-jshint');
383
+ var stylish = require('jshint-stylish');
384
+ var testTimezone = '';
385
+ gulp.task('jshint', function() {
386
+ gulp.src(src.scripts, {cwd: src.cwd})
387
+ .pipe(changed(src.scripts))
388
+ .pipe(jshint())
389
+ .pipe(jshint.reporter(stylish));
390
+ });
391
+ var karma = require('karma').server;
392
+ gulp.task('karma:unit', ['templates:test'], function() {
393
+ // if testTimezone has value, set the environment timezone
394
+ // before starting karma, so PhantomJS picks up the
395
+ // timezone setting
396
+ if (testTimezone) {
397
+ console.log('Setting timezone to => [' + testTimezone + ']');
398
+ process.env.TZ = testTimezone;
399
+ }
400
+ karma.start({
401
+ configFile: path.join(__dirname, 'test/karma.conf.js'),
402
+ browsers: ['PhantomJS'],
403
+ reporters: ['dots'],
404
+ singleRun: true
405
+ }, function(code) {
406
+ gutil.log('Karma has exited with ' + code);
407
+ process.exit(code);
408
+ });
409
+ });
410
+ gulp.task('karma:server', ['templates:test'], function() {
411
+ karma.start({
412
+ configFile: path.join(__dirname, 'test/karma.conf.js'),
413
+ browsers: ['PhantomJS'],
414
+ reporters: ['progress'],
415
+ autoWatch: true,
416
+ singleRun: false
417
+ }, function(code) {
418
+ gutil.log('Karma has exited with ' + code);
419
+ process.exit(code);
420
+ });
421
+ });
422
+ // codeclimate-test-reporter
423
+ gulp.task('karma:travis', ['templates:test'], function() {
424
+ karma.start({
425
+ configFile: path.join(__dirname, 'test/karma.conf.js'),
426
+ browsers: ['PhantomJS'],
427
+ reporters: ['dots', 'coverage'],
428
+ singleRun: true
429
+ }, function(code) {
430
+ gutil.log('Karma has exited with ' + code);
431
+ process.exit(code);
432
+ // gulp.src('test/coverage/**/lcov.info')
433
+ // .pipe(coveralls())
434
+ // .on('end', function() {
435
+ // process.exit(code);
436
+ // });
437
+ });
438
+ });
439
+ gulp.task('karma:travis~1.2.0', ['templates:test'], function() {
440
+ karma.start({
441
+ configFile: path.join(__dirname, 'test/~1.2.0/karma.conf.js'),
442
+ browsers: ['PhantomJS'],
443
+ reporters: ['dots'],
444
+ singleRun: true
445
+ }, function(code) {
446
+ gutil.log('Karma has exited with ' + code);
447
+ process.exit(code);
448
+ });
449
+ });
450
+
451
+ // COPY
452
+ //
453
+ gulp.task('copy:pages', function() {
454
+ gulp.src(['favicon.ico', docs.images], {cwd: docs.cwd, base: docs.cwd})
455
+ .pipe(gulp.dest(docs.dist));
456
+ gulp.src('**/*.js', {cwd: src.dist, base: src.dist})
457
+ .pipe(gulp.dest(path.join(docs.dist, src.dist)));
458
+ });
459
+
460
+
461
+ // DEFAULT
462
+ //
463
+ var runSequence = require('run-sequence');
464
+ gulp.task('default', ['dist']);
465
+ gulp.task('build', ['dist']);
466
+ gulp.task('test', function() {
467
+ runSequence('clean:test', 'templates:test', ['jshint', 'karma:unit']);
468
+ });
469
+ gulp.task('test:timezone', function() {
470
+ // parse command line argument for optional timezone
471
+ // invoke like this:
472
+ // gulp test:timezone --Europe/Paris
473
+ var timezone = process.argv[3] || '';
474
+ testTimezone = timezone.replace(/-/g, '');
475
+ runSequence('clean:test', 'templates:test', ['jshint', 'karma:unit']);
476
+ });
477
+ gulp.task('test:server', function() {
478
+ runSequence('clean:test', 'templates:test', 'karma:server');
479
+ });
480
+ gulp.task('dist', function() {
481
+ runSequence('clean:dist', ['templates:dist', 'scripts:dist']);
482
+ });
483
+ gulp.task('pages', function() {
484
+ runSequence('clean:pages', 'styles:docs', 'views:pages', ['templates:pages', 'scripts:pages', 'copy:pages']);
485
+ });
486
+ gulp.task('serve', function() {
487
+ runSequence('clean:tmp', ['styles:docs', 'connect:docs'], ['open:docs', 'watch:docs', 'watch:dev']);
488
+ });
489
+ gulp.task('serve:pages', ['connect:pages', 'open:pages']);