active_administration 0.0.2 → 0.0.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (91) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile +1 -1
  3. data/README.md +2 -1
  4. data/active_administration.gemspec +2 -1
  5. data/app/assets/javascripts/active_administration/README.md +0 -0
  6. data/app/assets/javascripts/active_administration/metro-accordion.js +70 -0
  7. data/app/assets/javascripts/active_administration/metro-button-set.js +88 -0
  8. data/app/assets/javascripts/active_administration/metro-calendar.js +437 -0
  9. data/app/assets/javascripts/active_administration/metro-carousel.js +304 -0
  10. data/app/assets/javascripts/active_administration/metro-core.js +39 -0
  11. data/app/assets/javascripts/active_administration/metro-countdown.js +200 -0
  12. data/app/assets/javascripts/active_administration/metro-date-format.js +137 -0
  13. data/app/assets/javascripts/active_administration/metro-datepicker.js +138 -0
  14. data/app/assets/javascripts/active_administration/metro-dialog.js +221 -0
  15. data/app/assets/javascripts/active_administration/metro-drag-tile.js +46 -0
  16. data/app/assets/javascripts/active_administration/metro-dropdown.js +112 -0
  17. data/app/assets/javascripts/active_administration/metro-fluentmenu.js +57 -0
  18. data/app/assets/javascripts/active_administration/metro-global.js +4 -0
  19. data/app/assets/javascripts/active_administration/metro-hint.js +104 -0
  20. data/app/assets/javascripts/active_administration/metro-initiator.js +271 -0
  21. data/app/assets/javascripts/active_administration/metro-input-control.js +318 -0
  22. data/app/assets/javascripts/active_administration/metro-listview.js +53 -0
  23. data/app/assets/javascripts/active_administration/metro-live-tile.js +162 -0
  24. data/app/assets/javascripts/active_administration/metro-loader.js +46 -0
  25. data/app/assets/javascripts/active_administration/metro-locale.js +132 -0
  26. data/app/assets/javascripts/active_administration/metro-notify.js +120 -0
  27. data/app/assets/javascripts/active_administration/metro-panel.js +41 -0
  28. data/app/assets/javascripts/active_administration/metro-plugin-template.js +21 -0
  29. data/app/assets/javascripts/active_administration/metro-progressbar.js +97 -0
  30. data/app/assets/javascripts/active_administration/metro-pull.js +38 -0
  31. data/app/assets/javascripts/active_administration/metro-rating.js +99 -0
  32. data/app/assets/javascripts/active_administration/metro-scroll.js +756 -0
  33. data/app/assets/javascripts/active_administration/metro-slider.js +304 -0
  34. data/app/assets/javascripts/active_administration/metro-stepper.js +105 -0
  35. data/app/assets/javascripts/active_administration/metro-streamer.js +214 -0
  36. data/app/assets/javascripts/active_administration/metro-tab-control.js +96 -0
  37. data/app/assets/javascripts/active_administration/metro-table.js +74 -0
  38. data/app/assets/javascripts/active_administration/metro-tile-transform.js +65 -0
  39. data/app/assets/javascripts/active_administration/metro-times.js +190 -0
  40. data/app/assets/javascripts/active_administration/metro-touch-handler.js +65 -0
  41. data/app/assets/javascripts/active_administration/metro-treeview.js +64 -0
  42. data/app/assets/javascripts/active_administration/metro-wizard.js +148 -0
  43. data/app/assets/stylesheets/active_administration/accordion.less +64 -0
  44. data/app/assets/stylesheets/active_administration/balloon.less +88 -0
  45. data/app/assets/stylesheets/active_administration/breadcrumbs.less +118 -0
  46. data/app/assets/stylesheets/active_administration/buttons.less +383 -0
  47. data/app/assets/stylesheets/active_administration/calendar.less +123 -0
  48. data/app/assets/stylesheets/active_administration/carousel.less +118 -0
  49. data/app/assets/stylesheets/active_administration/colors.less +589 -0
  50. data/app/assets/stylesheets/active_administration/countdown.less +57 -0
  51. data/app/assets/stylesheets/active_administration/dataTables.less +134 -0
  52. data/app/assets/stylesheets/active_administration/fluent-menu.less +231 -0
  53. data/app/assets/stylesheets/active_administration/forms.less +414 -0
  54. data/app/assets/stylesheets/active_administration/funcs.less +178 -0
  55. data/app/assets/stylesheets/active_administration/grid.less +91 -0
  56. data/app/assets/stylesheets/active_administration/hint.less +120 -0
  57. data/app/assets/stylesheets/active_administration/iconFont-content.less +1353 -0
  58. data/app/assets/stylesheets/active_administration/iconFont.less +47 -0
  59. data/app/assets/stylesheets/active_administration/icons.less +10 -0
  60. data/app/assets/stylesheets/active_administration/images.less +75 -0
  61. data/app/assets/stylesheets/active_administration/layout.less +137 -0
  62. data/app/assets/stylesheets/active_administration/lists.less +258 -0
  63. data/app/assets/stylesheets/active_administration/menus.less +469 -0
  64. data/app/assets/stylesheets/active_administration/metro-bootstrap-responsive.less +300 -0
  65. data/app/assets/stylesheets/active_administration/metro-bootstrap.less +68 -0
  66. data/app/assets/stylesheets/active_administration/misc.less +72 -0
  67. data/app/assets/stylesheets/active_administration/navigation-bar.less +317 -0
  68. data/app/assets/stylesheets/active_administration/notice.less +52 -0
  69. data/app/assets/stylesheets/active_administration/notify.less +43 -0
  70. data/app/assets/stylesheets/active_administration/pagination.less +83 -0
  71. data/app/assets/stylesheets/active_administration/panels.less +38 -0
  72. data/app/assets/stylesheets/active_administration/progress-bar.less +25 -0
  73. data/app/assets/stylesheets/active_administration/rating.less +103 -0
  74. data/app/assets/stylesheets/active_administration/reset.less +219 -0
  75. data/app/assets/stylesheets/active_administration/scroll.less +141 -0
  76. data/app/assets/stylesheets/active_administration/sidebar.less +158 -0
  77. data/app/assets/stylesheets/active_administration/slider.less +106 -0
  78. data/app/assets/stylesheets/active_administration/stepper.less +80 -0
  79. data/app/assets/stylesheets/active_administration/streamer.less +250 -0
  80. data/app/assets/stylesheets/active_administration/tab-control.less +79 -0
  81. data/app/assets/stylesheets/active_administration/tables.less +170 -0
  82. data/app/assets/stylesheets/active_administration/tiles.less +599 -0
  83. data/app/assets/stylesheets/active_administration/transform.less +23 -0
  84. data/app/assets/stylesheets/active_administration/treeview.less +96 -0
  85. data/app/assets/stylesheets/active_administration/typography.less +382 -0
  86. data/app/assets/stylesheets/active_administration/utils.less +180 -0
  87. data/app/assets/stylesheets/active_administration/variables.less +250 -0
  88. data/app/assets/stylesheets/active_administration/window.less +225 -0
  89. data/app/assets/stylesheets/active_administration/wizard.less +53 -0
  90. data/lib/active_admin/version.rb +1 -1
  91. metadata +103 -10
