metro-ui-rails 0.15.8.12 → 0.15.8.13

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (46) hide show
  1. data/lib/metro/ui/rails/version.rb +1 -1
  2. data/vendor/assets/javascripts/metro-ui.js +8 -6
  3. data/vendor/assets/javascripts/metro-ui/accordion.js +65 -31
  4. data/vendor/assets/javascripts/metro-ui/carousel.js +41 -31
  5. data/vendor/assets/javascripts/metro-ui/dialog.js +153 -0
  6. data/vendor/assets/javascripts/metro-ui/dropdown.js +1 -1
  7. data/vendor/assets/javascripts/metro-ui/input-control.js +44 -34
  8. data/vendor/assets/javascripts/metro-ui/rating.js +27 -25
  9. data/vendor/assets/javascripts/metro-ui/slider.js +51 -29
  10. data/vendor/assets/javascripts/metro-ui/start-menu.js +153 -0
  11. data/vendor/assets/javascripts/metro-ui/tile-drag.js +238 -86
  12. data/vendor/toolkit/metro-ui/accordion.less +1 -1
  13. data/vendor/toolkit/metro-ui/bricks.less +1 -1
  14. data/vendor/toolkit/metro-ui/buttons.less +1 -1
  15. data/vendor/toolkit/metro-ui/cards.less +1 -1
  16. data/vendor/toolkit/metro-ui/carousel.less +1 -1
  17. data/vendor/toolkit/metro-ui/code.less +1 -1
  18. data/vendor/toolkit/metro-ui/colors.less +1 -1
  19. data/vendor/toolkit/metro-ui/dialog.less +90 -0
  20. data/vendor/toolkit/metro-ui/forms.less +46 -27
  21. data/vendor/toolkit/metro-ui/grid.less +12 -2
  22. data/vendor/toolkit/metro-ui/hero.less +1 -1
  23. data/vendor/toolkit/metro-ui/icons.less +1 -1
  24. data/vendor/toolkit/metro-ui/images.less +1 -1
  25. data/vendor/toolkit/metro-ui/layout.less +1 -1
  26. data/vendor/toolkit/metro-ui/listview.less +32 -1
  27. data/vendor/toolkit/metro-ui/menus.less +38 -2
  28. data/vendor/toolkit/metro-ui/modern-responsive-max480.less +1 -1
  29. data/vendor/toolkit/metro-ui/modern-responsive-max767.less +13 -2
  30. data/vendor/toolkit/metro-ui/modern-responsive-max979.less +3 -2
  31. data/vendor/toolkit/metro-ui/modern-responsive-min1200.less +1 -1
  32. data/vendor/toolkit/metro-ui/modern-responsive.less +1 -1
  33. data/vendor/toolkit/metro-ui/modern.less +2 -1
  34. data/vendor/toolkit/metro-ui/notices.less +2 -1
  35. data/vendor/toolkit/metro-ui/pagecontrol.less +1 -1
  36. data/vendor/toolkit/metro-ui/progress.less +1 -1
  37. data/vendor/toolkit/metro-ui/rating.less +1 -1
  38. data/vendor/toolkit/metro-ui/routines.less +1 -1
  39. data/vendor/toolkit/metro-ui/sidebar.less +1 -1
  40. data/vendor/toolkit/metro-ui/slider.less +1 -1
  41. data/vendor/toolkit/metro-ui/tables.less +3 -1
  42. data/vendor/toolkit/metro-ui/theme-dark.less +1 -1
  43. data/vendor/toolkit/metro-ui/tiles.less +20 -2
  44. data/vendor/toolkit/metro-ui/typography.less +16 -5
  45. metadata +6 -3
  46. data/vendor/toolkit/metro-ui/jqgrid.less +0 -12
@@ -1,7 +1,7 @@
1
1
  module Metro
2
2
  module Ui
3
3
  module Rails
4
- VERSION = "0.15.8.12"
4
+ VERSION = "0.15.8.13"
5
5
  end
