sinatra-hexacta 0.0.2 → 0.3.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (50) hide show
  1. checksums.yaml +4 -4
  2. data/lib/sinatra/extensions/antiquity.rb +34 -0
  3. data/lib/sinatra/extensions/date.rb +49 -0
  4. data/lib/sinatra/extensions/generalmail.rb +26 -0
  5. data/lib/sinatra/extensions/init.rb +8 -0
  6. data/lib/sinatra/extensions/mail.rb +35 -0
  7. data/lib/sinatra/extensions/mailbuilder.rb +38 -0
  8. data/lib/sinatra/extensions/mailsender.rb +88 -0
  9. data/lib/sinatra/extensions/notification.rb +44 -0
  10. data/lib/sinatra/handlers/errors.rb +11 -4
  11. data/lib/sinatra/handlers/init.rb +3 -1
  12. data/lib/sinatra/handlers/notifications.rb +17 -28
  13. data/lib/sinatra/handlers/params.rb +26 -0
  14. data/lib/sinatra/handlers/reports.rb +28 -1
  15. data/lib/sinatra/helpers/alerts.rb +27 -0
  16. data/lib/sinatra/helpers/cas.rb +92 -0
  17. data/lib/sinatra/helpers/charts.rb +21 -5
  18. data/lib/sinatra/helpers/init.rb +4 -0
  19. data/lib/sinatra/helpers/inputs.rb +3 -3
  20. data/lib/sinatra/helpers/libraries.rb +3 -3
  21. data/lib/sinatra/helpers/reports.rb +27 -0
  22. data/lib/sinatra/helpers/schedule.rb +68 -0
  23. data/lib/sinatra/helpers/subscriptions.rb +1 -1
  24. data/lib/sinatra/hexacta.rb +15 -9
  25. data/lib/sinatra/public/css/app.min.1.css +132 -6
  26. data/lib/sinatra/public/js/app.js +49 -42
  27. data/lib/sinatra/public/vendors/chartist/chartist-plugin-legend.js +237 -0
  28. data/lib/sinatra/public/vendors/typeahead.js/typeahead.bundle.min.js +1 -2
  29. data/lib/sinatra/views/alerts/empty.slim +7 -0
  30. data/lib/sinatra/views/alerts/error.slim +7 -0
  31. data/lib/sinatra/views/alerts/info.slim +7 -0
  32. data/lib/sinatra/views/alerts/warning.slim +7 -0
  33. data/lib/sinatra/views/charts/bar.slim +56 -0
  34. data/lib/sinatra/views/charts/gauge.slim +30 -0
  35. data/lib/sinatra/views/charts/{simple_line.slim → line.slim} +7 -8
  36. data/lib/sinatra/views/charts/pie.slim +34 -0
  37. data/lib/sinatra/views/charts/stacked_bar.slim +36 -0
  38. data/lib/sinatra/views/inputs/multiple_select.slim +4 -0
  39. data/lib/sinatra/views/inputs/select.slim +3 -0
  40. data/lib/sinatra/views/libraries/include_js_after.slim +0 -24
  41. data/lib/sinatra/views/libraries/include_js_before.slim +1 -0
  42. data/lib/sinatra/views/notifications.slim +37 -31
  43. data/lib/sinatra/views/notifications/form.slim +4 -4
  44. data/lib/sinatra/views/notifications/new.slim +4 -4
  45. data/lib/sinatra/views/notifications/widget.slim +9 -5
  46. data/lib/sinatra/views/reports/pick_date.slim +14 -0
  47. data/lib/sinatra/views/reports/pick_dates.slim +16 -0
  48. data/lib/sinatra/views/reports/pick_month.slim +14 -0
  49. data/lib/sinatra/views/reports/pick_year.slim +14 -0
  50. metadata +30 -4