@@ -0,0 +1,304 @@
1
+ (function( $ ) {
2
+ $.widget("metro.slider", {
3
+
4
+ version: "1.0.2",
5
+
6
+ options: {
7
+ position: 0,
8
+ accuracy: 0,
9
+ color: 'default',
10
+ completeColor: 'default',
11
+ markerColor: 'default',
12
+ colors: [],
13
+ showHint: false,
14
+ change: function(value, slider){},
15
+ changed: function(value, slider){},
16
+ min: 0,
17
+ max: 100,
18
+ animate: true,
19
+
20
+ _slider: {
21
+ vertical: false,
22
+ offset: 0,
23
+ length: 0,
24
+ marker: 0,
25
+ ppp: 0,
26
+ start: 0,
27
+ stop: 0
28
+ }
29
+ },
30
+
31
+
32
+ _create: function(){
33
+ var that = this,
34
+ element = this.element,
35
+
36
+ o = this.options,
37
+ s = this.options._slider;
38
+
39
+ if (element.data('accuracy') != undefined) {
40
+ o.accuracy = element.data('accuracy') > 0 ? element.data('accuracy') : 0;
41
+ }
42
+ if (element.data('animate') != undefined) {
43
+ o.animate = element.data('animate');
44
+ }
45
+ if (element.data('min') != undefined) {
46
+ o.min = element.data('min');
47
+ }
48
+ o.min = o.min < 0 ? 0 : o.min;
49
+ o.min = o.min > o.max ? o.max : o.min;
50
+ if (element.data('max') != undefined) {
51
+ o.max = element.data('max');
52
+ }
53
+ o.max = o.max > 100 ? 100 : o.max;
54
+ o.max = o.max < o.min ? o.min : o.max;
55
+ if (element.data('position') != undefined) {
56
+ o.position = this._correctValue(element.data('position') > this.options.min ? (element.data('position') > this.options.max ? this.options.max : element.data('position')) : this.options.min);
57
+ }
58
+ if (element.data('color') != undefined) {
59
+ o.color = element.data('color');
60
+ }
61
+ if (element.data('completeColor') != undefined) {
62
+ o.completeColor = element.data('completeColor');
63
+ }
64
+ if (element.data('markerColor') != undefined) {
65
+ o.markerColor = element.data('markerColor');
66
+ }
67
+ if (element.data('colors') != undefined) {
68
+ o.colors = element.data('colors').split(",");
69
+ }
70
+ if (element.data('showHint') != undefined) {
71
+ o.showHint = element.data('showHint');
72
+ }
73
+
74
+ s.vertical = element.hasClass("vertical");
75
+
76
+ this._createSlider();
77
+ this._initPoints();
78
+ this._placeMarker(o.position);
79
+
80
+ addTouchEvents(element[0]);
81
+
82
+ element.children('.marker').on('mousedown', function (e) {
83
+ e.preventDefault();
84
+ that._startMoveMarker(e);
85
+ });
86
+
87
+ element.on('mousedown', function (e) {
88
+ e.preventDefault();
89
+ that._startMoveMarker(e);
90
+ });
91
+ },
92
+
93
+ _startMoveMarker: function(e){
94
+ var element = this.element, o = this.options, that = this, hint = element.children('.hint');
95
+
96
+ $(document).mousemove(function (event) {
97
+ that._movingMarker(event);
98
+ if (!element.hasClass('permanent-hint')) {
99
+ hint.css('display', 'block');
100
+ }
101
+ });
102
+ $(document).mouseup(function () {
103
+ $(document).off('mousemove');
104
+ $(document).off('mouseup');
105
+ element.data('value', that.options.position);
106
+ element.trigger('changed', that.options.position);
107
+ o.changed(that.options.position, element);
108
+ if (!element.hasClass('permanent-hint')) {
109
+ hint.css('display', 'none');
110
+ }
111
+ });
112
+
113
+ this._initPoints();
114
+
115
+ this._movingMarker(e)
116
+ },
117
+
118
+ _movingMarker: function (event) {
119
+ var cursorPos,
120
+ percents,
121
+ valuePix,
122
+
123
+ vertical = this.options._slider.vertical,
124
+ sliderOffset = this.options._slider.offset,
125
+ sliderStart = this.options._slider.start,
126
+ sliderEnd = this.options._slider.stop,
127
+ sliderLength = this.options._slider.length,
128
+ markerSize = this.options._slider.marker;
129
+
130
+ if (vertical) {
131
+ cursorPos = event.pageY - sliderOffset;
132
+ } else {
133
+ cursorPos = event.pageX - sliderOffset;
134
+ }
135
+
136
+ if (cursorPos < sliderStart) {
137
+ cursorPos = sliderStart;
138
+ } else if (cursorPos > sliderEnd) {
139
+ cursorPos = sliderEnd;
140
+ }
141
+
142
+ if (vertical) {
143
+ valuePix = sliderLength - cursorPos - markerSize / 2;
144
+ } else {
145
+ valuePix = cursorPos - markerSize / 2;
146
+ }
147
+
148
+ percents = this._pixToPerc(valuePix);
149
+
150
+ this._placeMarker(percents);
151
+
152
+ this.options.position = percents;
153
+
154
+ this.options.change(Math.round(percents), this.element);
155
+ },
156
+
157
+ _placeMarker: function (value) {
158
+ var size, size2, o = this.options, colorParts = 0, colorIndex = 0, colorDelta = 0,
159
+ marker = this.element.children('.marker'),
160
+ complete = this.element.children('.complete'),
161
+ hint = this.element.children('.hint'),
162
+ oldPos = this._percToPix(this.options.position);
163
+
164
+ colorParts = o.colors.length;
165
+ colorDelta = o._slider.length / colorParts;
166
+
167
+ if (this.options._slider.vertical) {
168
+ var oldSize = this._percToPix(this.options.position) + this.options._slider.marker,
169
+ oldSize2 = this.options._slider.length - oldSize;
170
+ size = this._percToPix(value) + this.options._slider.marker;
171
+ size2 = this.options._slider.length - size;
172
+ this._animate(marker.css('top', oldSize2),{top: size2});
173
+ this._animate(complete.css('height', oldSize),{height: size});
174
+ if (colorParts) {
175
+ colorIndex = Math.round(size / colorDelta)-1;
176
+ complete.css('background-color', o.colors[colorIndex<0?0:colorIndex]);
177
+ }
178
+ if (o.showHint) {
179
+ hint.html(Math.round(value)).css('top', size2 - hint.height()/2);
180
+ }
181
+ } else {
182
+ size = this._percToPix(value);
183
+ this._animate(marker.css('left', oldPos),{left: size});
184
+ this._animate(complete.css('width', oldPos),{width: size});
185
+ if (colorParts) {
186
+ colorIndex = Math.round(size / colorDelta)-1;
187
+ complete.css('background-color', o.colors[colorIndex<0?0:colorIndex]);
188
+ }
189
+ if (o.showHint) {
190
+ this._animate(hint.html(Math.round(value)).css('left', oldPos - hint.width() / 2), {left: size - hint.width() / 2});
191
+ }
192
+ }
193
+
194
+ },
195
+
196
+ _animate: function (obj, val) {
197
+ if(this.options.animate) {
198
+ obj.stop(true).animate(val);
199
+ } else {
200
+ obj.css(val);
201
+ }
202
+ },
203
+
204
+ _pixToPerc: function (valuePix) {
205
+ var valuePerc;
206
+ valuePerc = valuePix * this.options._slider.ppp;
207
+ return this._correctValue(valuePerc);
208
+ },
209
+
210
+ _percToPix: function (value) {
211
+ if (this.options._slider.ppp === 0) {
212
+ return 0;
213
+ }
214
+ return value / this.options._slider.ppp;
215
+ },
216
+
217
+ _correctValue: function (value) {
218
+ var accuracy = this.options.accuracy;
219
+ var max = this.options.max;
220
+ var min = this.options.min;
221
+ if (accuracy === 0) {
222
+ return value;
223
+ }
224
+ if (value === max) {
225
+ return max;
226
+ }
227
+ if (value === min) {
228
+ return min;
229
+ }
230
+ value = Math.floor(value / accuracy) * accuracy + Math.round(value % accuracy / accuracy) * accuracy;
231
+ if (value > max) {
232
+ return max;
233
+ }
234
+ if (value < min) {
235
+ return min;
236
+ }
237
+ return value;
238
+ },
239
+
240
+ _initPoints: function(){
241
+ var s = this.options._slider, element = this.element;
242
+
243
+ if (s.vertical) {
244
+ s.offset = element.offset().top;
245
+ s.length = element.height();
246
+ s.marker = element.children('.marker').height();
247
+ } else {
248
+ s.offset = element.offset().left;
249
+ s.length = element.width();
250
+ s.marker = element.children('.marker').width();
251
+ }
252
+
253
+ s.ppp = this.options.max / (s.length - s.marker);
254
+ s.start = s.marker / 2;
255
+ s.stop = s.length - s.marker / 2;
256
+ },
257
+
258
+ _createSlider: function(){
259
+ var element = this.element,
260
+ options = this.options,
261
+ complete, marker, hint;
262
+
263
+ element.html('');
264
+
265
+ complete = $("<div/>").addClass("complete").appendTo(element);
266
+ marker = $("<a/>").addClass("marker").appendTo(element);
267
+
268
+ if (options.showHint) {
269
+ hint = $("<span/>").addClass("hint").appendTo(element);
270
+ }
271
+
272
+ if (options.color != 'default') {
273
+ element.css('background-color', options.color);
274
+ }
275
+ if (options.completeColor != 'default') {
276
+ complete.css('background-color', options.completeColor);
277
+ }
278
+ if (options.markerColor != 'default') {
279
+ marker.css('background-color', options.markerColor);
280
+ }
281
+ },
282
+
283
+ value: function (value) {
284
+ value = value > this.options.max ? this.options.max : value;
285
+ value = value < this.options.min ? this.options.min : value;
286
+ if (typeof value !== 'undefined') {
287
+ this._placeMarker(parseInt(value));
288
+ this.options.position = parseInt(value);
289
+ this.options.change(Math.round(parseInt(value)), this.element);
290
+ return this;
291
+ } else {
292
+ return Math.round(this.options.position);
293
+ }
294
+ },
295
+
296
+ _destroy: function(){},
297
+
298
+ _setOption: function(key, value){
299
+ this._super('_setOption', key, value);
300
+ }
301
+ })
302
+ })( jQuery );
303
+
304
+
@@ -0,0 +1,105 @@
1
+ (function( $ ) {
2
+ $.widget("metro.stepper", {
3
+
4
+ version: "1.0.0",
5
+
6
+ options: {
7
+ steps: 3,
8
+ start: 1,
9
+ onStep: function(index, step){}
10
+ },
11
+
12
+ _create: function(){
13
+ var element = this.element, o = this.options;
14
+
15
+ if (element.data('steps') != undefined) o.steps = element.data('steps');
16
+ if (element.data('start') != undefined) o.start = element.data('start');
17
+
18
+ this._createStepper();
19
+ this._positioningSteps();
20
+ this._stepTo(o.start);
21
+ },
22
+
23
+ _createStepper: function(){
24
+ var element = this.element, o= this.options;
25
+ var i, ul, li;
26
+
27
+ ul = $("<ul/>");
28
+ for(i=0;i< o.steps;i++) {
29
+ li = $("<li/>").appendTo(ul);
30
+ }
31
+ ul.appendTo(element);
32
+ },
33
+
34
+ _positioningSteps: function(){
35
+ var that = this, element = this.element, o = this.options,
36
+ steps = element.find("li"),
37
+ element_width = element.width(),
38
+ steps_length = steps.length-1,
39
+ step_width = $(steps[0]).width();
40
+
41
+ $.each(steps, function(i, step){
42
+ var left = i == 0 ? 0 : (element_width - step_width)/steps_length * i;
43
+ $(step).animate({
44
+ left: left
45
+ });
46
+ });
47
+ },
48
+
49
+ _stepTo: function(step){
50
+ var element = this.element, o = this.options;
51
+ var steps = element.find("li");
52
+
53
+ steps.removeClass('current').removeClass('complete');
54
+
55
+ $.each(steps, function(i, s){
56
+ if (i < step - 1) $(s).addClass('complete');
57
+ if (i == step - 1) {
58
+ $(s).addClass('current') ;
59
+ o.onStep(i+1, s);
60
+ }
61
+ });
62
+ },
63
+
64
+ first: function(){
65
+ var o = this.options;
66
+ o.start = 1;
67
+ this._stepTo(o.start);
68
+ },
69
+
70
+ last: function(){
71
+ var element = this.element, o = this.options;
72
+ var steps = element.find("li");
73
+
74
+ o.start = steps.length;
75
+ this._stepTo(o.start);
76
+ },
77
+
78
+ next: function(){
79
+ var element = this.element, o = this.options;
80
+ var steps = element.find("li");
81
+
82
+ if (o.start + 1 > steps.length) return;
83
+
84
+ o.start++;
85
+ this._stepTo(o.start);
86
+ },
87
+
88
+ prior: function(){
89
+ var o = this.options;
90
+
91
+ if (o.start - 1 == 0) return;
92
+
93
+ o.start--;
94
+ this._stepTo(o.start);
95
+ },
96
+
97
+ _destroy: function(){
98
+ },
99
+
100
+ _setOption: function(key, value){
101
+ this._super('_setOption', key, value);
102
+ }
103
+ })
104
+ })( jQuery );
105
+
@@ -0,0 +1,214 @@
1
+ (function( $ ) {
2
+ $.widget("metro.streamer", {
3
+
4
+ version: "1.0.0",
5
+
6
+ options: {
7
+ scrollBar: false,
8
+ meter: {
9
+ start: 9,
10
+ stop: 19,
11
+ interval: 20
12
+ },
13
+ slideToGroup: 1,
14
+ slideToTime: "10:20",
15
+ slideSleep: 1000,
16
+ slideSpeed: 1000,
17
+ onClick: function(event){},
18
+ onLongClick: function(event){}
19
+ },
20
+
21
+ _create: function(){
22
+ var that = this, element = this.element, o = this.options,
23
+ streams = element.find(".stream"),
24
+ events = element.find(".event"),
25
+ events_container = element.find(".events"),
26
+ events_area = element.find(".events-area"),
27
+ groups = element.find(".event-group"),
28
+ event_streams = element.find(".event-stream");
29
+
30
+
31
+ if (element.data('scrollBar') != undefined) o.scrollBar = element.data('scrollBar');
32
+ if (element.data('meterStart') != undefined) o.meter.start = parseInt(element.data('meterStart'));
33
+ if (element.data('meterStop') != undefined) o.meter.stop = parseInt(element.data('meterStop'));
34
+ if (element.data('meterInterval') != undefined) o.meter.interval = element.data('meterInterval');
35
+ if (element.data('slideToGroup') != undefined) o.slideToGroup = parseInt(element.data('slideToGroup'));
36
+ if (element.data('slideSleep') != undefined) o.slideSleep = parseInt(element.data('slideSleep'));
37
+ if (element.data('slideSpeed') != undefined) o.slideSpeed = parseInt(element.data('slideSpeed'));
38
+
39
+ element.data('streamSelect', -1);
40
+
41
+ var meter = $("<ul/>").addClass("meter");
42
+ var i, j, m, start = o.meter.start, stop = o.meter.stop, interval = o.meter.interval;
43
+
44
+ var _intervals = [];
45
+ for (i = start; i<stop; i++) {
46
+ for (j = 0; j < 60; j+=interval) {
47
+ m = (i<10?"0"+i:i)+":"+(j<10?"0"+j:j);
48
+ $("<li/>").addClass("js-interval-"+ m.replace(":", "-")).html("<em>"+m+"</em>").appendTo(meter);
49
+ _intervals.push(m);
50
+ }
51
+ }
52
+ element.data("intervals", _intervals);
53
+ meter.insertBefore(element.find(".events-grid"));
54
+
55
+ //console.log(element.data("intervals"));
56
+
57
+ // Re-Calc all event-stream width and set background for time
58
+ element.find(".event-stream").each(function(i, s){
59
+ var event_stream_width = 0;
60
+ var events = $(s).find(".event");
61
+
62
+ events.each(function(i, el){
63
+ event_stream_width += $(el).outerWidth();
64
+ });
65
+
66
+ $(s).css({
67
+ width: (event_stream_width + ( (events.length-1) * 2 ) + 1)
68
+ });
69
+
70
+ $(s).find(".time").css("background-color", $(streams[i]).css('background-color'));
71
+ });
72
+
73
+ // Set scrollbar
74
+ events_container.css({
75
+ 'overflow-x': (o.scrollBar ? 'scroll' : 'hidden')
76
+ });
77
+
78
+ // Set streamer height
79
+ element.css({
80
+ height: element.find(".streams").outerHeight() + (o.scrollBar ? 20 : 0)
81
+ });
82
+
83
+ // Re-Calc events-area width
84
+ var events_area_width = 0;
85
+ groups.each(function(i, el){
86
+ events_area_width += $(el).outerWidth();
87
+ });
88
+ events_area_width += ( (groups.length-1) * 2 ) + 10;
89
+ events_area.css('width', events_area_width);
90
+
91
+ events.each(function(i, el){
92
+ addTouchEvents(el);
93
+ });
94
+
95
+ events.mousedown(function(e){
96
+ if (e.altKey) {
97
+ $(this).toggleClass("selected");
98
+ }
99
+ });
100
+
101
+ element.mousewheel(function(event, delta){
102
+ var scroll_value = delta * 50;
103
+ events_container.scrollLeft(events_container.scrollLeft() - scroll_value);
104
+ return false;
105
+ });
106
+
107
+ streams.each(function(i, s){
108
+ $(s).mousedown(function(e){
109
+ if (element.data('streamSelect') == i) {
110
+ events.removeClass('event-disable');
111
+ element.data('streamSelect', -1);
112
+ } else {
113
+ element.data('streamSelect', i);
114
+ events.addClass('event-disable');
115
+ $(event_streams[i]).find(".event").removeClass("event-disable");
116
+ }
117
+ });
118
+ });
119
+
120
+ events.on('click', function(e){
121
+ e.preventDefault();
122
+ o.onClick($(this));
123
+ });
124
+
125
+ events.on('longclick', function(e){
126
+ $(this).toggleClass("selected");
127
+ e.preventDefault();
128
+ o.onLongClick($(this));
129
+ });
130
+
131
+ element.find(".js-go-previous-time").on('click', function(e){
132
+ var next_index = element.data("intervals").indexOf(element.data("current-time"));
133
+ if (next_index == 0) {
134
+ return;
135
+ }
136
+ next_index--;
137
+ var new_time = element.data("intervals")[next_index];
138
+ that.slideToTime(new_time, 0, o.slideSpeed);
139
+ });
140
+
141
+ element.find(".js-go-next-time").on('click', function(e){
142
+ var next_index = element.data("intervals").indexOf(element.data("current-time"));
143
+ if (next_index == element.data("intervals").length - 1) {
144
+ return;
145
+ }
146
+ next_index++;
147
+ var new_time = element.data("intervals")[next_index];
148
+ that.slideToTime(new_time, 0, o.slideSpeed);
149
+ });
150
+
151
+ element.find(".js-show-all-streams").on("click", function(e){
152
+ element.find(".event").removeClass("event-disable");
153
+ element.data('streamSelect', -1);
154
+ e.preventDefault();
155
+ });
156
+
157
+
158
+ element.find(".js-schedule-mode").on("click", function(e){
159
+ $(this).toggleClass("inverse");
160
+ element.data("schedule-mode", $(this).hasClass("inverse"));
161
+ e.preventDefault();
162
+ });
163
+
164
+ if (o.slideToTime) {
165
+ this.slideToTime(o.slideToTime, o.slideSleep, o.slideSpeed);
166
+ } else {
167
+ this.slideToGroup(o.slideToGroup, o.slideSleep, o.slideSpeed);
168
+ }
169
+
170
+ },
171
+
172
+ slideToTime: function(time, sleep, speed){
173
+ var that = this, element = this.element,
174
+ interval = element.find(".meter li.js-interval-"+time.replace(":", "-"))[0],
175
+ streams_width = element.find(".streams").outerWidth() + 2;
176
+
177
+ setTimeout(function(){
178
+ element.find(".events").animate({
179
+ scrollLeft: "+="+ (interval.offsetLeft - streams_width)
180
+ }, speed, function(){
181
+ that._afterSlide();
182
+ });
183
+ }, sleep);
184
+
185
+ element.data("current-time", time);
186
+ },
187
+
188
+ slideToGroup: function(group, sleep, speed){
189
+ var that = this, element = this.element, groups = element.find(".event-group"), streams_width = element.find(".streams").outerWidth() + 2;
190
+
191
+ setTimeout(function(){
192
+ element.find(".events").animate({
193
+ scrollLeft: "+="+ (groups[group-1].offsetLeft - streams_width)
194
+ }, speed, function(){
195
+ that._afterSlide();
196
+ });
197
+ }, sleep);
198
+ },
199
+
200
+ _afterSlide: function(){
201
+
202
+ },
203
+
204
+ _destroy: function(){
205
+
206
+ },
207
+
208
+ _setOption: function(key, value){
209
+ this._super('_setOption', key, value);
210
+ }
211
+ })
212
+ })( jQuery );
213
+
214
+