6
6
  end
7
7
  end
@@ -1,10 +1,12 @@
1
+ //= require metro-ui/accordion
2
+ //= require metro-ui/buttonset
3
+ //= require metro-ui/carousel
4
+ //= require metro-ui/dialog
5
+ //= require metro-ui/dropdown
1
6
  //= require metro-ui/input-control
7
+ //= require metro-ui/pagecontrol
2
8
  //= require metro-ui/rating
3
- //= require metro-ui/dropdown
4
9
  //= require metro-ui/slider
5
- //= require metro-ui/tile-slider
10
+ //= require metro-ui/start-menu
6
11
  //= require metro-ui/tile-drag
7
- //= require metro-ui/pagecontrol
8
- //= require metro-ui/carousel
9
- //= require metro-ui/buttonset
10
- //= require metro-ui/accordion
12
+ //= require metro-ui/tile-slider
@@ -1,44 +1,78 @@
1
- (function($){
2
- $.fn.Accordion = function( options ){
1
+ /**
2
+ * jQuery plugin for input elements for Metro UI CSS framework
3
+ */
4
+ (function($) {
5
+ var pluginName = 'Accordion',
6
+ initAllSelector = '[data-role="accordion"]',
7
+ paramKeys = [];
8
+
9
+ $[pluginName] = function(element, options) {
10
+ if (!element) {
11
+ return $()[pluginName]({initAll: true});
12
+ }
13
+
3
14
  var defaults = {
4
15
  };
5
16
 
6
- var $this = $(this)
7
- , $li = $this.children("li")
8
- , $triggers = $li.children("a")
9
- , $frames = $li.children("div")
10
- ;
17
+ var plugin = this;
18
+ plugin.settings = {};
19
+ var $element = $(element);
20
+
21
+ var $li, $triggers, $frames;
11
22
 
12
- var initTriggers = function(triggers){
13
- triggers.on('click', function(e){
23
+ plugin.init = function() {
24
+ plugin.settings = $.extend({}, defaults, options);
25
+
26
+ $li = $element.children("li");
27
+ $triggers = $li.children("a");
28
+ $frames = $li.children("div");
29
+
30
+ $triggers.on('click', function(e){
14
31
  e.preventDefault();
15
- var $a = $(this)
16
- , target = $a.parent('li').children("div");
32
+ var $a = $(this),
33
+ $activeLi = $li.filter('.active'),
34
+ $parentLi = $a.parent("li"),
35
+ target = $a.parent('li').children("div");
36
+
37
+ if ( $parentLi.hasClass('active') ) {
38
+ target.slideUp(undefined, function(){
39
+ $parentLi.removeClass("active");
40
+ });
17
41
 
18
- if ( $a.parent('li').hasClass('active') ) {
19
- target.slideUp();
20
- $(this).parent("li").removeClass("active");
21
42
  } else {
22
- $frames.slideUp();
23
- $li.removeClass("active");
43
+ $frames.slideUp(undefined, function(){
44
+ $activeLi.removeClass("active");
45
+ });
24
46
  target.slideDown();
25
- $(this).parent("li").addClass("active");
47
+ $parentLi.addClass("active");
26
48
  }
27
49
  });
28
- }
50
+ };
29
51
 
30
- return this.each(function(){
31
- if ( options ) {
32
- $.extend(defaults, options)
33
- }
34
52
 
35
- initTriggers($triggers);
53
+
54
+ plugin.init();
55
+
56
+ };
57
+
58
+ $.fn[pluginName] = function(options) {
59
+ var elements = options && options.initAll ? $(initAllSelector) : this;
60
+ return elements.each(function() {
61
+ var that = $(this),
62
+ params = {},
63
+ plugin;
64
+ if (undefined == that.data(pluginName)) {
65
+ $.each(paramKeys, function(index, key){
66
+ params[key[0].toLowerCase() + key.slice(1)] = that.data('param' + key);
67
+ });
68
+ plugin = new $[pluginName](this, params);
69
+ that.data(pluginName, plugin);
70
+ }
36
71
  });
37
- }
38
-
39
- $(function () {
40
- $('[data-role="accordion"]').each(function () {
41
- $(this).Accordion();
42
- })
43
- })
44
- })(window.jQuery);
72
+ };
73
+ // autoinit
74
+ $(function(){
75
+ $()[pluginName]({initAll: true});
76
+ });
77
+
78
+ })(jQuery);
@@ -3,8 +3,14 @@
3
3
  */
4
4
 
5
5
  (function($) {
6
+ var pluginName = 'Carousel',
7
+ initAllSelector = '[data-role=carousel], .carousel',
8
+ paramKeys = ['Auto', 'Period', 'Duration', 'Effect', 'Direction', 'Markers', 'Arrows', 'Stop'];
6
9
 
7
- $.Carousel = function(element, options) {
10
+ $[pluginName] = function(element, options) {
11
+ if (!element) {
12
+ return $()[pluginName]({initAll: true});
13
+ }
8
14
 
9
15
  // default settings
10
16
  var defaults = {
@@ -112,6 +118,14 @@
112
118
  });
113
119
  }
114
120
  }
121
+
122
+ // u can use same code:
123
+ // $('#carusel').trigger('changeSlide', [{direction: 'left', effect: 'fade', index: 1}])
124
+ // any option not required
125
+ $element.on('changeSlide', function(event, options){
126
+ options = options || {};
127
+ changeSlide(options.direction, options.effect, options.index);
128
+ });
115
129
  };
116
130
 
117
131
  /**
@@ -220,7 +234,7 @@
220
234
 
221
235
  outSlide = $(slides[currentSlideIndex]);
222
236
 
223
- nextSlideIndex = typeof slideIndex !== 'undefined' ? slideIndex : currentSlideIndex + delta;
237
+ nextSlideIndex = (typeof slideIndex !== 'undefined' && slideIndex !== currentSlideIndex) ? slideIndex : currentSlideIndex + delta;
224
238
  if (nextSlideIndex >= slides.length) {
225
239
  nextSlideIndex = 0;
226
240
  }
@@ -322,6 +336,11 @@
322
336
  * fade effect
323
337
  */
324
338
  var changeSlideFade = function (outSlide, inSlide) {
339
+ inSlide.hide();
340
+ inSlide.css({
341
+ left: 0,
342
+ top: 0
343
+ });
325
344
  inSlide.fadeIn(plugin.settings.duration);
326
345
  outSlide.fadeOut(plugin.settings.duration);
327
346
  };
@@ -330,39 +349,30 @@
330
349
 
331
350
  };
332
351
 
333
- $.fn.Carousel = function(options) {
334
- return this.each(function() {
335
- if (undefined == $(this).data('Carousel')) {
336
- var plugin = new $.Carousel(this, options);
337
- $(this).data('Carousel', plugin);
338
- }
339
- });
340
- };
341
-
342
352
  // easing effect for jquery animation
343
353
  $.easing.doubleSqrt = function(t, millisecondsSince, startValue, endValue, totalDuration) {
344
354
  var res = Math.sqrt(Math.sqrt(t));
345
355
  return res;
346
356
  };
347
357
 
348
- })(jQuery);
349
-
350
-
351
- $(window).ready(function(){
352
- var allCarousels = $('[data-role=carousel], .carousel');
353
- allCarousels.each(function (index, carousel) {
354
- var params = {};
355
- $carousel = $(carousel);
356
- params.auto = $carousel.data('paramAuto');
357
- params.period = $carousel.data('paramPeriod');
358
- params.duration = $carousel.data('paramDuration');
359
- params.effect = $carousel.data('paramEffect');
360
- params.direction = $carousel.data('paramDirection');
361
- params.markers = $carousel.data('paramMarkers');
362
- params.arrows = $carousel.data('paramArrows');
363
- params.stop = $carousel.data('paramStop');
364
-
365
- $carousel.Carousel(params);
366
- })
358
+ $.fn[pluginName] = function(options) {
359
+ var elements = options && options.initAll ? $(initAllSelector) : this;
360
+ return elements.each(function() {
361
+ var that = $(this),
362
+ params = {},
363
+ plugin;
364
+ if (undefined == that.data(pluginName)) {
365
+ $.each(paramKeys, function(index, key){
366
+ params[key[0].toLowerCase() + key.slice(1)] = that.data('param' + key);
367
+ });
368
+ plugin = new $[pluginName](this, params);
369
+ that.data(pluginName, plugin);
370
+ }
371
+ });
372
+ };
373
+ // autoinit
374
+ $(function(){
375
+ $()[pluginName]({initAll: true});
376
+ });
367
377
 
368
- });
378
+ })(jQuery);
@@ -0,0 +1,153 @@
1
+ /* Author: Valerio Battaglia (vabatta)
2
+ * Description: Function to create dialog box. You can have a dialog box open at once.
3
+ * Version: 1.0a
4
+ *
5
+ * Params:
6
+ * title - Title of the dialog box (HTML format)
7
+ * content - Content of the dialog box (HTML format)
8
+ * draggable - Set draggable to dialog box, available: true, false (default: false)
9
+ * overlay - Set the overlay of the page, available: true, false (default: true)
10
+ * closeButton - Enable or disable the close button, available: true, false (default: false)
11
+ * buttonsAlign - Align of the buttons, available: left, center, right (default: center)
12
+ * buttons - Set buttons in the action bar (JSON format)
13
+ * name - Text of the button (JSON format)
14
+ * action - Function to bind to the button
15
+ * position - Set the initial position of the dialog box (JSON format)
16
+ * zone - Zone of the dialog box, available: left, center, right (default: center)
17
+ * offsetY - Top offset pixels
18
+ * offsetX - Left offset pixels
19
+ *
20
+ * Goal for next versions:
21
+ * Add style param to set custom css to the dialog box controls
22
+ * Add possibility to resize window
23
+ */
24
+
25
+ (function($) {
26
+ $.Dialog = function(params) {
27
+ if(!$.DialogOpened) {
28
+ $.DialogOpened = true;
29
+ } else {
30
+ return false;
31
+ }
32
+
33
+ params = $.extend({'position':{'zone':'center'},'overlay':true}, params);
34
+
35
+ var buttonsHTML = '<div';
36
+
37
+ // Buttons position
38
+ if(params.buttonsAlign)
39
+ {
40
+ buttonsHTML += ' style=" float: ' + params.buttonsAlign + ';">';
41
+ } else {
42
+ buttonsHTML += '>';
43
+ }
44
+
45
+ $.each(params.buttons, function(name,obj) {
46
+ // Generating the markup for the buttons
47
+
48
+ buttonsHTML += '<button>' + name + '</button>';
49
+
50
+ if(!obj.action)
51
+ {
52
+ obj.action = function() {};
53
+ }
54
+ });
55
+
56
+ buttonsHTML += '</div>';
57
+
58
+ var markup = [
59
+ // If overlay is true, set it
60
+
61
+ '<div id="dialogOverlay">',
62
+ '<div id="dialogBox" class="dialog">',
63
+ '<div class="header">',
64
+ params.title,
65
+ (params.closeButton)?('<div><button><i class="icon-cancel-2"></i></button></div>'):(''),
66
+ '</div>',
67
+ '<div class="content">', params.content, '</div>',
68
+ '<div class="action" id="dialogButtons">',
69
+ buttonsHTML,
70
+ '</div></div></div>'
71
+ ].join('');
72
+
73
+ $(markup).hide().appendTo('body').fadeIn();
74
+
75
+ if(!params.overlay) {
76
+ $('#dialogOverlay').css('background-color', 'rgba(255, 255, 255, 0)');
77
+ }
78
+
79
+ // Setting initial position
80
+ if(params.position.zone == "left")
81
+ {
82
+ $('#dialogBox').css("top", Math.max(0, (($(window).height() - $('#dialogBox').outerHeight()) / 3) +
83
+ $(window).scrollTop()) + "px");
84
+ $('#dialogBox').css("left", 0);
85
+ }
86
+ else if(params.position.zone == "right")
87
+ {
88
+ $('#dialogBox').css("top", Math.max(0, (($(window).height() - $('#dialogBox').outerHeight()) / 3) +
89
+ $(window).scrollTop()) + "px");
90
+ $('#dialogBox').css("left", Math.max(0, (($(window).width() - $('#dialogBox').outerWidth())) +
91
+ $(window).scrollLeft()) + "px");
92
+ }
93
+ else
94
+ {
95
+ $('#dialogBox').css("top", (params.position.offsetY)?(params.position.offsetY):(Math.max(0, (($(window).height() - $('#dialogBox').outerHeight()) / 3) +
96
+ $(window).scrollTop()) + "px"));
97
+ $('#dialogBox').css("left", (params.position.offsetX)?(params.position.offsetX):(Math.max(0, (($(window).width() - $('#dialogBox').outerWidth()) / 2) +
98
+ $(window).scrollLeft()) + "px"));
99
+ }
100
+
101
+ if(params.draggable) {
102
+ // Make draggable the window
103
+
104
+ $('#dialogBox div.header').css('cursor', 'move').on("mousedown", function(e) {
105
+ var $drag = $(this).addClass('active-handle').parent().addClass('draggable');
106
+
107
+ var z_idx = $drag.css('z-index'),
108
+ drg_h = $drag.outerHeight(),
109
+ drg_w = $drag.outerWidth(),
110
+ pos_y = $drag.offset().top + drg_h - e.pageY,
111
+ pos_x = $drag.offset().left + drg_w - e.pageX;
112
+ $drag.css('z-index', 99999).parents().on("mousemove", function(e) {
113
+ $('.draggable').offset({
114
+ top:e.pageY + pos_y - drg_h,
115
+ left:e.pageX + pos_x - drg_w
116
+ }).on("mouseup", function() {
117
+ $(this).removeClass('draggable').css('z-index', z_idx);
118
+ });
119
+ });
120
+ e.preventDefault(); // disable selection
121
+ }).on("mouseup", function() {
122
+ $(this).removeClass('active-handle').parent().removeClass('draggable');
123
+ });
124
+ }
125
+
126
+ $('#dialogBox .header button').click(function() {
127
+ // Bind close button to hide dialog
128
+
129
+ $.Dialog.hide();
130
+ return false;
131
+ });
132
+
133
+ var buttons = $('#dialogBox .action button'),
134
+ i = 0;
135
+
136
+ $.each(params.buttons,function(name,obj){
137
+ buttons.eq(i++).click(function(){
138
+ // Calling function and hide the dialog
139
+
140
+ obj.action();
141
+ $.Dialog.hide();
142
+ return false;
143
+ });
144
+ });
145
+ }
146
+
147
+ $.Dialog.hide = function(){
148
+ $('#dialogOverlay').fadeOut(function(){
149
+ $.DialogOpened = false;
150
+ $(this).remove();
151
+ });
152
+ }
153
+ })(jQuery);
@@ -88,7 +88,7 @@
88
88
  }