@@ -23,12 +23,30 @@ $(document).ready(function(){
23
23
  // Fix modal inside other components
24
24
  $('.modal').appendTo("body");
25
25
 
26
- if (window.top.location.hash.indexOf("#") != -1) {
27
- $("a[href=" + window.top.location.hash +"]").trigger('click');
28
- }
26
+ $( ".paginator" ).clone().appendTo( "#content" );
29
27
 
30
- $("a[data-toggle='tab']").click(function() {
31
- window.top.location.hash = $(this).attr("href");
28
+ $('form').on('submit', function(e) {
29
+ $(this).find(':input[required]').each(function() {
30
+ if ($(this).val() == "" || $(this).val() == null) {
31
+ $(this).parent().removeClass("success");
32
+ $(this).parent().addClass("error");
33
+ } else {
34
+ $(this).parent().removeClass("error");
35
+ $(this).parent().addClass("success");
36
+ }
37
+ });
38
+ if ($(this).find('.error').length == 0 ) {
39
+ $(this).find('#submit').attr('disabled','disabled');
40
+ }
41
+ });
42
+ $('.chosen[required]').on('change', function(change, deselected) { //selected OR deselected
43
+ if ($(this).val() == "" || $(this).val() == null) {
44
+ $(this).parent().removeClass("success");
45
+ $(this).parent().addClass("error");
46
+ } else {
47
+ $(this).parent().removeClass("error");
48
+ $(this).parent().addClass("success");
49
+ }
32
50
  });
33
51
  /* --------------------------------------------------------
34
52
  Layout
@@ -704,33 +722,6 @@ function enableButtons() {
704
722
  };
705
723
  })( jQuery );
706
724
 
707
- /*
708
- * Bootstrap Growl - Notifications popups
709
- */
710
- function notify(message, type){
711
- $('[data-growl="container"]').find('[data-growl="dismiss"]').trigger('click');
712
- $.growl({
713
- message: message
714
- },{
715
- type: type,
716
- allow_dismiss: false,
717
- label: 'Cancel',
718
- className: 'btn-xs btn-inverse growl-animated',
719
- placement: {
720
- from: 'bottom',
721
- align: 'left'
722
- },
723
- delay: 5000,
724
- animate: {
725
- enter: 'animated fadeInUp',
726
- exit: 'animated fadeOutDown'
727
- },
728
- offset: {
729
- x: 0,
730
- y: 0
731
- }
732
- });
733
- };
734
725
 
735
726
  function encodeQueryData(data)
736
727
  {
@@ -761,27 +752,43 @@ function encodeQueryData(data)
761
752
 
762
753
  function buildFilterMap(offset) {
763
754
  filter_map = {};
764
- $("#form select, #form input").each(function() {
755
+ $("#form :input").each(function() {
765
756
  if ($(this).val() != null && $(this).val() != "") {
766
- if ($(this).is(':checkbox')) {
767
- if ($(this).is(':checked')) {
768
- filter_map[$(this)[0].name] = "on";
769
- } else {
770
- filter_map[$(this)[0].name] = "off";
771
- }
772
- } else {
757
+ if ($(this)[0].name != "") {
758
+ filter_map[$(this)[0].name] = $(this).val();
759
+ }
760
+ }
761
+ });
762
+ $("#form input[type=radio]").each(function() {
763
+ if ($(this).val() != null && $(this).val() != "") {
764
+ if ($(this).is(':checked')) {
773
765
  filter_map[$(this)[0].name] = $(this).val();
774
766
  }
775
767
  }
776
768
  });
777
769
  if (offset != null) {
778
770
  filter_map["offset"] = offset;
779
- } else {
780
- filter_map["offset"] = filter_map["offset"] - 1;
781
771
  }
782
772
  return filter_map;
783
773
  }
784
774
 
775
+ function advance_search(url,offset,format) {
776
+ filter_map = buildFilterMap(offset);
777
+ filter_map["format"] = format;
778
+ if (format != 'xls') {
779
+ window.location.href = url + "?" + encodeQueryData(filter_map);
780
+ } else {
781
+ window.open(
782
+ url + "?" + encodeQueryData(filter_map),
783
+ '_blank' // <- This is what makes it open in a new window.
784
+ );
785
+ }
786
+ };
787
+
788
+ $(document).ready(function(){
789
+ $( ".paginator" ).clone().appendTo( "#content" );
790
+ });
791
+
785
792
  function read_notify(id,url) {
786
793
  $.ajax({
787
794
  url: '/notifications/' + id,
@@ -0,0 +1,237 @@
1
+ (function (root, factory) {
2
+ if (typeof define === 'function' && define.amd) {
3
+ // AMD. Register as an anonymous module.
4
+ define(['chartist'], function (chartist) {
5
+ return (root.returnExportsGlobal = factory(chartist));
6
+ });
7
+ } else if (typeof exports === 'object') {
8
+ // Node. Does not work with strict CommonJS, but
9
+ // only CommonJS-like enviroments that support module.exports,
10
+ // like Node.
11
+ module.exports = factory(require('chartist'));
12
+ } else {
13
+ root['Chartist.plugins.legend'] = factory(root.Chartist);
14
+ }
15
+ }(this, function (Chartist) {
16
+ /**
17
+ * This Chartist plugin creates a legend to show next to the chart.
18
+ *
19
+ */
20
+ 'use strict';
21
+
22
+ var defaultOptions = {
23
+ className: '',
24
+ classNames: false,
25
+ removeAll: false,
26
+ legendNames: false,
27
+ clickable: true,
28
+ onClick: null,
29
+ position: 'top'
30
+ };
31
+
32
+ Chartist.plugins = Chartist.plugins || {};
33
+
34
+ Chartist.plugins.legend = function (options) {
35
+
36
+ // Catch invalid options
37
+ if (options && options.position) {
38
+ if (!(options.position === 'top' || options.position === 'bottom' || options.position instanceof HTMLElement)) {
39
+ throw Error('The position you entered is not a valid position');
40
+ }
41
+ if (options.position instanceof HTMLElement) {
42
+ // Detatch DOM element from options object, because Chartist.extend
43
+ // currently chokes on circular references present in HTMLElements
44
+ var cachedDOMPosition = options.position;
45
+ delete options.position;
46
+ }
47
+ }
48
+
49
+ options = Chartist.extend({}, defaultOptions, options);
50
+
51
+ if (cachedDOMPosition) {
52
+ // Reattatch the DOM Element position if it was removed before
53
+ options.position = cachedDOMPosition
54
+ }
55
+
56
+ return function legend(chart) {
57
+
58
+ function removeLegendElement() {
59
+ var legendElement = chart.container.querySelector('.ct-legend');
60
+ if (legendElement) {
61
+ legendElement.parentNode.removeChild(legendElement);
62
+ }
63
+ }
64
+
65
+ // Set a unique className for each series so that when a series is removed,
66
+ // the other series still have the same color.
67
+ function setSeriesClassNames() {
68
+ chart.data.series = chart.data.series.map(function (series, seriesIndex) {
69
+ if (typeof series !== 'object') {
70
+ series = {
71
+ value: series
72
+ };
73
+ }
74
+ series.className = series.className || chart.options.classNames.series + '-' + Chartist.alphaNumerate(seriesIndex);
75
+ return series;
76
+ });
77
+ }
78
+
79
+ function createLegendElement() {
80
+ var legendElement = document.createElement('ul');
81
+ legendElement.className = 'ct-legend';
82
+ if (chart instanceof Chartist.Pie) {
83
+ legendElement.classList.add('ct-legend-inside');
84
+ }
85
+ if (typeof options.className === 'string' && options.className.length > 0) {
86
+ legendElement.classList.add(options.className);
87
+ }
88
+ if (chart.options.width) {
89
+ legendElement.style.cssText = 'width: ' + chart.options.width + 'px;margin: 0 auto;';
90
+ }
91
+ return legendElement;
92
+ }
93
+
94
+ // Get the right array to use for generating the legend.
95
+ function getLegendNames(useLabels) {
96
+ return options.legendNames || (useLabels ? chart.data.labels : chart.data.series);
97
+ }
98
+
99
+ // Initialize the array that associates series with legends.
100
+ // -1 indicates that there is no legend associated with it.
101
+ function initSeriesMetadata(useLabels) {
102
+ var seriesMetadata = new Array(chart.data.series.length);
103
+ for (var i = 0; i < chart.data.series.length; i++) {
104
+ seriesMetadata[i] = {
105
+ data: chart.data.series[i],
106
+ label: useLabels ? chart.data.labels[i] : null,
107
+ legend: -1
108
+ };
109
+ }
110
+ return seriesMetadata;
111
+ }
112
+
113
+ function createNameElement(i, legendText, classNamesViable) {
114
+ var li = document.createElement('li');
115
+ li.classList.add('ct-series-' + i);
116
+ // Append specific class to a legend element, if viable classes are given
117
+ if (classNamesViable) {
118
+ li.classList.add(options.classNames[i]);
119
+ }
120
+ li.setAttribute('data-legend', i);
121
+ li.textContent = legendText;
122
+ return li;
123
+ }
124
+
125
+ // Append the legend element to the DOM
126
+ function appendLegendToDOM(legendElement) {
127
+ if (!(options.position instanceof HTMLElement)) {
128
+ switch (options.position) {
129
+ case 'top':
130
+ chart.container.insertBefore(legendElement, chart.container.childNodes[0]);
131
+ break;
132
+
133
+ case 'bottom':
134
+ chart.container.insertBefore(legendElement, null);
135
+ break;
136
+ }
137
+ } else {
138
+ // Appends the legend element as the last child of a given HTMLElement
139
+ options.position.insertBefore(legendElement, null);
140
+ }
141
+ }
142
+
143
+ function addClickHandler(legendElement, legends, seriesMetadata, useLabels) {
144
+ legendElement.addEventListener('click', function(e) {
145
+ var li = e.target;
146
+ if (li.parentNode !== legendElement || !li.hasAttribute('data-legend'))
147
+ return;
148
+ e.preventDefault();
149
+
150
+ var legendIndex = parseInt(li.getAttribute('data-legend'));
151
+ var legend = legends[legendIndex];
152
+
153
+ if (!legend.active) {
154
+ legend.active = true;
155
+ li.classList.remove('inactive');
156
+ } else {
157
+ legend.active = false;
158
+ li.classList.add('inactive');
159
+
160
+ var activeCount = legends.filter(function(legend) { return legend.active; }).length;
161
+ if (!options.removeAll && activeCount == 0) {
162
+ // If we can't disable all series at the same time, let's
163
+ // reenable all of them:
164
+ for (var i = 0; i < legends.length; i++) {
165
+ legends[i].active = true;
166
+ legendElement.childNodes[i].classList.remove('inactive');
167
+ }
168
+ }
169
+ }
170
+
171
+ var newSeries = [];
172
+ var newLabels = [];
173
+
174
+ for (var i = 0; i < seriesMetadata.length; i++) {
175
+ if (seriesMetadata[i].legend != -1 && legends[seriesMetadata[i].legend].active) {
176
+ newSeries.push(seriesMetadata[i].data);
177
+ newLabels.push(seriesMetadata[i].label);
178
+ }
179
+ }
180
+
181
+ chart.data.series = newSeries;
182
+ if (useLabels) {
183
+ chart.data.labels = newLabels;
184
+ }
185
+
186
+ chart.update();
187
+
188
+ if (options.onClick) {
189
+ options.onClick(chart, e);
190
+ }
191
+ });
192
+ }
193
+
194
+ removeLegendElement();
195
+
196
+ var legendElement = createLegendElement();
197
+ var useLabels = chart instanceof Chartist.Pie && chart.data.labels && chart.data.labels.length;
198
+ var legendNames = getLegendNames(useLabels);
199
+ var seriesMetadata = initSeriesMetadata(useLabels);
200
+ var legends = [];
201
+
202
+ // Check if given class names are viable to append to legends
203
+ var classNamesViable = Array.isArray(options.classNames) && options.classNames.length === legendNames.length;
204
+
205
+ // Loop through all legends to set each name in a list item.
206
+ legendNames.forEach(function (legend, i) {
207
+ var legendText = legend.name || legend;
208
+ var legendSeries = legend.series || [i];
209
+
210
+ var li = createNameElement(i, legendText, classNamesViable);
211
+ legendElement.appendChild(li);
212
+
213
+ legendSeries.forEach(function(seriesIndex) {
214
+ seriesMetadata[seriesIndex].legend = i;
215
+ });
216
+
217
+ legends.push({
218
+ text: legendText,
219
+ series: legendSeries,
220
+ active: true
221
+ });
222
+ });
223
+
224
+ chart.on('created', function (data) {
225
+ appendLegendToDOM(legendElement);
226
+ });
227
+
228
+ if (options.clickable) {
229
+ setSeriesClassNames();
230
+ addClickHandler(legendElement, legends, seriesMetadata, useLabels);
231
+ }
232
+ };
233
+ };
234
+
235
+ return Chartist.plugins.legend;
236
+
237
+ }));
@@ -4,5 +4,4 @@
4
4
  * Copyright 2013-2015 Twitter, Inc. and other contributors; Licensed MIT
5
5
  */
6
6
 
7
- !function(a,b){"function"==typeof define&&define.amd?define("bloodhound",["jquery"],function(c){return a.Bloodhound=b(c)}):"object"==typeof exports?module.exports=b(require("jquery")):a.Bloodhound=b(jQuery)}(this,function(a){var b=function(){"use strict";return{isMsie:function(){return/(msie|trident)/i.test(navigator.userAgent)?navigator.userAgent.match(/(msie |rv:)(\d+(.\d+)?)/i)[2]:!1},isBlankString:function(a){return!a||/^\s*$/.test(a)},escapeRegExChars:function(a){return a.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g,"\\$&")},isString:function(a){return"string"==typeof a},isNumber:function(a){return"number"==typeof a},isArray:a.isArray,isFunction:a.isFunction,isObject:a.isPlainObject,isUndefined:function(a){return"undefined"==typeof a},isElement:function(a){return!(!a||1!==a.nodeType)},isJQuery:function(b){return b instanceof a},toStr:function(a){return b.isUndefined(a)||null===a?"":a+""},bind:a.proxy,each:function(b,c){function d(a,b){return c(b,a)}a.each(b,d)},map:a.map,filter:a.grep,every:function(b,c){var d=!0;return b?(a.each(b,function(a,e){return(d=c.call(null,e,a,b))?void 0:!1}),!!d):d},some:function(b,c){var d=!1;return b?(a.each(b,function(a,e){return(d=c.call(null,e,a,b))?!1:void 0}),!!d):d},mixin:a.extend,identity:function(a){return a},clone:function(b){return a.extend(!0,{},b)},getIdGenerator:function(){var a=0;return function(){return a++}},templatify:function(b){function c(){return String(b)}return a.isFunction(b)?b:c},defer:function(a){setTimeout(a,0)},debounce:function(a,b,c){var d,e;return function(){var f,g,h=this,i=arguments;return f=function(){d=null,c||(e=a.apply(h,i))},g=c&&!d,clearTimeout(d),d=setTimeout(f,b),g&&(e=a.apply(h,i)),e}},throttle:function(a,b){var c,d,e,f,g,h;return g=0,h=function(){g=new Date,e=null,f=a.apply(c,d)},function(){var i=new Date,j=b-(i-g);return c=this,d=arguments,0>=j?(clearTimeout(e),e=null,g=i,f=a.apply(c,d)):e||(e=setTimeout(h,j)),f}},stringify:function(a){return b.isString(a)?a:JSON.stringify(a)},noop:function(){}}}(),c="0.11.1",d=function(){"use strict";function a(a){return a=b.toStr(a),a?a.split(/\s+/):[]}function c(a){return a=b.toStr(a),a?a.split(/\W+/):[]}function d(a){return function(c){return c=b.isArray(c)?c:[].slice.call(arguments,0),function(d){var e=[];return b.each(c,function(c){e=e.concat(a(b.toStr(d[c])))}),e}}}return{nonword:c,whitespace:a,obj:{nonword:d(c),whitespace:d(a)}}}(),e=function(){"use strict";function c(c){this.maxSize=b.isNumber(c)?c:100,this.reset(),this.maxSize<=0&&(this.set=this.get=a.noop)}function d(){this.head=this.tail=null}function e(a,b){this.key=a,this.val=b,this.prev=this.next=null}return b.mixin(c.prototype,{set:function(a,b){var c,d=this.list.tail;this.size>=this.maxSize&&(this.list.remove(d),delete this.hash[d.key],this.size--),(c=this.hash[a])?(c.val=b,this.list.moveToFront(c)):(c=new e(a,b),this.list.add(c),this.hash[a]=c,this.size++)},get:function(a){var b=this.hash[a];return b?(this.list.moveToFront(b),b.val):void 0},reset:function(){this.size=0,this.hash={},this.list=new d}}),b.mixin(d.prototype,{add:function(a){this.head&&(a.next=this.head,this.head.prev=a),this.head=a,this.tail=this.tail||a},remove:function(a){a.prev?a.prev.next=a.next:this.head=a.next,a.next?a.next.prev=a.prev:this.tail=a.prev},moveToFront:function(a){this.remove(a),this.add(a)}}),c}(),f=function(){"use strict";function c(a,c){this.prefix=["__",a,"__"].join(""),this.ttlKey="__ttl__",this.keyMatcher=new RegExp("^"+b.escapeRegExChars(this.prefix)),this.ls=c||h,!this.ls&&this._noop()}function d(){return(new Date).getTime()}function e(a){return JSON.stringify(b.isUndefined(a)?null:a)}function f(b){return a.parseJSON(b)}function g(a){var b,c,d=[],e=h.length;for(b=0;e>b;b++)(c=h.key(b)).match(a)&&d.push(c.replace(a,""));return d}var h;try{h=window.localStorage,h.setItem("~~~","!"),h.removeItem("~~~")}catch(i){h=null}return b.mixin(c.prototype,{_prefix:function(a){return this.prefix+a},_ttlKey:function(a){return this._prefix(a)+this.ttlKey},_noop:function(){this.get=this.set=this.remove=this.clear=this.isExpired=b.noop},_safeSet:function(a,b){try{this.ls.setItem(a,b)}catch(c){"QuotaExceededError"===c.name&&(this.clear(),this._noop())}},get:function(a){return this.isExpired(a)&&this.remove(a),f(this.ls.getItem(this._prefix(a)))},set:function(a,c,f){return b.isNumber(f)?this._safeSet(this._ttlKey(a),e(d()+f)):this.ls.removeItem(this._ttlKey(a)),this._safeSet(this._prefix(a),e(c))},remove:function(a){return this.ls.removeItem(this._ttlKey(a)),this.ls.removeItem(this._prefix(a)),this},clear:function(){var a,b=g(this.keyMatcher);for(a=b.length;a--;)this.remove(b[a]);return this},isExpired:function(a){var c=f(this.ls.getItem(this._ttlKey(a)));return b.isNumber(c)&&d()>c?!0:!1}}),c}(),g=function(){"use strict";function c(a){a=a||{},this.cancelled=!1,this.lastReq=null,this._send=a.transport,this._get=a.limiter?a.limiter(this._get):this._get,this._cache=a.cache===!1?new e(0):h}var d=0,f={},g=6,h=new e(10);return c.setMaxPendingRequests=function(a){g=a},c.resetCache=function(){h.reset()},b.mixin(c.prototype,{_fingerprint:function(b){return b=b||{},b.url+b.type+a.param(b.data||{})},_get:function(a,b){function c(a){b(null,a),k._cache.set(i,a)}function e(){b(!0)}function h(){d--,delete f[i],k.onDeckRequestArgs&&(k._get.apply(k,k.onDeckRequestArgs),k.onDeckRequestArgs=null)}var i,j,k=this;i=this._fingerprint(a),this.cancelled||i!==this.lastReq||((j=f[i])?j.done(c).fail(e):g>d?(d++,f[i]=this._send(a).done(c).fail(e).always(h)):this.onDeckRequestArgs=[].slice.call(arguments,0))},get:function(c,d){var e,f;d=d||a.noop,c=b.isString(c)?{url:c}:c||{},f=this._fingerprint(c),this.cancelled=!1,this.lastReq=f,(e=this._cache.get(f))?d(null,e):this._get(c,d)},cancel:function(){this.cancelled=!0}}),c}(),h=window.SearchIndex=function(){"use strict";function c(c){c=c||{},c.datumTokenizer&&c.queryTokenizer||a.error("datumTokenizer and queryTokenizer are both required"),this.identify=c.identify||b.stringify,this.datumTokenizer=c.datumTokenizer,this.queryTokenizer=c.queryTokenizer,this.reset()}function d(a){return a=b.filter(a,function(a){return!!a}),a=b.map(a,function(a){return a.toLowerCase()})}function e(){var a={};return a[i]=[],a[h]={},a}function f(a){for(var b={},c=[],d=0,e=a.length;e>d;d++)b[a[d]]||(b[a[d]]=!0,c.push(a[d]));return c}function g(a,b){var c=0,d=0,e=[];a=a.sort(),b=b.sort();for(var f=a.length,g=b.length;f>c&&g>d;)a[c]b[d]?d++:(e.push(a[c]),c++,d++);return e}var h="c",i="i";return b.mixin(c.prototype,{bootstrap:function(a){this.datums=a.datums,this.trie=a.trie},add:function(a){var c=this;a=b.isArray(a)?a:[a],b.each(a,function(a){var f,g;c.datums[f=c.identify(a)]=a,g=d(c.datumTokenizer(a)),b.each(g,function(a){var b,d,g;for(b=c.trie,d=a.split("");g=d.shift();)b=b[h][g]||(b[h][g]=e()),b[i].push(f)})})},get:function(a){var c=this;return b.map(a,function(a){return c.datums[a]})},search:function(a){var c,e,j=this;return c=d(this.queryTokenizer(a)),b.each(c,function(a){var b,c,d,f;if(e&&0===e.length)return!1;for(b=j.trie,c=a.split("");b&&(d=c.shift());)b=b[h][d];return b&&0===c.length?(f=b[i].slice(0),void(e=e?g(e,f):f)):(e=[],!1)}),e?b.map(f(e),function(a){return j.datums[a]}):[]},all:function(){var a=[];for(var b in this.datums)a.push(this.datums[b]);return a},reset:function(){this.datums={},this.trie=e()},serialize:function(){return{datums:this.datums,trie:this.trie}}}),c}(),i=function(){"use strict";function a(a){this.url=a.url,this.ttl=a.ttl,this.cache=a.cache,this.prepare=a.prepare,this.transform=a.transform,this.transport=a.transport,this.thumbprint=a.thumbprint,this.storage=new f(a.cacheKey)}var c;return c={data:"data",protocol:"protocol",thumbprint:"thumbprint"},b.mixin(a.prototype,{_settings:function(){return{url:this.url,type:"GET",dataType:"json"}},store:function(a){this.cache&&(this.storage.set(c.data,a,this.ttl),this.storage.set(c.protocol,location.protocol,this.ttl),this.storage.set(c.thumbprint,this.thumbprint,this.ttl))},fromCache:function(){var a,b={};return this.cache?(b.data=this.storage.get(c.data),b.protocol=this.storage.get(c.protocol),b.thumbprint=this.storage.get(c.thumbprint),a=b.thumbprint!==this.thumbprint||b.protocol!==location.protocol,b.data&&!a?b.data:null):null},fromNetwork:function(a){function b(){a(!0)}function c(b){a(null,e.transform(b))}var d,e=this;a&&(d=this.prepare(this._settings()),this.transport(d).fail(b).done(c))},clear:function(){return this.storage.clear(),this}}),a}(),j=function(){"use strict";function a(a){this.url=a.url,this.prepare=a.prepare,this.transform=a.transform,this.transport=new g({cache:a.cache,limiter:a.limiter,transport:a.transport})}return b.mixin(a.prototype,{_settings:function(){return{url:this.url,type:"GET",dataType:"json"}},get:function(a,b){function c(a,c){b(a?[]:e.transform(c))}var d,e=this;if(b)return a=a||"",d=this.prepare(a,this._settings()),this.transport.get(d,c)},cancelLastRequest:function(){this.transport.cancel()}}),a}(),k=function(){"use strict";function d(d){var e;return d?(e={url:null,ttl:864e5,cache:!0,cacheKey:null,thumbprint:"",prepare:b.identity,transform:b.identity,transport:null},d=b.isString(d)?{url:d}:d,d=b.mixin(e,d),!d.url&&a.error("prefetch requires url to be set"),d.transform=d.filter||d.transform,d.cacheKey=d.cacheKey||d.url,d.thumbprint=c+d.thumbprint,d.transport=d.transport?h(d.transport):a.ajax,d):null}function e(c){var d;if(c)return d={url:null,cache:!0,prepare:null,replace:null,wildcard:null,limiter:null,rateLimitBy:"debounce",rateLimitWait:300,transform:b.identity,transport:null},c=b.isString(c)?{url:c}:c,c=b.mixin(d,c),!c.url&&a.error("remote requires url to be set"),c.transform=c.filter||c.transform,c.prepare=f(c),c.limiter=g(c),c.transport=c.transport?h(c.transport):a.ajax,delete c.replace,delete c.wildcard,delete c.rateLimitBy,delete c.rateLimitWait,c}function f(a){function b(a,b){return b.url=f(b.url,a),b}function c(a,b){return b.url=b.url.replace(g,encodeURIComponent(a)),b}function d(a,b){return b}var e,f,g;return e=a.prepare,f=a.replace,g=a.wildcard,e?e:e=f?b:a.wildcard?c:d}function g(a){function c(a){return function(c){return b.debounce(c,a)}}function d(a){return function(c){return b.throttle(c,a)}}var e,f,g;return e=a.limiter,f=a.rateLimitBy,g=a.rateLimitWait,e||(e=/^throttle$/i.test(f)?d(g):c(g)),e}function h(c){return function(d){function e(a){b.defer(function(){g.resolve(a)})}function f(a){b.defer(function(){g.reject(a)})}var g=a.Deferred();return c(d,e,f),g}}return function(c){var f,g;return f={initialize:!0,identify:b.stringify,datumTokenizer:null,queryTokenizer:null,sufficient:5,sorter:null,local:[],prefetch:null,remote:null},c=b.mixin(f,c||{}),!c.datumTokenizer&&a.error("datumTokenizer is required"),!c.queryTokenizer&&a.error("queryTokenizer is required"),g=c.sorter,c.sorter=g?function(a){return a.sort(g)}:b.identity,c.local=b.isFunction(c.local)?c.local():c.local,c.prefetch=d(c.prefetch),c.remote=e(c.remote),c}}(),l=function(){"use strict";function c(a){a=k(a),this.sorter=a.sorter,this.identify=a.identify,this.sufficient=a.sufficient,this.local=a.local,this.remote=a.remote?new j(a.remote):null,this.prefetch=a.prefetch?new i(a.prefetch):null,this.index=new h({identify:this.identify,datumTokenizer:a.datumTokenizer,queryTokenizer:a.queryTokenizer}),a.initialize!==!1&&this.initialize()}var e;return e=window&&window.Bloodhound,c.noConflict=function(){return window&&(window.Bloodhound=e),c},c.tokenizers=d,b.mixin(c.prototype,{__ttAdapter:function(){function a(a,b,d){return c.search(a,b,d)}function b(a,b){return c.search(a,b)}var c=this;return this.remote?a:b},_loadPrefetch:function(){function b(a,b){return a?c.reject():(e.add(b),e.prefetch.store(e.index.serialize()),void c.resolve())}var c,d,e=this;return c=a.Deferred(),this.prefetch?(d=this.prefetch.fromCache())?(this.index.bootstrap(d),c.resolve()):this.prefetch.fromNetwork(b):c.resolve(),c.promise()},_initialize:function(){function a(){b.add(b.local)}var b=this;return this.clear(),(this.initPromise=this._loadPrefetch()).done(a),this.initPromise},initialize:function(a){return!this.initPromise||a?this._initialize():this.initPromise},add:function(a){return this.index.add(a),this},get:function(a){return a=b.isArray(a)?a:[].slice.call(arguments),this.index.get(a)},search:function(a,c,d){function e(a){var c=[];b.each(a,function(a){!b.some(f,function(b){return g.identify(a)===g.identify(b)})&&c.push(a)}),d&&d(c)}var f,g=this;return f=this.sorter(this.index.search(a)),c(this.remote?f.slice():f),this.remote&&f.length=j?(clearTimeout(e),e=null,g=i,f=a.apply(c,d)):e||(e=setTimeout(h,j)),f}},stringify:function(a){return b.isString(a)?a:JSON.stringify(a)},noop:function(){}}}(),c=function(){"use strict";function a(a){var g,h;return h=b.mixin({},f,a),g={css:e(),classes:h,html:c(h),selectors:d(h)},{css:g.css,html:g.html,classes:g.classes,selectors:g.selectors,mixin:function(a){b.mixin(a,g)}}}function c(a){return{wrapper:'',menu:'
'}}function d(a){var c={};return b.each(a,function(a,b){c[b]="."+a}),c}function e(){var a={wrapper:{position:"relative",display:"inline-block"},hint:{position:"absolute",top:"0",left:"0",borderColor:"transparent",boxShadow:"none",opacity:"1"},input:{position:"relative",verticalAlign:"top",backgroundColor:"transparent"},inputWithNoHint:{position:"relative",verticalAlign:"top"},menu:{position:"absolute",top:"100%",left:"0",zIndex:"100",display:"none"},ltr:{left:"0",right:"auto"},rtl:{left:"auto",right:" 0"}};return b.isMsie()&&b.mixin(a.input,{backgroundImage:"url(data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7)"}),a}var f={wrapper:"twitter-typeahead",input:"tt-input",hint:"tt-hint",menu:"tt-menu",dataset:"tt-dataset",suggestion:"tt-suggestion",selectable:"tt-selectable",empty:"tt-empty",open:"tt-open",cursor:"tt-cursor",highlight:"tt-highlight"};return a}(),d=function(){"use strict";function c(b){b&&b.el||a.error("EventBus initialized without el"),this.$el=a(b.el)}var d,e;return d="typeahead:",e={render:"rendered",cursorchange:"cursorchanged",select:"selected",autocomplete:"autocompleted"},b.mixin(c.prototype,{_trigger:function(b,c){var e;return e=a.Event(d+b),(c=c||[]).unshift(e),this.$el.trigger.apply(this.$el,c),e},before:function(a){var b,c;return b=[].slice.call(arguments,1),c=this._trigger("before"+a,b),c.isDefaultPrevented()},trigger:function(a){var b;this._trigger(a,[].slice.call(arguments,1)),(b=e[a])&&this._trigger(b,[].slice.call(arguments,1))}}),c}(),e=function(){"use strict";function a(a,b,c,d){var e;if(!c)return this;for(b=b.split(i),c=d?h(c,d):c,this._callbacks=this._callbacks||{};e=b.shift();)this._callbacks[e]=this._callbacks[e]||{sync:[],async:[]},this._callbacks[e][a].push(c);return this}function b(b,c,d){return a.call(this,"async",b,c,d)}function c(b,c,d){return a.call(this,"sync",b,c,d)}function d(a){var b;if(!this._callbacks)return this;for(a=a.split(i);b=a.shift();)delete this._callbacks[b];return this}function e(a){var b,c,d,e,g;if(!this._callbacks)return this;for(a=a.split(i),d=[].slice.call(arguments,1);(b=a.shift())&&(c=this._callbacks[b]);)e=f(c.sync,this,[b].concat(d)),g=f(c.async,this,[b].concat(d)),e()&&j(g);return this}function f(a,b,c){function d(){for(var d,e=0,f=a.length;!d&&f>e;e+=1)d=a[e].apply(b,c)===!1;return!d}return d}function g(){var a;return a=window.setImmediate?function(a){setImmediate(function(){a()})}:function(a){setTimeout(function(){a()},0)}}function h(a,b){return a.bind?a.bind(b):function(){a.apply(b,[].slice.call(arguments,0))}}var i=/\s+/,j=g();return{onSync:c,onAsync:b,off:d,trigger:e}}(),f=function(a){"use strict";function c(a,c,d){for(var e,f=[],g=0,h=a.length;h>g;g++)f.push(b.escapeRegExChars(a[g]));return e=d?"\\b("+f.join("|")+")\\b":"("+f.join("|")+")",c?new RegExp(e):new RegExp(e,"i")}var d={node:null,pattern:null,tagName:"strong",className:null,wordsOnly:!1,caseSensitive:!1};return function(e){function f(b){var c,d,f;return(c=h.exec(b.data))&&(f=a.createElement(e.tagName),e.className&&(f.className=e.className),d=b.splitText(c.index),d.splitText(c[0].length),f.appendChild(d.cloneNode(!0)),b.parentNode.replaceChild(f,d)),!!c}function g(a,b){for(var c,d=3,e=0;e
8
- e=document.activeElement,f=d.is(e),g=d.has(e).length>0,b.isMsie()&&(f||g)&&(a.preventDefault(),a.stopImmediatePropagation(),b.defer(function(){c.focus()}))}),d.on("mousedown.tt",function(a){a.preventDefault()})},_onSelectableClicked:function(a,b){this.select(b)},_onDatasetCleared:function(){this._updateHint()},_onDatasetRendered:function(a,b,c,d){this._updateHint(),this.eventBus.trigger("render",c,d,b)},_onAsyncRequested:function(a,b,c){this.eventBus.trigger("asyncrequest",c,b)},_onAsyncCanceled:function(a,b,c){this.eventBus.trigger("asynccancel",c,b)},_onAsyncReceived:function(a,b,c){this.eventBus.trigger("asyncreceive",c,b)},_onFocused:function(){this._minLengthMet()&&this.menu.update(this.input.getQuery())},_onBlurred:function(){this.input.hasQueryChangedSinceLastFocus()&&this.eventBus.trigger("change",this.input.getQuery())},_onEnterKeyed:function(a,b){var c;(c=this.menu.getActiveSelectable())&&this.select(c)&&b.preventDefault()},_onTabKeyed:function(a,b){var c;(c=this.menu.getActiveSelectable())?this.select(c)&&b.preventDefault():(c=this.menu.getTopSelectable())&&this.autocomplete(c)&&b.preventDefault()},_onEscKeyed:function(){this.close()},_onUpKeyed:function(){this.moveCursor(-1)},_onDownKeyed:function(){this.moveCursor(1)},_onLeftKeyed:function(){"rtl"===this.dir&&this.input.isCursorAtEnd()&&this.autocomplete(this.menu.getTopSelectable())},_onRightKeyed:function(){"ltr"===this.dir&&this.input.isCursorAtEnd()&&this.autocomplete(this.menu.getTopSelectable())},_onQueryChanged:function(a,b){this._minLengthMet(b)?this.menu.update(b):this.menu.empty()},_onWhitespaceChanged:function(){this._updateHint()},_onLangDirChanged:function(a,b){this.dir!==b&&(this.dir=b,this.menu.setLanguageDirection(b))},_openIfActive:function(){this.isActive()&&this.open()},_minLengthMet:function(a){return a=b.isString(a)?a:this.input.getQuery()||"",a.length>=this.minLength},_updateHint:function(){var a,c,d,e,f,h,i;a=this.menu.getTopSelectable(),c=this.menu.getSelectableData(a),d=this.input.getInputValue(),!c||b.isBlankString(d)||this.input.hasOverflow()?this.input.clearHint():(e=g.normalizeQuery(d),f=b.escapeRegExChars(e),h=new RegExp("^(?:"+f+")(.+$)","i"),i=h.exec(c.val),i&&this.input.setHint(d+i[1]))},isEnabled:function(){return this.enabled},enable:function(){this.enabled=!0},disable:function(){this.enabled=!1},isActive:function(){return this.active},activate:function(){return this.isActive()?!0:!this.isEnabled()||this.eventBus.before("active")?!1:(this.active=!0,this.eventBus.trigger("active"),!0)},deactivate:function(){return this.isActive()?this.eventBus.before("idle")?!1:(this.active=!1,this.close(),this.eventBus.trigger("idle"),!0):!0},isOpen:function(){return this.menu.isOpen()},open:function(){return this.isOpen()||this.eventBus.before("open")||(this.menu.open(),this._updateHint(),this.eventBus.trigger("open")),this.isOpen()},close:function(){return this.isOpen()&&!this.eventBus.before("close")&&(this.menu.close(),this.input.clearHint(),this.input.resetInputValue(),this.eventBus.trigger("close")),!this.isOpen()},setVal:function(a){this.input.setQuery(b.toStr(a))},getVal:function(){return this.input.getQuery()},select:function(a){var b=this.menu.getSelectableData(a);return b&&!this.eventBus.before("select",b.obj)?(this.input.setQuery(b.val,!0),this.eventBus.trigger("select",b.obj),this.close(),!0):!1},autocomplete:function(a){var b,c,d;return b=this.input.getQuery(),c=this.menu.getSelectableData(a),d=c&&b!==c.val,d&&!this.eventBus.before("autocomplete",c.obj)?(this.input.setQuery(c.val),this.eventBus.trigger("autocomplete",c.obj),!0):!1},moveCursor:function(a){var b,c,d,e,f;return b=this.input.getQuery(),c=this.menu.selectableRelativeToCursor(a),d=this.menu.getSelectableData(c),e=d?d.obj:null,f=this._minLengthMet()&&this.menu.update(b),f||this.eventBus.before("cursorchange",e)?!1:(this.menu.setCursor(c),d?this.input.setInputValue(d.val):(this.input.resetInputValue(),this._updateHint()),this.eventBus.trigger("cursorchange",e),!0)},destroy:function(){this.input.destroy(),this.menu.destroy()}}),c}();!function(){"use strict";function e(b,c){b.each(function(){var b,d=a(this);(b=d.data(p.typeahead))&&c(b,d)})}function f(a,b){return a.clone().addClass(b.classes.hint).removeData().css(b.css.hint).css(l(a)).prop("readonly",!0).removeAttr("id name placeholder required").attr({autocomplete:"off",spellcheck:"false",tabindex:-1})}function h(a,b){a.data(p.attrs,{dir:a.attr("dir"),autocomplete:a.attr("autocomplete"),spellcheck:a.attr("spellcheck"),style:a.attr("style")}),a.addClass(b.classes.input).attr({autocomplete:"off",spellcheck:!1});try{!a.attr("dir")&&a.attr("dir","auto")}catch(c){}return a}function l(a){return{backgroundAttachment:a.css("background-attachment"),backgroundClip:a.css("background-clip"),backgroundColor:a.css("background-color"),backgroundImage:a.css("background-image"),backgroundOrigin:a.css("background-origin"),backgroundPosition:a.css("background-position"),backgroundRepeat:a.css("background-repeat"),backgroundSize:a.css("background-size")}}function m(a){var c,d;c=a.data(p.www),d=a.parent().filter(c.selectors.wrapper),b.each(a.data(p.attrs),function(c,d){b.isUndefined(c)?a.removeAttr(d):a.attr(d,c)}),a.removeData(p.typeahead).removeData(p.www).removeData(p.attr).removeClass(c.classes.input),d.length&&(a.detach().insertAfter(d),d.remove())}function n(c){var d,e;return d=b.isJQuery(c)||b.isElement(c),e=d?a(c).first():[],e.length?e:null}var o,p,q;o=a.fn.typeahead,p={www:"tt-www",attrs:"tt-attrs",typeahead:"tt-typeahead"},q={initialize:function(e,l){function m(){var c,m,q,r,s,t,u,v,w,x,y;b.each(l,function(a){a.highlight=!!e.highlight}),c=a(this),m=a(o.html.wrapper),q=n(e.hint),r=n(e.menu),s=e.hint!==!1&&!q,t=e.menu!==!1&&!r,s&&(q=f(c,o)),t&&(r=a(o.html.menu).css(o.css.menu)),q&&q.val(""),c=h(c,o),(s||t)&&(m.css(o.css.wrapper),c.css(s?o.css.input:o.css.inputWithNoHint),c.wrap(m).parent().prepend(s?q:null).append(t?r:null)),y=t?j:i,u=new d({el:c}),v=new g({hint:q,input:c},o),w=new y({node:r,datasets:l},o),x=new k({input:v,menu:w,eventBus:u,minLength:e.minLength},o),c.data(p.www,o),c.data(p.typeahead,x)}var o;return l=b.isArray(l)?l:[].slice.call(arguments,1),e=e||{},o=c(e.classNames),this.each(m)},isEnabled:function(){var a;return e(this.first(),function(b){a=b.isEnabled()}),a},enable:function(){return e(this,function(a){a.enable()}),this},disable:function(){return e(this,function(a){a.disable()}),this},isActive:function(){var a;return e(this.first(),function(b){a=b.isActive()}),a},activate:function(){return e(this,function(a){a.activate()}),this},deactivate:function(){return e(this,function(a){a.deactivate()}),this},isOpen:function(){var a;return e(this.first(),function(b){a=b.isOpen()}),a},open:function(){return e(this,function(a){a.open()}),this},close:function(){return e(this,function(a){a.close()}),this},select:function(b){var c=!1,d=a(b);return e(this.first(),function(a){c=a.select(d)}),c},autocomplete:function(b){var c=!1,d=a(b);return e(this.first(),function(a){c=a.autocomplete(d)}),c},moveCursor:function(a){var b=!1;return e(this.first(),function(c){b=c.moveCursor(a)}),b},val:function(a){var b;return arguments.length?(e(this,function(b){b.setVal(a)}),this):(e(this.first(),function(a){b=a.getVal()}),b)},destroy:function(){return e(this,function(a,b){m(b),a.destroy()}),this}},a.fn.typeahead=function(a){return q[a]?q[a].apply(this,[].slice.call(arguments,1)):q.initialize.apply(this,arguments)},a.fn.typeahead.noConflict=function(){return a.fn.typeahead=o,this}}()});
7
+ !function(e,n){"function"==typeof define&&define.amd?define("bloodhound",["jquery"],function(t){return e.Bloodhound=n(t)}):"object"==typeof exports?module.exports=n(require("jquery")):e.Bloodhound=n(jQuery)}(this,function(h){var l=function(){"use strict";return{isMsie:function(){return!!/(msie|trident)/i.test(navigator.userAgent)&&navigator.userAgent.match(/(msie |rv:)(\d+(.\d+)?)/i)[2]},isBlankString:function(t){return!t||/^\s*$/.test(t)},escapeRegExChars:function(t){return t.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g,"\\$&")},isString:function(t){return"string"==typeof t},isNumber:function(t){return"number"==typeof t},isArray:h.isArray,isFunction:h.isFunction,isObject:h.isPlainObject,isUndefined:function(t){return void 0===t},isElement:function(t){return!(!t||1!==t.nodeType)},isJQuery:function(t){return t instanceof h},toStr:function(t){return l.isUndefined(t)||null===t?"":t+""},bind:h.proxy,each:function(t,n){h.each(t,function(t,e){return n(e,t)})},map:h.map,filter:h.grep,every:function(n,i){var r=!0;return n?(h.each(n,function(t,e){if(!(r=i.call(null,e,t,n)))return!1}),!!r):r},some:function(n,i){var r=!1;return n?(h.each(n,function(t,e){if(r=i.call(null,e,t,n))return!1}),!!r):r},mixin:h.extend,identity:function(t){return t},clone:function(t){return h.extend(!0,{},t)},getIdGenerator:function(){var t=0;return function(){return t++}},templatify:function(t){return h.isFunction(t)?t:function(){return String(t)}},defer:function(t){setTimeout(t,0)},debounce:function(r,s,o){var u,a;return function(){function t(){u=null,o||(a=r.apply(e,n))}var e=this,n=arguments,i=o&&!u;return clearTimeout(u),u=setTimeout(t,s),i&&(a=r.apply(e,n)),a}},throttle:function(n,i){function r(){c=new Date,u=null,a=n.apply(s,o)}var s,o,u,a,c=0;return function(){var t=new Date,e=i-(t-c);return s=this,o=arguments,e<=0?(clearTimeout(u),u=null,c=t,a=n.apply(s,o)):u=u||setTimeout(r,e),a}},stringify:function(t){return l.isString(t)?t:JSON.stringify(t)},noop:function(){}}}(),n=function(){"use strict";return{nonword:e,whitespace:t,obj:{nonword:n(e),whitespace:n(t)}};function t(t){return(t=l.toStr(t))?t.split(/\s+/):[]}function e(t){return(t=l.toStr(t))?t.split(/\W+/):[]}function n(i){return function(t){return t=l.isArray(t)?t:[].slice.call(arguments,0),function(e){var n=[];return l.each(t,function(t){n=n.concat(i(l.toStr(e[t])))}),n}}}}(),i=function(){"use strict";function t(t){this.maxSize=l.isNumber(t)?t:100,this.reset(),this.maxSize<=0&&(this.set=this.get=h.noop)}function e(){this.head=this.tail=null}function r(t,e){this.key=t,this.val=e,this.prev=this.next=null}return l.mixin(t.prototype,{set:function(t,e){var n,i=this.list.tail;this.size>=this.maxSize&&(this.list.remove(i),delete this.hash[i.key],this.size--),(n=this.hash[t])?(n.val=e,this.list.moveToFront(n)):(n=new r(t,e),this.list.add(n),this.hash[t]=n,this.size++)},get:function(t){var e=this.hash[t];if(e)return this.list.moveToFront(e),e.val},reset:function(){this.size=0,this.hash={},this.list=new e}}),l.mixin(e.prototype,{add:function(t){this.head&&(t.next=this.head,this.head.prev=t),this.head=t,this.tail=this.tail||t},remove:function(t){t.prev?t.prev.next=t.next:this.head=t.next,t.next?t.next.prev=t.prev:this.tail=t.prev},moveToFront:function(t){this.remove(t),this.add(t)}}),t}(),e=function(){"use strict";var s;try{(s=window.localStorage).setItem("~~~","!"),s.removeItem("~~~")}catch(t){s=null}function t(t,e){this.prefix=["__",t,"__"].join(""),this.ttlKey="__ttl__",this.keyMatcher=new RegExp("^"+l.escapeRegExChars(this.prefix)),this.ls=e||s,this.ls||this._noop()}return l.mixin(t.prototype,{_prefix:function(t){return this.prefix+t},_ttlKey:function(t){return this._prefix(t)+this.ttlKey},_noop:function(){this.get=this.set=this.remove=this.clear=this.isExpired=l.noop},_safeSet:function(t,e){try{this.ls.setItem(t,e)}catch(t){"QuotaExceededError"===t.name&&(this.clear(),this._noop())}},get:function(t){return this.isExpired(t)&&this.remove(t),n(this.ls.getItem(this._prefix(t)))},set:function(t,e,n){return l.isNumber(n)?this._safeSet(this._ttlKey(t),r(i()+n)):this.ls.removeItem(this._ttlKey(t)),this._safeSet(this._prefix(t),r(e))},remove:function(t){return this.ls.removeItem(this._ttlKey(t)),this.ls.removeItem(this._prefix(t)),this},clear:function(){for(var t=function(t){var e,n,i=[],r=s.length;for(e=0;ee)}}),t;function i(){return(new Date).getTime()}function r(t){return JSON.stringify(l.isUndefined(t)?null:t)}function n(t){return h.parseJSON(t)}}(),r=function(){"use strict";var u=0,a={},c=6,e=new i(10);function t(t){t=t||{},this.cancelled=!1,this.lastReq=null,this._send=t.transport,this._get=t.limiter?t.limiter(this._get):this._get,this._cache=!1===t.cache?new i(0):e}return t.setMaxPendingRequests=function(t){c=t},t.resetCache=function(){e.reset()},l.mixin(t.prototype,{_fingerprint:function(t){return(t=t||{}).url+t.type+h.param(t.data||{})},_get:function(t,e){var n,i,r=this;function s(t){e(null,t),r._cache.set(n,t)}function o(){e(!0)}n=this._fingerprint(t),this.cancelled||n!==this.lastReq||((i=a[n])?i.done(s).fail(o):ue[i]||(r.push(t[n]),n++),i++);return r}(s,r):r}),s?l.map(function(t){for(var e={},n=[],i=0,r=t.length;i',menu:'
'}}(n),selectors:function(t){var n={};return y.each(t,function(t,e){n[e]="."+t}),n}(n)}).css,html:e.html,classes:e.classes,selectors:e.selectors,mixin:function(t){y.mixin(t,e)}}}}(),v=function(){"use strict";var n;function t(t){t&&t.el||m.error("EventBus initialized without el"),this.$el=m(t.el)}return n={render:"rendered",cursorchange:"cursorchanged",select:"selected",autocomplete:"autocompleted"},y.mixin(t.prototype,{_trigger:function(t,e){var n=m.Event("typeahead:"+t);return(e=e||[]).unshift(n),this.$el.trigger.apply(this.$el,e),n},before:function(t){var e=[].slice.call(arguments,1);return this._trigger("before"+t,e).isDefaultPrevented()},trigger:function(t){var e;this._trigger(t,[].slice.call(arguments,1)),(e=n[t])&&this._trigger(e,[].slice.call(arguments,1))}}),t}(),e=function(){"use strict";var u=/\s+/,o=function(){var t;t=window.setImmediate?function(t){setImmediate(function(){t()})}:function(t){setTimeout(function(){t()},0)};return t}();return{onSync:function(t,e,n){return i.call(this,"sync",t,e,n)},onAsync:function(t,e,n){return i.call(this,"async",t,e,n)},off:function(t){var e;if(!this._callbacks)return this;t=t.split(u);for(;e=t.shift();)delete this._callbacks[e];return this},trigger:function(t){var e,n,i,r,s;if(!this._callbacks)return this;t=t.split(u),i=[].slice.call(arguments,1);for(;(e=t.shift())&&(n=this._callbacks[e]);)r=a(n.sync,this,[e].concat(i)),s=a(n.async,this,[e].concat(i)),r()&&o(s);return this}};function i(t,e,n,i){var r,s,o;if(!n)return this;for(e=e.split(u),n=i?(o=i,(s=n).bind?s.bind(o):function(){s.apply(o,[].slice.call(arguments,0))}):n,this._callbacks=this._callbacks||{};r=e.shift();)this._callbacks[r]=this._callbacks[r]||{sync:[],async:[]},this._callbacks[r][t].push(n);return this}function a(i,r,s){return function(){for(var t,e=0,n=i.length;!t&&e
@@ -0,0 +1,7 @@
1
+ .lv-item.p-20.bgm-lightgray.m-b-5
2
+ .media
3
+ .pull-left
4
+ i.zmdi.zmdi-hc-3x.zmdi-alert-circle-o.c-gray
5
+ .media-body
6
+ .lv-title.c-gray #{title}
7
+ small.lv-small.c-gray #{message}
@@ -0,0 +1,7 @@
1
+ .lv-item.p-20.bgm-red.m-b-5
2
+ .media
3
+ .pull-left
4
+ i.zmdi.zmdi-hc-3x.zmdi-alert-octagon.c-white
5
+ .media-body
6
+ .lv-title.c-white #{title}
7
+ small.lv-small.c-white #{message}
@@ -0,0 +1,7 @@
1
+ .lv-item.p-20.bgm-blue.m-b-5
2
+ .media
3
+ .pull-left
4
+ i.zmdi.zmdi-hc-3x.zmdi-info.c-white
5
+ .media-body
6
+ .lv-title.c-white #{title}
7
+ small.lv-small.c-white #{message}
@@ -0,0 +1,7 @@
1
+ .lv-item.p-20.bgm-orange.m-b-5
2
+ .media
3
+ .pull-left
4
+ i.zmdi.zmdi-hc-3x.zmdi-alert-triangle.c-white
5
+ .media-body
6
+ .lv-title.c-white #{title}
7
+ small.lv-small.c-white #{message}
@@ -0,0 +1,56 @@
1
+ .ct-chart.bar-chart id="#{id}"
2
+
3
+ .table-responsive.chart-table
4
+ table.table.table-striped
5
+ tbody
6
+ tr
7
+ -for label in labels
8
+ th #{label}
9
+ -for serie in series
10
+ tr
11
+ -for element in serie
12
+ td #{element}
13
+
14
+
15
+ javascript:
16
+ var labels = #{{labels}};
17
+ var series = #{{series}};
18
+
19
+ var options = {
20
+ seriesBarDistance: 30,
21
+ fullWidth: true,
22
+ chartPadding: {
23
+ right: 40
24
+ },
25
+ height: '300px',
26
+ showLabel: true,
27
+ plugins: [
28
+ Chartist.plugins.legend({
29
+ legendNames: #{{names}},
30
+ })
31
+ ]
32
+ };
33
+
34
+ var responsiveOptions = [
35
+ ['screen and (max-width: 640px)', {
36
+ seriesBarDistance: 5,
37
+ axisX: {
38
+ labelInterpolationFnc: function (value) {
39
+ return value[0];
40
+ }
41
+ }
42
+ }]
43
+ ];
44
+
45
+ new Chartist.Bar("##{id}", {
46
+ labels: labels,
47
+ series: series
48
+ },
49
+ options,
50
+ responsiveOptions
51
+ );
52
+
53
+ css:
54
+ ##{{id}} .ct-bar {
55
+ stroke-width: #{{100/(labels.count*series.count)}}%
56
+ }