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.carousel", {
3
+
4
+ version: "1.0.0",
5
+
6
+ options: {
7
+ auto: true,
8
+ period: 2000,
9
+ duration: 500,
10
+ effect: 'slowdown', // slide, fade, switch, slowdown
11
+ direction: 'left',
12
+ markers: {
13
+ show: true,
14
+ type: 'default',
15
+ position: 'left' //bottom-left, bottom-right, bottom-center, top-left, top-right, top-center
16
+ },
17
+ controls: true,
18
+ stop: true,
19
+ width: '100%',
20
+ height: 300
21
+ },
22
+
23
+ _slides: {},
24
+ _currentIndex: 0,
25
+ _interval: 0,
26
+ _outPosition: 0,
27
+
28
+ _create: function(){
29
+ var that = this, o = this.options,
30
+ element = carousel = this.element,
31
+ controls = carousel.find('.controls');
32
+
33
+ if (element.data('auto') != undefined) o.auto = element.data('auto');
34
+ if (element.data('period') != undefined) o.period = element.data('period');
35
+ if (element.data('duration') != undefined) o.duration = element.data('duration');
36
+ if (element.data('effect') != undefined) o.effect = element.data('effect');
37
+ if (element.data('direction') != undefined) o.direction = element.data('direction');
38
+ if (element.data('width') != undefined) o.width = element.data('width');
39
+ if (element.data('height') != undefined) o.height = element.data('height');
40
+ if (element.data('stop') != undefined) o.stop = element.data('stop');
41
+ if (element.data('controls') != undefined) o.controls = element.data('controls');
42
+ if (element.data('markersShow') != undefined) o.markers.show = element.data('markersShow');
43
+ if (element.data('markersType') != undefined) o.markers.type = element.data('markersType');
44
+ if (element.data('markersPosition') != undefined) o.markers.position = element.data('markersPosition');
45
+
46
+ carousel.css({
47
+ 'width': this.options.width,
48
+ 'height': this.options.height
49
+ });
50
+
51
+ this._slides = carousel.find('.slide');
52
+
53
+ if (this._slides.length <= 1) return;
54
+
55
+ if (this.options.markers !== false && this.options.markers.show && this._slides.length > 1) {
56
+ this._markers(that);
57
+ }
58
+
59
+ if (this.options.controls && this._slides.length > 1) {
60
+ carousel.find('.controls.left').on('click', function(){
61
+ that._slideTo('prior');
62
+ });
63
+ carousel.find('.controls.right').on('click', function(){
64
+ that._slideTo('next');
65
+ });
66
+ } else {
67
+ controls.hide();
68
+ }
69
+
70
+ if (this.options.stop) {
71
+ carousel
72
+ .on('mouseenter', function(){
73
+ clearInterval(that._interval);
74
+ })
75
+ .on('mouseleave', function(){
76
+ if (that.options.auto) that._autoStart(), that.options.period;
77
+ })
78
+ }
79
+
80
+ if (this.options.auto) {
81
+ this._autoStart();
82
+ }
83
+ },
84
+
85
+ _autoStart: function(){
86
+ var that = this;
87
+ this._interval = setInterval(function(){
88
+ if (that.options.direction == 'left') {
89
+ that._slideTo('next')
90
+ } else {
91
+ that._slideTo('prior')
92
+ }
93
+ }, this.options.period);
94
+ },
95
+
96
+ _slideTo: function(direction){
97
+ var
98
+ currentSlide = this._slides[this._currentIndex],
99
+ nextSlide;
100
+
101
+ if (direction == undefined) direction = 'next';
102
+
103
+ if (direction === 'prior') {
104
+ this._currentIndex -= 1;
105
+ if (this._currentIndex < 0) this._currentIndex = this._slides.length - 1;
106
+
107
+ this._outPosition = this.element.width();
108
+
109
+ } else if (direction === 'next') {
110
+ this._currentIndex += 1;
111
+ if (this._currentIndex >= this._slides.length) this._currentIndex = 0;
112
+
113
+ this._outPosition = -this.element.width();
114
+
115
+ }
116
+
117
+ nextSlide = this._slides[this._currentIndex];
118
+
119
+ switch (this.options.effect) {
120
+ case 'switch': this._effectSwitch(currentSlide, nextSlide); break;
121
+ case 'slowdown': this._effectSlowdown(currentSlide, nextSlide, this.options.duration); break;
122
+ case 'fade': this._effectFade(currentSlide, nextSlide, this.options.duration); break;
123
+ default: this._effectSlide(currentSlide, nextSlide, this.options.duration);
124
+ }
125
+
126
+ var carousel = this.element, that = this;
127
+ carousel.find('.markers ul li a').each(function(){
128
+ var index = $(this).data('num');
129
+ if (index === that._currentIndex) {
130
+ $(this).parent().addClass('active');
131
+ } else {
132
+ $(this).parent().removeClass('active');
133
+ }
134
+ });
135
+ },
136
+
137
+ _slideToSlide: function(slideIndex){
138
+ var
139
+ currentSlide = this._slides[this._currentIndex],
140
+ nextSlide = this._slides[slideIndex];
141
+
142
+ if (slideIndex > this._currentIndex) {
143
+ this._outPosition = -this.element.width();
144
+ } else {
145
+ this._outPosition = this.element.width();
146
+ }
147
+
148
+ switch (this.options.effect) {
149
+ case 'switch' : this._effectSwitch(currentSlide, nextSlide); break;
150
+ case 'slowdown': this._effectSlowdown(currentSlide, nextSlide, this.options.duration); break;
151
+ case 'fade': this._effectFade(currentSlide, nextSlide, this.options.duration); break;
152
+ default : this._effectSlide(currentSlide, nextSlide, this.options.duration);
153
+ }
154
+
155
+ this._currentIndex = slideIndex;
156
+ },
157
+
158
+ _markers: function (that) {
159
+ var div, ul, li, i, markers;
160
+
161
+ div = $('<div class="markers '+this.options.markers.type+'" />');
162
+ ul = $('<ul></ul>').appendTo(div);
163
+
164
+ for (i = 0; i < this._slides.length; i++) {
165
+ li = $('<li><a href="javascript:void(0)" data-num="' + i + '"></a></li>');
166
+ if (i === 0) {
167
+ li.addClass('active');
168
+ }
169
+ li.appendTo(ul);
170
+ }
171
+
172
+
173
+ ul.find('li a').removeClass('active').on('click', function () {
174
+ var $this = $(this),
175
+ index = $this.data('num');
176
+
177
+ ul.find('li').removeClass('active');
178
+ $this.parent().addClass('active');
179
+
180
+ if (index == that._currentIndex) {
181
+ return true;
182
+ }
183
+
184
+ that._slideToSlide(index);
185
+ return true;
186
+ });
187
+
188
+ div.appendTo(this.element);
189
+
190
+ switch (this.options.markers.position) {
191
+ case 'top-left' : {
192
+ div.css({
193
+ left: '10px',
194
+ right: 'auto',
195
+ bottom: 'auto',
196
+ top: '10px'
197
+ });
198
+ break;
199
+ }
200
+ case 'top-right' : {
201
+ div.css({
202
+ left: 'auto',
203
+ right: '10px',
204
+ bottom: 'auto',
205
+ top: '0px'
206
+ });
207
+ break;
208
+ }
209
+ case 'top-center' : {
210
+ div.css({
211
+ left: this.element.width()/2 - div.width()/2,
212
+ right: 'auto',
213
+ bottom: 'auto',
214
+ top: '0px'
215
+ });
216
+ break;
217
+ }
218
+ case 'bottom-left' : {
219
+ div.css({
220
+ left: '10px',
221
+ right: 'auto'
222
+ });
223
+ break;
224
+ }
225
+ case 'bottom-right' : {
226
+ div.css({
227
+ right: '10px',
228
+ left: 'auto'
229
+ });
230
+ break;
231
+ }
232
+ case 'bottom-center' : {
233
+ div.css({
234
+ left: this.element.width()/2 - div.width()/2,
235
+ right: 'auto'
236
+ });
237
+ break;
238
+ }
239
+ }
240
+ },
241
+
242
+
243
+ _effectSwitch: function(currentSlide, nextSlide){
244
+ $(currentSlide)
245
+ .hide();
246
+ $(nextSlide)
247
+ .css({left: 0})
248
+ .show();
249
+ },
250
+
251
+ _effectSlide: function(currentSlide, nextSlide, duration){
252
+ $(currentSlide)
253
+ .animate({left: this._outPosition}, duration);
254
+ $(nextSlide)
255
+ .css('left', this._outPosition * -1)
256
+ .show()
257
+ .animate({left: 0}, duration);
258
+ },
259
+
260
+ _effectSlowdown: function(currentSlide, nextSlide, duration){
261
+ var options = {
262
+ 'duration': duration,
263
+ 'easing': 'doubleSqrt'
264
+ };
265
+ $.easing.doubleSqrt = function(t) {
266
+ return Math.sqrt(Math.sqrt(t));
267
+ };
268
+
269
+ $(currentSlide)
270
+ .animate({left: this._outPosition}, options);
271
+
272
+
273
+ //$(nextSlide).find('.subslide').hide();
274
+ $(nextSlide)
275
+ .css('left', this._outPosition * -1)
276
+ .show()
277
+ .animate({left: 0}, options);
278
+
279
+ //setTimeout(function(){
280
+ // $(nextSlide).find('.subslide').fadeIn();
281
+ //}, 500);
282
+
283
+ },
284
+
285
+ _effectFade: function(currentSlide, nextSlide, duration){
286
+ $(currentSlide)
287
+ .fadeOut(duration);
288
+ $(nextSlide)
289
+ .css({left: 0})
290
+ .fadeIn(duration);
291
+ },
292
+
293
+
294
+ _destroy: function(){
295
+
296
+ },
297
+
298
+ _setOption: function(key, value){
299
+ this._super('_setOption', key, value);
300
+ }
301
+ });
302
+ })( jQuery );
303
+
304
+
@@ -0,0 +1,39 @@
1
+
2
+ (function($){
3
+ $.Metro = function(params){
4
+ params = $.extend({
5
+ }, params);
6
+ };
7
+
8
+ $.Metro.getDeviceSize = function(){
9
+ var device_width = (window.innerWidth > 0) ? window.innerWidth : screen.width;
10
+ var device_height = (window.innerHeight > 0) ? window.innerHeight : screen.height;
11
+ return {
12
+ width: device_width,
13
+ height: device_height
14
+ }
15
+ }
16
+
17
+ })(jQuery);
18
+
19
+ $(function(){
20
+ $('html').on('click', function(e){
21
+ $('.dropdown-menu').each(function(i, el){
22
+ if (!$(el).hasClass('keep-open') && $(el).css('display')=='block') {
23
+ $(el).hide();
24
+ }
25
+ });
26
+ });
27
+ });
28
+
29
+ $(function(){
30
+ $(window).on('resize', function(){
31
+ if (METRO_DIALOG) {
32
+ var top = ($(window).height() - METRO_DIALOG.outerHeight()) / 2;
33
+ var left = ($(window).width() - METRO_DIALOG.outerWidth()) / 2;
34
+ METRO_DIALOG.css({
35
+ top: top, left: left
36
+ });
37
+ }
38
+ });
39
+ });
@@ -0,0 +1,200 @@
1
+ (function( $ ) {
2
+ $.widget("metro.countdown", {
3
+
4
+ version: "1.0.0",
5
+
6
+ options: {
7
+ style: {
8
+ background: "bg-dark",
9
+ foreground: "fg-white",
10
+ divider: "fg-dark"
11
+ },
12
+ blink: true,
13
+ days: 1,
14
+ stoptimer: 0,
15
+ ontick: function(d, h, m, s){},
16
+ onstop: function(){}
17
+ },
18
+
19
+ wrappers: {},
20
+
21
+ _interval: 0,
22
+
23
+ _create: function(){
24
+ var that = this, countdown = this.element;
25
+
26
+ $.each(['Days','Hours','Minutes','Seconds'],function(){
27
+ $('<span class="count'+this+'">').html(
28
+ '<span class="digit-wrapper">\
29
+ <span class="digit">0</span>\
30
+ </span>\
31
+ <span class="digit-wrapper">\
32
+ <span class="digit">0</span>\
33
+ </span>'
34
+ ).appendTo(countdown);
35
+
36
+ if(this!="Seconds"){
37
+ countdown.append('<span class="divider"></span>');
38
+ }
39
+ });
40
+
41
+ this.wrappers = this.element.find('.digit-wrapper');
42
+
43
+ if (countdown.data('blink') != undefined) {
44
+ this.options.blink = countdown.data('blick');
45
+ }
46
+
47
+ if (countdown.data('styleBackground') != undefined) {
48
+ this.options.style.background = countdown.data('styleBackground');
49
+ }
50
+
51
+ if (countdown.data('styleForeground') != undefined) {
52
+ this.options.style.foreground = countdown.data('styleForeground');
53
+ }
54
+
55
+ if (countdown.data('styleDivider') != undefined) {
56
+ this.options.style.divider = countdown.data('styleDivider');
57
+ }
58
+
59
+ if (this.options.style.background != "default") {
60
+ this.element.find(".digit").addClass(this.options.style.background);
61
+ }
62
+
63
+ if (this.options.style.foreground != "default") {
64
+ this.element.find(".digit").addClass(this.options.style.foreground);
65
+ }
66
+
67
+ if (this.options.style.divider != "default") {
68
+ this.element.find(".divider").addClass(this.options.style.divider);
69
+ }
70
+
71
+ if (countdown.data('stoptimer') != undefined) {
72
+ this.options.stoptimer = new Date(countdown.data('stoptimer'));
73
+ }
74
+
75
+ if (this.options.stoptimer == 0) {
76
+ this.options.stoptimer = (new Date()).getTime() + this.options.days*24*60*60*1000;
77
+ }
78
+
79
+ setTimeout( function(){
80
+ that.tick()
81
+ }, 1000);
82
+ },
83
+
84
+ _destroy: function(){
85
+
86
+ },
87
+
88
+ _setOption: function(key, value){
89
+ this._super('_setOption', key, value);
90
+ },
91
+
92
+ tick: function(){
93
+ var that = this;
94
+
95
+ this._interval = setInterval(function(){
96
+ var days = 24*60*60,
97
+ hours = 60*60,
98
+ minutes = 60;
99
+
100
+ var left, d, h, m, s;
101
+
102
+ left = Math.floor((that.options.stoptimer - (new Date())) / 1000);
103
+
104
+ if(left < 0){
105
+ left = 0;
106
+ }
107
+
108
+ // Number of days left
109
+ d = Math.floor(left / days);
110
+ that.updateDuo(0, 1, d);
111
+ left -= d*days;
112
+
113
+ // Number of hours left
114
+ h = Math.floor(left / hours);
115
+ that.updateDuo(2, 3, h);
116
+ left -= h*hours;
117
+
118
+ // Number of minutes left
119
+ m = Math.floor(left / minutes);
120
+ that.updateDuo(4, 5, m);
121
+ left -= m*minutes;
122
+
123
+ // Number of seconds left
124
+ s = left;
125
+ that.updateDuo(6, 7, s);
126
+
127
+ // Calling an optional user supplied ontick
128
+ that.options.ontick(d, h, m, s);
129
+
130
+ that.blinkDivider();
131
+
132
+ // Scheduling another call of this function in 1s
133
+ if (d === 0 && h === 0 && m === 0 && s === 0) {
134
+ that.options.onstop();
135
+ that.stopDigit();
136
+ that._trigger('alarm');
137
+ clearInterval(that._interval);
138
+ }
139
+ }, 1000);
140
+ },
141
+
142
+ blinkDivider: function(){
143
+ if (this.options.blink)
144
+ this.element.find(".divider").toggleClass("no-visible");
145
+ },
146
+
147
+ stopDigit: function(){
148
+ this.wrappers.each(function(){
149
+ $(this).children(".digit").addClass("stop");
150
+ })
151
+ },
152
+
153
+ updateDuo: function(minor, major, value){
154
+ this.switchDigit(this.wrappers.eq(minor),Math.floor(value/10)%10);
155
+ this.switchDigit(this.wrappers.eq(major),value%10);
156
+ },
157
+
158
+ switchDigit: function(wrapper, number){
159
+ var digit = wrapper.find('.digit');
160
+
161
+ if(digit.is(':animated')){
162
+ return false;
163
+ }
164
+
165
+ if(wrapper.data('digit') == number){
166
+ // We are already showing this number
167
+ return false;
168
+ }
169
+
170
+ wrapper.data('digit', number);
171
+
172
+ var replacement = $('<span>',{
173
+ 'class':'digit',
174
+ css:{
175
+ top:'-2.1em',
176
+ opacity:0
177
+ },
178
+ html:number
179
+ });
180
+
181
+ replacement.addClass(this.options.style.background);
182
+ replacement.addClass(this.options.style.foreground);
183
+
184
+ digit
185
+ .before(replacement)
186
+ .removeClass('static')
187
+ .animate({top:'2.5em'},'fast',function(){
188
+ digit.remove();
189
+ });
190
+
191
+ replacement
192
+ .delay(100)
193
+ .animate({top:0,opacity:1},'fast');
194
+
195
+ return true;
196
+ }
197
+ });
198
+ })( jQuery );
199
+
200
+