89
89
 
90
90
  $(function () {
91
- $('.menu-pull').each(function () {
91
+ $('.pull-menu, .menu-pull').each(function () {
92
92
  $(this).PullDown();
93
93
  })
94
94
  })
@@ -2,8 +2,14 @@
2
2
  * jQuery plugin for input elements for Metro UI CSS framework
3
3
  */
4
4
  (function($) {
5
+ var pluginName = 'Input',
6
+ initAllSelector = '.input-control',
7
+ paramKeys = [];
5
8
 
6
- $.Input = function(element, options) {
9
+ $[pluginName] = function(element, options) {
10
+ if (!element) {
11
+ return $()[pluginName]({initAll: true});
12
+ }
7
13
 
8
14
  var defaults = {
9
15
  };
@@ -26,78 +32,82 @@
26
32
  * initialize text input element behavior
27
33
  */
28
34
  var initTextInput = function () {
29
- var helper,
30
- $helper,
35
+ var $helper,
31
36
  input;
32
- helper = $element.children('.helper').get(0);
37
+ $helper = $element.children('.helper');
33
38
 
34
- if (!helper) {
39
+ if (!$helper.get(0)) {
35
40
  return;
36
41
  }
37
42
 
38
- $helper = $(helper);
43
+ $helper.attr('tabindex', '-1');
44
+ $helper.attr('type', 'button');
39
45
 
40
- // clear text when clock on helper
46
+ // clear text when click on helper
41
47
  $helper.on('click', function () {
42
48
  input = $element.children('input');
43
- input.attr('value', '');
49
+ if (input.prop('readonly')) {
50
+ return;
51
+ }
52
+ input.val('');
44
53
  input.focus();
45
- }).on('click', function(e){e.preventDefault(); return false;});
54
+ });
46
55
  };
47
56
 
48
57
  /**
49
58
  * initialize password input element behavior
50
59
  */
51
60
  var initPasswordInput = function () {
52
- var helper,
53
- $helper,
61
+ var $helper,
54
62
  password,
55
63
  text;
56
- helper = $element.children('.helper').get(0);
57
- if (!helper) {
64
+ $helper = $element.children('.helper');
65
+ if (!$helper.get(0)) {
58
66
  return;
59
67
  }
60
68
 
61
69
  text = $('<input type="text" />');
62
70
  password = $element.children('input');
63
- $helper = $(helper);
71
+ $helper.attr('tabindex', '-1');
72
+ $helper.attr('type', 'button');
64
73
 
65
74
  // insert text element and hode password element when push helper
66
75
  $helper.on('mousedown', function () {
67
76
  password.hide();
68
77
  text.insertAfter(password);
69
- text.attr('value', password.attr('value'));
70
- }).on('click', function(e){e.preventDefault(); return false;});
78
+ text.val(password.val());
79
+ });
71
80
 
72
81
  // return password and remove text element
73
82
  $helper.on('mouseup, mouseout', function () {
74
83
  text.detach();
75
84
  password.show();
76
85
  password.focus();
77
- }).on('click', function(e){e.preventDefault(); return false;});
86
+ });
78
87
  };
79
88
 
80
89
  plugin.init();
81
90
 
82
91
  };
83
92
 
84
- $.fn.Input = function(options) {
85
- return this.each(function() {
86
- if (undefined == $(this).data('Input')) {
87
- var plugin = new $.Input(this, options);
88
- $(this).data('Input', plugin);
93
+ $.fn[pluginName] = function(options) {
94
+ var elements = options && options.initAll ? $(initAllSelector) : this;
95
+ return elements.each(function() {
96
+ var that = $(this),
97
+ params = {},
98
+ plugin;
99
+ if (undefined == that.data(pluginName)) {
100
+ $.each(paramKeys, function(index, key){
101
+ params[key[0].toLowerCase() + key.slice(1)] = that.data('param' + key);
102
+ });
103
+ plugin = new $[pluginName](this, params);
104
+ that.data(pluginName, plugin);
89
105
  }
90
106
  });
91
- }
92
-
93
- })(jQuery);
94
-
95
- $(function(){
96
- var allInputs = $('.input-control');
97
- allInputs.each(function (index, input) {
98
- var params = {};
99
- $input = $(input);
100
-
101
- $input.Input(params);
107
+ };
108
+ // autoinit
109
+ $(function(){
110
+ //$()[pluginName]({initAll: true});
102
111
  });
103
- });
112
+
113
+ })(jQuery);