fuelux-rails 2.2.0.beta.1 → 2.2.0

Sign up to get free protection for your applications and to get access to all the features.
data/README.md CHANGED
@@ -1,7 +1,7 @@
1
- # Fuel UX for Rails 3.1 Asset Pipeline
1
+ # Fuel UX for Rails 3.1/Rails 4.0 Asset Pipeline
2
2
  Extends Twitter Bootstrap with additional lightweight JavaScript controls. Easy to install, customize, update, and optimize.
3
3
 
4
- fuelux-rails project integrates Fuel UX into the Twitter Bootstrap CSS toolkit for Rails 3.1 Asset Pipeline (Rails 3.2 supported)
4
+ fuelux-rails project integrates Fuel UX into the Twitter Bootstrap CSS toolkit for Rails 3.1/Rails 4.0 Asset Pipeline (Rails 3.2 supported)
5
5
 
6
6
  ## Installing Gem
7
7
 
@@ -1,3 +1,3 @@
1
1
  module FueluxRails
2
- VERSION = "2.2.0.beta.1"
2
+ VERSION = "2.2.0"
3
3
  end
@@ -7,7 +7,7 @@
7
7
  */
8
8
 
9
9
  !function ($) {
10
-
10
+
11
11
  // CHECKBOX CONSTRUCTOR AND PROTOTYPE
12
12
 
13
13
  var Checkbox = function (element, options) {
@@ -7,7 +7,7 @@
7
7
  */
8
8
 
9
9
  !function ($) {
10
-
10
+
11
11
  // COMBOBOX CONSTRUCTOR AND PROTOTYPE
12
12
 
13
13
  var Combobox = function (element, options) {
@@ -72,11 +72,8 @@
72
72
  setDefaultSelection: function () {
73
73
  var selector = 'li[data-selected=true]:first';
74
74
  var item = this.$element.find(selector);
75
- if (item.length === 0) {
76
- // select first item
77
- this.selectByIndex(0);
78
- }
79
- else {
75
+
76
+ if (item.length > 0) {
80
77
  // select by data-attribute
81
78
  this.selectBySelector(selector);
82
79
  item.removeData('selected');
@@ -13,8 +13,9 @@
13
13
  var Datagrid = function (element, options) {
14
14
  this.$element = $(element);
15
15
  this.$thead = this.$element.find('thead');
16
+ this.$tfoot = this.$element.find('tfoot');
16
17
  this.$footer = this.$element.find('tfoot th');
17
- this.$footerchildren = this.$footer.children();
18
+ this.$footerchildren = this.$footer.children().show().css('visibility', 'hidden');
18
19
  this.$topheader = this.$element.find('thead th');
19
20
  this.$searchcontrol = this.$element.find('.search');
20
21
  this.$pagesize = this.$element.find('.grid-pagesize');
@@ -30,7 +31,7 @@
30
31
  this.$tbody = $('<tbody>').insertAfter(this.$thead);
31
32
  this.$colheader = $('<tr>').appendTo(this.$thead);
32
33
 
33
- this.options = $.extend({}, $.fn.datagrid.defaults, options);
34
+ this.options = $.extend(true, {}, $.fn.datagrid.defaults, options);
34
35
  this.options.dataOptions.pageSize = parseInt(this.$pagesize.val(), 10);
35
36
  this.columns = this.options.dataSource.columns();
36
37
 
@@ -42,6 +43,9 @@
42
43
  this.$pageinput.on('change', $.proxy(this.pageChanged, this));
43
44
 
44
45
  this.renderColumns();
46
+
47
+ if (this.options.stretchHeight) this.initStretchHeight();
48
+
45
49
  this.renderData();
46
50
  };
47
51
 
@@ -102,13 +106,14 @@
102
106
  var self = this;
103
107
 
104
108
  this.$tbody.html(this.placeholderRowHTML(this.options.loadingHTML));
105
- this.$footerchildren.hide();
106
109
 
107
110
  this.options.dataSource.data(this.options.dataOptions, function (data) {
108
111
  var itemdesc = (data.count === 1) ? self.options.itemText : self.options.itemsText;
109
112
  var rowHTML = '';
110
113
 
111
- self.$footerchildren.toggle(data.count > 0);
114
+ self.$footerchildren.css('visibility', function () {
115
+ return (data.count > 0) ? 'visible' : 'hidden';
116
+ });
112
117
 
113
118
  self.$pageinput.val(data.page);
114
119
  self.$pageslabel.text(data.pages);
@@ -130,13 +135,15 @@
130
135
  if (!rowHTML) rowHTML = self.placeholderRowHTML('0 ' + self.options.itemsText);
131
136
 
132
137
  self.$tbody.html(rowHTML);
138
+ self.stretchHeight();
139
+
133
140
  self.$element.trigger('loaded');
134
141
  });
135
142
 
136
143
  },
137
144
 
138
145
  placeholderRowHTML: function (content) {
139
- return '<tr><td style="text-align:center;padding:20px;" colspan="' +
146
+ return '<tr><td style="text-align:center;padding:20px;border-bottom:none;" colspan="' +
140
147
  this.columns.length + '">' + content + '</td></tr>';
141
148
  },
142
149
 
@@ -190,8 +197,58 @@
190
197
  reload: function () {
191
198
  this.options.dataOptions.pageIndex = 0;
192
199
  this.renderData();
193
- }
200
+ },
201
+
202
+ initStretchHeight: function () {
203
+ this.$gridContainer = this.$element.parent();
204
+
205
+ this.$element.wrap('<div class="datagrid-stretch-wrapper">');
206
+ this.$stretchWrapper = this.$element.parent();
207
+
208
+ this.$headerTable = $('<table>').attr('class', this.$element.attr('class'));
209
+ this.$footerTable = this.$headerTable.clone();
210
+
211
+ this.$headerTable.prependTo(this.$gridContainer).addClass('datagrid-stretch-header');
212
+ this.$thead.detach().appendTo(this.$headerTable);
213
+
214
+ this.$sizingHeader = this.$thead.clone();
215
+ this.$sizingHeader.find('tr:first').remove();
216
+
217
+ this.$footerTable.appendTo(this.$gridContainer).addClass('datagrid-stretch-footer');
218
+ this.$tfoot.detach().appendTo(this.$footerTable);
219
+ },
194
220
 
221
+ stretchHeight: function () {
222
+ if (!this.$gridContainer) return;
223
+
224
+ this.setColumnWidths();
225
+
226
+ var targetHeight = this.$gridContainer.height();
227
+ var headerHeight = this.$headerTable.outerHeight();
228
+ var footerHeight = this.$footerTable.outerHeight();
229
+ var overhead = headerHeight + footerHeight;
230
+
231
+ this.$stretchWrapper.height(targetHeight - overhead);
232
+ },
233
+
234
+ setColumnWidths: function () {
235
+ if (!this.$sizingHeader) return;
236
+
237
+ this.$element.prepend(this.$sizingHeader);
238
+
239
+ var $sizingCells = this.$sizingHeader.find('th');
240
+ var columnCount = $sizingCells.length;
241
+
242
+ function matchSizingCellWidth(i, el) {
243
+ if (i === columnCount - 1) return;
244
+ $(el).width($sizingCells.eq(i).width());
245
+ }
246
+
247
+ this.$colheader.find('th').each(matchSizingCellWidth);
248
+ this.$tbody.find('tr:first > td').each(matchSizingCellWidth);
249
+
250
+ this.$sizingHeader.detach();
251
+ }
195
252
  };
196
253
 
197
254
 
@@ -217,4 +274,4 @@
217
274
 
218
275
  $.fn.datagrid.Constructor = Datagrid;
219
276
 
220
- }(window.jQuery);
277
+ }(window.jQuery);
@@ -2843,11 +2843,8 @@ define('fuelux/combobox',['require','jquery','./util'],function (require) {
2843
2843
  setDefaultSelection: function () {
2844
2844
  var selector = 'li[data-selected=true]:first';
2845
2845
  var item = this.$element.find(selector);
2846
- if (item.length === 0) {
2847
- // select first item
2848
- this.selectByIndex(0);
2849
- }
2850
- else {
2846
+
2847
+ if (item.length > 0) {
2851
2848
  // select by data-attribute
2852
2849
  this.selectBySelector(selector);
2853
2850
  item.removeData('selected');
@@ -2966,8 +2963,9 @@ define('fuelux/datagrid',['require','jquery'],function(require) {
2966
2963
  var Datagrid = function (element, options) {
2967
2964
  this.$element = $(element);
2968
2965
  this.$thead = this.$element.find('thead');
2966
+ this.$tfoot = this.$element.find('tfoot');
2969
2967
  this.$footer = this.$element.find('tfoot th');
2970
- this.$footerchildren = this.$footer.children();
2968
+ this.$footerchildren = this.$footer.children().show().css('visibility', 'hidden');
2971
2969
  this.$topheader = this.$element.find('thead th');
2972
2970
  this.$searchcontrol = this.$element.find('.search');
2973
2971
  this.$pagesize = this.$element.find('.grid-pagesize');
@@ -2983,7 +2981,7 @@ define('fuelux/datagrid',['require','jquery'],function(require) {
2983
2981
  this.$tbody = $('<tbody>').insertAfter(this.$thead);
2984
2982
  this.$colheader = $('<tr>').appendTo(this.$thead);
2985
2983
 
2986
- this.options = $.extend({}, $.fn.datagrid.defaults, options);
2984
+ this.options = $.extend(true, {}, $.fn.datagrid.defaults, options);
2987
2985
  this.options.dataOptions.pageSize = parseInt(this.$pagesize.val(), 10);
2988
2986
  this.columns = this.options.dataSource.columns();
2989
2987
 
@@ -2995,6 +2993,9 @@ define('fuelux/datagrid',['require','jquery'],function(require) {
2995
2993
  this.$pageinput.on('change', $.proxy(this.pageChanged, this));
2996
2994
 
2997
2995
  this.renderColumns();
2996
+
2997
+ if (this.options.stretchHeight) this.initStretchHeight();
2998
+
2998
2999
  this.renderData();
2999
3000
  };
3000
3001
 
@@ -3055,13 +3056,14 @@ define('fuelux/datagrid',['require','jquery'],function(require) {
3055
3056
  var self = this;
3056
3057
 
3057
3058
  this.$tbody.html(this.placeholderRowHTML(this.options.loadingHTML));
3058
- this.$footerchildren.hide();
3059
3059
 
3060
3060
  this.options.dataSource.data(this.options.dataOptions, function (data) {
3061
3061
  var itemdesc = (data.count === 1) ? self.options.itemText : self.options.itemsText;
3062
3062
  var rowHTML = '';
3063
3063
 
3064
- self.$footerchildren.toggle(data.count > 0);
3064
+ self.$footerchildren.css('visibility', function () {
3065
+ return (data.count > 0) ? 'visible' : 'hidden';
3066
+ });
3065
3067
 
3066
3068
  self.$pageinput.val(data.page);
3067
3069
  self.$pageslabel.text(data.pages);
@@ -3083,13 +3085,15 @@ define('fuelux/datagrid',['require','jquery'],function(require) {
3083
3085
  if (!rowHTML) rowHTML = self.placeholderRowHTML('0 ' + self.options.itemsText);
3084
3086
 
3085
3087
  self.$tbody.html(rowHTML);
3088
+ self.stretchHeight();
3089
+
3086
3090
  self.$element.trigger('loaded');
3087
3091
  });
3088
3092
 
3089
3093
  },
3090
3094
 
3091
3095
  placeholderRowHTML: function (content) {
3092
- return '<tr><td style="text-align:center;padding:20px;" colspan="' +
3096
+ return '<tr><td style="text-align:center;padding:20px;border-bottom:none;" colspan="' +
3093
3097
  this.columns.length + '">' + content + '</td></tr>';
3094
3098
  },
3095
3099
 
@@ -3143,8 +3147,58 @@ define('fuelux/datagrid',['require','jquery'],function(require) {
3143
3147
  reload: function () {
3144
3148
  this.options.dataOptions.pageIndex = 0;
3145
3149
  this.renderData();
3146
- }
3150
+ },
3151
+
3152
+ initStretchHeight: function () {
3153
+ this.$gridContainer = this.$element.parent();
3154
+
3155
+ this.$element.wrap('<div class="datagrid-stretch-wrapper">');
3156
+ this.$stretchWrapper = this.$element.parent();
3157
+
3158
+ this.$headerTable = $('<table>').attr('class', this.$element.attr('class'));
3159
+ this.$footerTable = this.$headerTable.clone();
3160
+
3161
+ this.$headerTable.prependTo(this.$gridContainer).addClass('datagrid-stretch-header');
3162
+ this.$thead.detach().appendTo(this.$headerTable);
3163
+
3164
+ this.$sizingHeader = this.$thead.clone();
3165
+ this.$sizingHeader.find('tr:first').remove();
3166
+
3167
+ this.$footerTable.appendTo(this.$gridContainer).addClass('datagrid-stretch-footer');
3168
+ this.$tfoot.detach().appendTo(this.$footerTable);
3169
+ },
3170
+
3171
+ stretchHeight: function () {
3172
+ if (!this.$gridContainer) return;
3173
+
3174
+ this.setColumnWidths();
3175
+
3176
+ var targetHeight = this.$gridContainer.height();
3177
+ var headerHeight = this.$headerTable.outerHeight();
3178
+ var footerHeight = this.$footerTable.outerHeight();
3179
+ var overhead = headerHeight + footerHeight;
3180
+
3181
+ this.$stretchWrapper.height(targetHeight - overhead);
3182
+ },
3183
+
3184
+ setColumnWidths: function () {
3185
+ if (!this.$sizingHeader) return;
3186
+
3187
+ this.$element.prepend(this.$sizingHeader);
3188
+
3189
+ var $sizingCells = this.$sizingHeader.find('th');
3190
+ var columnCount = $sizingCells.length;
3191
+
3192
+ function matchSizingCellWidth(i, el) {
3193
+ if (i === columnCount - 1) return;
3194
+ $(el).width($sizingCells.eq(i).width());
3195
+ }
3147
3196
 
3197
+ this.$colheader.find('th').each(matchSizingCellWidth);
3198
+ this.$tbody.find('tr:first > td').each(matchSizingCellWidth);
3199
+
3200
+ this.$sizingHeader.detach();
3201
+ }
3148
3202
  };
3149
3203
 
3150
3204
 
@@ -3372,9 +3426,14 @@ define('fuelux/search',['require','jquery'],function(require) {
3372
3426
  var Search = function (element, options) {
3373
3427
  this.$element = $(element);
3374
3428
  this.options = $.extend({}, $.fn.search.defaults, options);
3375
- this.$element.find('button').on('click', $.proxy(this.buttonclicked, this));
3376
- this.$input = this.$element.find('input').on('keydown', $.proxy(this.keypress, this));
3377
- this.$input = this.$element.find('input').on('keyup', $.proxy(this.keypressed, this));
3429
+
3430
+ this.$button = this.$element.find('button')
3431
+ .on('click', $.proxy(this.buttonclicked, this));
3432
+
3433
+ this.$input = this.$element.find('input')
3434
+ .on('keydown', $.proxy(this.keypress, this))
3435
+ .on('keyup', $.proxy(this.keypressed, this));
3436
+
3378
3437
  this.$icon = this.$element.find('i');
3379
3438
  this.activeSearch = '';
3380
3439
  };
@@ -3430,6 +3489,16 @@ define('fuelux/search',['require','jquery'],function(require) {
3430
3489
  inputPresentAndUnchanged = val && (val === this.activeSearch);
3431
3490
  this.$icon.attr('class', inputPresentAndUnchanged ? 'icon-remove' : 'icon-search');
3432
3491
  }
3492
+ },
3493
+
3494
+ disable: function () {
3495
+ this.$input.attr('disabled', 'disabled');
3496
+ this.$button.addClass('disabled');
3497
+ },
3498
+
3499
+ enable: function () {
3500
+ this.$input.removeAttr('disabled');
3501
+ this.$button.removeClass('disabled');
3433
3502
  }
3434
3503
 
3435
3504
  };
@@ -3509,6 +3578,8 @@ define('fuelux/spinner',['require','jquery'],function(require) {
3509
3578
  this.switches.speed = 500;
3510
3579
  }
3511
3580
 
3581
+ this.lastValue = null;
3582
+
3512
3583
  this.render();
3513
3584
 
3514
3585
  if (this.options.disabled) {
@@ -3535,12 +3606,25 @@ define('fuelux/spinner',['require','jquery'],function(require) {
3535
3606
  this.options.value = newVal/1;
3536
3607
  }
3537
3608
 
3538
- this.$element.trigger('change');
3609
+ this.triggerChangedEvent();
3539
3610
  },
3540
3611
 
3541
3612
  stopSpin: function () {
3542
3613
  clearTimeout(this.switches.timeout);
3543
3614
  this.switches.count = 1;
3615
+ this.triggerChangedEvent();
3616
+ },
3617
+
3618
+ triggerChangedEvent: function () {
3619
+ var currentValue = this.value();
3620
+ if (currentValue === this.lastValue) return;
3621
+
3622
+ this.lastValue = currentValue;
3623
+
3624
+ // Primary changed event
3625
+ this.$element.trigger('changed', currentValue);
3626
+
3627
+ // Undocumented, kept for backward compatibility
3544
3628
  this.$element.trigger('change');
3545
3629
  },
3546
3630
 
@@ -3644,7 +3728,7 @@ define('fuelux/spinner',['require','jquery'],function(require) {
3644
3728
  $(function () {
3645
3729
  $('body').on('mousedown.spinner.data-api', '.spinner', function (e) {
3646
3730
  var $this = $(this);
3647
- if ($this.data('.spinner')) return;
3731
+ if ($this.data('spinner')) return;
3648
3732
  $this.spinner($this.data());
3649
3733
  });
3650
3734
  });
@@ -3998,153 +4082,157 @@ define('fuelux/tree',['require','jquery'],function(require) {
3998
4082
  * Licensed under the MIT license.
3999
4083
  */
4000
4084
 
4001
- define('fuelux/wizard',['require','jquery'],function(require) {
4085
+ define('fuelux/wizard',['require','jquery'],function (require) {
4002
4086
 
4003
- var $ = require('jquery');
4087
+ var $ = require('jquery');
4004
4088
 
4005
4089
 
4006
- // WIZARD CONSTRUCTOR AND PROTOTYPE
4090
+ // WIZARD CONSTRUCTOR AND PROTOTYPE
4007
4091
 
4008
- var Wizard = function (element, options) {
4009
- this.$element = $(element);
4010
- this.options = $.extend({}, $.fn.wizard.defaults, options);
4011
- this.currentStep = 1;
4012
- this.numSteps = this.$element.find('li').length;
4013
- this.$prevBtn = this.$element.find('button.btn-prev');
4014
- this.$nextBtn = this.$element.find('button.btn-next');
4015
- this.nextText = this.$nextBtn.text();
4016
-
4017
- // handle events
4018
- this.$prevBtn.on('click', $.proxy(this.previous, this));
4019
- this.$nextBtn.on('click', $.proxy(this.next, this));
4020
- this.$element.on('click', 'li.complete', $.proxy(this.stepclicked, this));
4021
- };
4092
+ var Wizard = function (element, options) {
4093
+ this.$element = $(element);
4094
+ this.options = $.extend({}, $.fn.wizard.defaults, options);
4095
+ this.currentStep = 1;
4096
+ this.numSteps = this.$element.find('li').length;
4097
+ this.$prevBtn = this.$element.find('button.btn-prev');
4098
+ this.$nextBtn = this.$element.find('button.btn-next');
4099
+ this.nextText = this.$nextBtn.text();
4022
4100
 
4023
- Wizard.prototype = {
4024
-
4025
- constructor: Wizard,
4026
-
4027
- setState: function() {
4028
- var canMoveNext = (this.currentStep + 1 <= this.numSteps);
4029
- var lastStep = (this.currentStep === this.numSteps);
4030
- var canMovePrev = (this.currentStep > 1);
4031
- var firstStep = (this.currentStep === 1);
4032
-
4033
- // disable buttons based on current step
4034
- this.$prevBtn.attr('disabled', (firstStep === true || canMovePrev === false));
4035
- this.$nextBtn.attr('disabled', (lastStep === true || canMoveNext === false));
4036
-
4037
- // change button text of last step, if specified
4038
- var data = this.$nextBtn.data();
4039
- if(data && data.last) {
4040
- this.lastText = data.last;
4041
- if(typeof this.lastText !== 'undefined') {
4042
- var text = (lastStep !== true) ? this.nextText : this.lastText;
4043
- this.$nextBtn
4044
- .contents()
4045
- .filter(function() {
4046
- return this.nodeType === 3;
4047
- }).replaceWith(text);
4048
- }
4049
- }
4101
+ // handle events
4102
+ this.$prevBtn.on('click', $.proxy(this.previous, this));
4103
+ this.$nextBtn.on('click', $.proxy(this.next, this));
4104
+ this.$element.on('click', 'li.complete', $.proxy(this.stepclicked, this));
4105
+ };
4050
4106
 
4051
- // reset classes for all steps
4052
- var $steps = this.$element.find('li');
4053
- $steps.removeClass('active').removeClass('complete');
4054
- $steps.find('span.badge').removeClass('badge-info').removeClass('badge-success');
4055
-
4056
- // set class for all previous steps
4057
- var prevSelector = 'li:lt(' + (this.currentStep - 1) + ')';
4058
- var $prevSteps = this.$element.find(prevSelector);
4059
- $prevSteps.addClass('complete');
4060
- $prevSteps.find('span.badge').addClass('badge-success');
4061
-
4062
- // set class for current step
4063
- var currentSelector = 'li:eq(' + (this.currentStep - 1) + ')';
4064
- var $currentStep = this.$element.find(currentSelector);
4065
- $currentStep.addClass('active');
4066
- $currentStep.find('span.badge').addClass('badge-info');
4067
-
4068
- // set display of target element
4069
- var target = $currentStep.data().target;
4070
- $('.step-pane').removeClass('active');
4071
- $(target).addClass('active');
4072
-
4073
- this.$element.trigger('changed');
4074
- },
4107
+ Wizard.prototype = {
4108
+
4109
+ constructor: Wizard,
4110
+
4111
+ setState: function () {
4112
+ var canMovePrev = (this.currentStep > 1);
4113
+ var firstStep = (this.currentStep === 1);
4114
+ var lastStep = (this.currentStep === this.numSteps);
4115
+
4116
+ // disable buttons based on current step
4117
+ this.$prevBtn.attr('disabled', (firstStep === true || canMovePrev === false));
4118
+
4119
+ // change button text of last step, if specified
4120
+ var data = this.$nextBtn.data();
4121
+ if (data && data.last) {
4122
+ this.lastText = data.last;
4123
+ if (typeof this.lastText !== 'undefined') {
4124
+ // replace text
4125
+ var text = (lastStep !== true) ? this.nextText : this.lastText;
4126
+ this.$nextBtn
4127
+ .contents()
4128
+ .filter(function () {
4129
+ return this.nodeType === 3;
4130
+ }).replaceWith(text);
4131
+ }
4132
+ }
4075
4133
 
4076
- stepclicked: function(e) {
4077
- var li = $(e.currentTarget);
4134
+ // reset classes for all steps
4135
+ var $steps = this.$element.find('li');
4136
+ $steps.removeClass('active').removeClass('complete');
4137
+ $steps.find('span.badge').removeClass('badge-info').removeClass('badge-success');
4138
+
4139
+ // set class for all previous steps
4140
+ var prevSelector = 'li:lt(' + (this.currentStep - 1) + ')';
4141
+ var $prevSteps = this.$element.find(prevSelector);
4142
+ $prevSteps.addClass('complete');
4143
+ $prevSteps.find('span.badge').addClass('badge-success');
4144
+
4145
+ // set class for current step
4146
+ var currentSelector = 'li:eq(' + (this.currentStep - 1) + ')';
4147
+ var $currentStep = this.$element.find(currentSelector);
4148
+ $currentStep.addClass('active');
4149
+ $currentStep.find('span.badge').addClass('badge-info');
4150
+
4151
+ // set display of target element
4152
+ var target = $currentStep.data().target;
4153
+ $('.step-pane').removeClass('active');
4154
+ $(target).addClass('active');
4155
+
4156
+ this.$element.trigger('changed');
4157
+ },
4078
4158
 
4079
- var index = $('.steps li').index(li);
4080
- this.currentStep = (index + 1);
4081
- this.setState();
4082
- },
4159
+ stepclicked: function (e) {
4160
+ var li = $(e.currentTarget);
4083
4161
 
4084
- previous: function() {
4085
- var canMovePrev = (this.currentStep > 1);
4086
- if(canMovePrev) {
4087
- var e = $.Event('change');
4088
- this.$element.trigger(e, {step:this.currentStep, direction:'previous'});
4089
- if (e.isDefaultPrevented()) return;
4162
+ var index = $('.steps li').index(li);
4163
+ this.currentStep = (index + 1);
4164
+ this.setState();
4165
+ },
4090
4166
 
4091
- this.currentStep -= 1;
4092
- this.setState();
4093
- }
4094
- },
4167
+ previous: function () {
4168
+ var canMovePrev = (this.currentStep > 1);
4169
+ if (canMovePrev) {
4170
+ var e = $.Event('change');
4171
+ this.$element.trigger(e, {step: this.currentStep, direction: 'previous'});
4172
+ if (e.isDefaultPrevented()) return;
4173
+
4174
+ this.currentStep -= 1;
4175
+ this.setState();
4176
+ }
4177
+ },
4095
4178
 
4096
- next: function() {
4097
- var canMoveNext = (this.currentStep + 1 <= this.numSteps);
4098
- if(canMoveNext) {
4099
- var e = $.Event('change');
4100
- this.$element.trigger(e, {step:this.currentStep, direction:'next'});
4179
+ next: function () {
4180
+ var canMoveNext = (this.currentStep + 1 <= this.numSteps);
4181
+ var lastStep = (this.currentStep === this.numSteps);
4101
4182
 
4102
- if (e.isDefaultPrevented()) return;
4183
+ if (canMoveNext) {
4184
+ var e = $.Event('change');
4185
+ this.$element.trigger(e, {step: this.currentStep, direction: 'next'});
4103
4186
 
4104
- this.currentStep += 1;
4105
- this.setState();
4106
- }
4107
- },
4187
+ if (e.isDefaultPrevented()) return;
4108
4188
 
4109
- selectedItem: function(val) {
4110
- return {
4111
- step: this.currentStep
4112
- };
4113
- }
4114
- };
4189
+ this.currentStep += 1;
4190
+ this.setState();
4191
+ }
4192
+ else if (lastStep) {
4193
+ this.$element.trigger('finished');
4194
+ }
4195
+ },
4115
4196
 
4197
+ selectedItem: function (val) {
4198
+ return {
4199
+ step: this.currentStep
4200
+ };
4201
+ }
4202
+ };
4116
4203
 
4117
- // WIZARD PLUGIN DEFINITION
4118
4204
 
4119
- $.fn.wizard = function (option,value) {
4120
- var methodReturn;
4205
+ // WIZARD PLUGIN DEFINITION
4121
4206
 
4122
- var $set = this.each(function () {
4123
- var $this = $(this);
4124
- var data = $this.data('wizard');
4125
- var options = typeof option === 'object' && option;
4207
+ $.fn.wizard = function (option, value) {
4208
+ var methodReturn;
4126
4209
 
4127
- if (!data) $this.data('wizard', (data = new Wizard(this, options)));
4128
- if (typeof option === 'string') methodReturn = data[option](value);
4129
- });
4210
+ var $set = this.each(function () {
4211
+ var $this = $(this);
4212
+ var data = $this.data('wizard');
4213
+ var options = typeof option === 'object' && option;
4130
4214
 
4131
- return (methodReturn === undefined) ? $set : methodReturn;
4132
- };
4215
+ if (!data) $this.data('wizard', (data = new Wizard(this, options)));
4216
+ if (typeof option === 'string') methodReturn = data[option](value);
4217
+ });
4133
4218
 
4134
- $.fn.wizard.defaults = {};
4219
+ return (methodReturn === undefined) ? $set : methodReturn;
4220
+ };
4135
4221
 
4136
- $.fn.wizard.Constructor = Wizard;
4222
+ $.fn.wizard.defaults = {};
4137
4223
 
4224
+ $.fn.wizard.Constructor = Wizard;
4138
4225
 
4139
- // WIZARD DATA-API
4140
4226
 
4141
- $(function () {
4142
- $('body').on('mousedown.wizard.data-api', '.wizard', function () {
4143
- var $this = $(this);
4144
- if ($this.data('wizard')) return;
4145
- $this.wizard($this.data());
4146
- });
4147
- });
4227
+ // WIZARD DATA-API
4228
+
4229
+ $(function () {
4230
+ $('body').on('mousedown.wizard.data-api', '.wizard', function () {
4231
+ var $this = $(this);
4232
+ if ($this.data('wizard')) return;
4233
+ $this.wizard($this.data());
4234
+ });
4235
+ });
4148
4236
 
4149
4237
  });
4150
4238
 
@@ -65,5 +65,4 @@
65
65
  });
66
66
  });
67
67
 
68
- }(window.jQuery);
69
-
68
+ }(window.jQuery);
@@ -13,9 +13,14 @@
13
13
  var Search = function (element, options) {
14
14
  this.$element = $(element);
15
15
  this.options = $.extend({}, $.fn.search.defaults, options);
16
- this.$element.find('button').on('click', $.proxy(this.buttonclicked, this));
17
- this.$input = this.$element.find('input').on('keydown', $.proxy(this.keypress, this));
18
- this.$input = this.$element.find('input').on('keyup', $.proxy(this.keypressed, this));
16
+
17
+ this.$button = this.$element.find('button')
18
+ .on('click', $.proxy(this.buttonclicked, this));
19
+
20
+ this.$input = this.$element.find('input')
21
+ .on('keydown', $.proxy(this.keypress, this))
22
+ .on('keyup', $.proxy(this.keypressed, this));
23
+
19
24
  this.$icon = this.$element.find('i');
20
25
  this.activeSearch = '';
21
26
  };
@@ -71,6 +76,16 @@
71
76
  inputPresentAndUnchanged = val && (val === this.activeSearch);
72
77
  this.$icon.attr('class', inputPresentAndUnchanged ? 'icon-remove' : 'icon-search');
73
78
  }
79
+ },
80
+
81
+ disable: function () {
82
+ this.$input.attr('disabled', 'disabled');
83
+ this.$button.addClass('disabled');
84
+ },
85
+
86
+ enable: function () {
87
+ this.$input.removeAttr('disabled');
88
+ this.$button.removeClass('disabled');
74
89
  }
75
90
 
76
91
  };
@@ -104,4 +119,4 @@
104
119
  });
105
120
  });
106
121
 
107
- }(window.jQuery);
122
+ }(window.jQuery);
@@ -39,6 +39,8 @@
39
39
  this.switches.speed = 500;
40
40
  }
41
41
 
42
+ this.lastValue = null;
43
+
42
44
  this.render();
43
45
 
44
46
  if (this.options.disabled) {
@@ -65,12 +67,25 @@
65
67
  this.options.value = newVal/1;
66
68
  }
67
69
 
68
- this.$element.trigger('change');
70
+ this.triggerChangedEvent();
69
71
  },
70
72
 
71
73
  stopSpin: function () {
72
74
  clearTimeout(this.switches.timeout);
73
75
  this.switches.count = 1;
76
+ this.triggerChangedEvent();
77
+ },
78
+
79
+ triggerChangedEvent: function () {
80
+ var currentValue = this.value();
81
+ if (currentValue === this.lastValue) return;
82
+
83
+ this.lastValue = currentValue;
84
+
85
+ // Primary changed event
86
+ this.$element.trigger('changed', currentValue);
87
+
88
+ // Undocumented, kept for backward compatibility
74
89
  this.$element.trigger('change');
75
90
  },
76
91
 
@@ -174,9 +189,9 @@
174
189
  $(function () {
175
190
  $('body').on('mousedown.spinner.data-api', '.spinner', function (e) {
176
191
  var $this = $(this);
177
- if ($this.data('.spinner')) return;
192
+ if ($this.data('spinner')) return;
178
193
  $this.spinner($this.data());
179
194
  });
180
195
  });
181
196
 
182
- }(window.jQuery);
197
+ }(window.jQuery);
@@ -23,4 +23,4 @@
23
23
  return fuelTextExactCI(elem, match[3]);
24
24
  };
25
25
 
26
- }(window.jQuery);
26
+ }(window.jQuery);
@@ -8,147 +8,151 @@
8
8
 
9
9
  !function ($) {
10
10
 
11
- // WIZARD CONSTRUCTOR AND PROTOTYPE
12
-
13
- var Wizard = function (element, options) {
14
- this.$element = $(element);
15
- this.options = $.extend({}, $.fn.wizard.defaults, options);
16
- this.currentStep = 1;
17
- this.numSteps = this.$element.find('li').length;
18
- this.$prevBtn = this.$element.find('button.btn-prev');
19
- this.$nextBtn = this.$element.find('button.btn-next');
20
- this.nextText = this.$nextBtn.text();
21
-
22
- // handle events
23
- this.$prevBtn.on('click', $.proxy(this.previous, this));
24
- this.$nextBtn.on('click', $.proxy(this.next, this));
25
- this.$element.on('click', 'li.complete', $.proxy(this.stepclicked, this));
26
- };
27
-
28
- Wizard.prototype = {
29
-
30
- constructor: Wizard,
31
-
32
- setState: function() {
33
- var canMoveNext = (this.currentStep + 1 <= this.numSteps);
34
- var lastStep = (this.currentStep === this.numSteps);
35
- var canMovePrev = (this.currentStep > 1);
36
- var firstStep = (this.currentStep === 1);
37
-
38
- // disable buttons based on current step
39
- this.$prevBtn.attr('disabled', (firstStep === true || canMovePrev === false));
40
- this.$nextBtn.attr('disabled', (lastStep === true || canMoveNext === false));
41
-
42
- // change button text of last step, if specified
43
- var data = this.$nextBtn.data();
44
- if(data && data.last) {
45
- this.lastText = data.last;
46
- if(typeof this.lastText !== 'undefined') {
47
- var text = (lastStep !== true) ? this.nextText : this.lastText;
48
- this.$nextBtn
49
- .contents()
50
- .filter(function() {
51
- return this.nodeType === 3;
52
- }).replaceWith(text);
53
- }
54
- }
55
-
56
- // reset classes for all steps
57
- var $steps = this.$element.find('li');
58
- $steps.removeClass('active').removeClass('complete');
59
- $steps.find('span.badge').removeClass('badge-info').removeClass('badge-success');
60
-
61
- // set class for all previous steps
62
- var prevSelector = 'li:lt(' + (this.currentStep - 1) + ')';
63
- var $prevSteps = this.$element.find(prevSelector);
64
- $prevSteps.addClass('complete');
65
- $prevSteps.find('span.badge').addClass('badge-success');
66
-
67
- // set class for current step
68
- var currentSelector = 'li:eq(' + (this.currentStep - 1) + ')';
69
- var $currentStep = this.$element.find(currentSelector);
70
- $currentStep.addClass('active');
71
- $currentStep.find('span.badge').addClass('badge-info');
72
-
73
- // set display of target element
74
- var target = $currentStep.data().target;
75
- $('.step-pane').removeClass('active');
76
- $(target).addClass('active');
77
-
78
- this.$element.trigger('changed');
79
- },
80
-
81
- stepclicked: function(e) {
82
- var li = $(e.currentTarget);
83
-
84
- var index = $('.steps li').index(li);
85
- this.currentStep = (index + 1);
86
- this.setState();
87
- },
88
-
89
- previous: function() {
90
- var canMovePrev = (this.currentStep > 1);
91
- if(canMovePrev) {
92
- var e = $.Event('change');
93
- this.$element.trigger(e, {step:this.currentStep, direction:'previous'});
94
- if (e.isDefaultPrevented()) return;
95
-
96
- this.currentStep -= 1;
97
- this.setState();
98
- }
99
- },
100
-
101
- next: function() {
102
- var canMoveNext = (this.currentStep + 1 <= this.numSteps);
103
- if(canMoveNext) {
104
- var e = $.Event('change');
105
- this.$element.trigger(e, {step:this.currentStep, direction:'next'});
106
-
107
- if (e.isDefaultPrevented()) return;
108
-
109
- this.currentStep += 1;
110
- this.setState();
111
- }
112
- },
113
-
114
- selectedItem: function(val) {
115
- return {
116
- step: this.currentStep
117
- };
118
- }
119
- };
120
-
121
-
122
- // WIZARD PLUGIN DEFINITION
123
-
124
- $.fn.wizard = function (option,value) {
125
- var methodReturn;
126
-
127
- var $set = this.each(function () {
128
- var $this = $(this);
129
- var data = $this.data('wizard');
130
- var options = typeof option === 'object' && option;
131
-
132
- if (!data) $this.data('wizard', (data = new Wizard(this, options)));
133
- if (typeof option === 'string') methodReturn = data[option](value);
134
- });
135
-
136
- return (methodReturn === undefined) ? $set : methodReturn;
137
- };
138
-
139
- $.fn.wizard.defaults = {};
140
-
141
- $.fn.wizard.Constructor = Wizard;
142
-
143
-
144
- // WIZARD DATA-API
145
-
146
- $(function () {
147
- $('body').on('mousedown.wizard.data-api', '.wizard', function () {
148
- var $this = $(this);
149
- if ($this.data('wizard')) return;
150
- $this.wizard($this.data());
151
- });
152
- });
11
+ // WIZARD CONSTRUCTOR AND PROTOTYPE
12
+
13
+ var Wizard = function (element, options) {
14
+ this.$element = $(element);
15
+ this.options = $.extend({}, $.fn.wizard.defaults, options);
16
+ this.currentStep = 1;
17
+ this.numSteps = this.$element.find('li').length;
18
+ this.$prevBtn = this.$element.find('button.btn-prev');
19
+ this.$nextBtn = this.$element.find('button.btn-next');
20
+ this.nextText = this.$nextBtn.text();
21
+
22
+ // handle events
23
+ this.$prevBtn.on('click', $.proxy(this.previous, this));
24
+ this.$nextBtn.on('click', $.proxy(this.next, this));
25
+ this.$element.on('click', 'li.complete', $.proxy(this.stepclicked, this));
26
+ };
27
+
28
+ Wizard.prototype = {
29
+
30
+ constructor: Wizard,
31
+
32
+ setState: function () {
33
+ var canMovePrev = (this.currentStep > 1);
34
+ var firstStep = (this.currentStep === 1);
35
+ var lastStep = (this.currentStep === this.numSteps);
36
+
37
+ // disable buttons based on current step
38
+ this.$prevBtn.attr('disabled', (firstStep === true || canMovePrev === false));
39
+
40
+ // change button text of last step, if specified
41
+ var data = this.$nextBtn.data();
42
+ if (data && data.last) {
43
+ this.lastText = data.last;
44
+ if (typeof this.lastText !== 'undefined') {
45
+ // replace text
46
+ var text = (lastStep !== true) ? this.nextText : this.lastText;
47
+ this.$nextBtn
48
+ .contents()
49
+ .filter(function () {
50
+ return this.nodeType === 3;
51
+ }).replaceWith(text);
52
+ }
53
+ }
54
+
55
+ // reset classes for all steps
56
+ var $steps = this.$element.find('li');
57
+ $steps.removeClass('active').removeClass('complete');
58
+ $steps.find('span.badge').removeClass('badge-info').removeClass('badge-success');
59
+
60
+ // set class for all previous steps
61
+ var prevSelector = 'li:lt(' + (this.currentStep - 1) + ')';
62
+ var $prevSteps = this.$element.find(prevSelector);
63
+ $prevSteps.addClass('complete');
64
+ $prevSteps.find('span.badge').addClass('badge-success');
65
+
66
+ // set class for current step
67
+ var currentSelector = 'li:eq(' + (this.currentStep - 1) + ')';
68
+ var $currentStep = this.$element.find(currentSelector);
69
+ $currentStep.addClass('active');
70
+ $currentStep.find('span.badge').addClass('badge-info');
71
+
72
+ // set display of target element
73
+ var target = $currentStep.data().target;
74
+ $('.step-pane').removeClass('active');
75
+ $(target).addClass('active');
76
+
77
+ this.$element.trigger('changed');
78
+ },
79
+
80
+ stepclicked: function (e) {
81
+ var li = $(e.currentTarget);
82
+
83
+ var index = $('.steps li').index(li);
84
+ this.currentStep = (index + 1);
85
+ this.setState();
86
+ },
87
+
88
+ previous: function () {
89
+ var canMovePrev = (this.currentStep > 1);
90
+ if (canMovePrev) {
91
+ var e = $.Event('change');
92
+ this.$element.trigger(e, {step: this.currentStep, direction: 'previous'});
93
+ if (e.isDefaultPrevented()) return;
94
+
95
+ this.currentStep -= 1;
96
+ this.setState();
97
+ }
98
+ },
99
+
100
+ next: function () {
101
+ var canMoveNext = (this.currentStep + 1 <= this.numSteps);
102
+ var lastStep = (this.currentStep === this.numSteps);
103
+
104
+ if (canMoveNext) {
105
+ var e = $.Event('change');
106
+ this.$element.trigger(e, {step: this.currentStep, direction: 'next'});
107
+
108
+ if (e.isDefaultPrevented()) return;
109
+
110
+ this.currentStep += 1;
111
+ this.setState();
112
+ }
113
+ else if (lastStep) {
114
+ this.$element.trigger('finished');
115
+ }
116
+ },
117
+
118
+ selectedItem: function (val) {
119
+ return {
120
+ step: this.currentStep
121
+ };
122
+ }
123
+ };
124
+
125
+
126
+ // WIZARD PLUGIN DEFINITION
127
+
128
+ $.fn.wizard = function (option, value) {
129
+ var methodReturn;
130
+
131
+ var $set = this.each(function () {
132
+ var $this = $(this);
133
+ var data = $this.data('wizard');
134
+ var options = typeof option === 'object' && option;
135
+
136
+ if (!data) $this.data('wizard', (data = new Wizard(this, options)));
137
+ if (typeof option === 'string') methodReturn = data[option](value);
138
+ });
139
+
140
+ return (methodReturn === undefined) ? $set : methodReturn;
141
+ };
142
+
143
+ $.fn.wizard.defaults = {};
144
+
145
+ $.fn.wizard.Constructor = Wizard;
146
+
147
+
148
+ // WIZARD DATA-API
149
+
150
+ $(function () {
151
+ $('body').on('mousedown.wizard.data-api', '.wizard', function () {
152
+ var $this = $(this);
153
+ if ($this.data('wizard')) return;
154
+ $this.wizard($this.data());
155
+ });
156
+ });
153
157
 
154
- }(window.jQuery);
158
+ }(window.jQuery);
@@ -4,7 +4,7 @@
4
4
  }
5
5
 
6
6
  i {
7
- background-image: url(../img/form.png);
7
+ background-image: url(image-path('form.png'));
8
8
  background-position: 0 1px;
9
9
  background-repeat: no-repeat;
10
10
  margin-left: -20px;
@@ -95,4 +95,48 @@
95
95
 
96
96
  }
97
97
 
98
- }
98
+ }
99
+
100
+ .datagrid-stretch-header {
101
+ border-bottom: 0;
102
+ .border-bottom-radius(0);
103
+
104
+ margin-bottom: 0;
105
+
106
+ thead:last-child tr:last-child > th:first-child,
107
+ thead:last-child tr:last-child > th:last-child {
108
+ .border-bottom-radius(0);
109
+ }
110
+ }
111
+
112
+ .datagrid-stretch-wrapper {
113
+ border: 1px solid @tableBorder;
114
+ overflow: auto;
115
+
116
+ .datagrid {
117
+ border: none;
118
+ border-collapse: collapse;
119
+ .border-radius(0);
120
+
121
+ margin-bottom: 0;
122
+
123
+ td, th {
124
+ border-bottom: 1px solid @tableBorder;
125
+
126
+ &:first-child {
127
+ border-left: none;
128
+ .border-radius(0);
129
+ }
130
+ }
131
+ }
132
+ }
133
+
134
+ .datagrid-stretch-footer {
135
+ border-top: 0;
136
+ .border-top-radius(0);
137
+
138
+ th {
139
+ border-top: 0;
140
+ }
141
+ }
142
+
@@ -49,4 +49,4 @@
49
49
  }
50
50
  }
51
51
  }
52
- }
52
+ }
metadata CHANGED
@@ -1,15 +1,15 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fuelux-rails
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.2.0.beta.1
5
- prerelease: 6
4
+ version: 2.2.0
5
+ prerelease:
6
6
  platform: ruby
7
7
  authors:
8
8
  - Stephen Baldwin
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-12-11 00:00:00.000000000 Z
12
+ date: 2013-01-04 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: railties
@@ -66,7 +66,7 @@ dependencies:
66
66
  requirements:
67
67
  - - ~>
68
68
  - !ruby/object:Gem::Version
69
- version: 2.1.3
69
+ version: 2.2.0
70
70
  type: :development
71
71
  prerelease: false
72
72
  version_requirements: !ruby/object:Gem::Requirement
@@ -74,7 +74,7 @@ dependencies:
74
74
  requirements:
75
75
  - - ~>
76
76
  - !ruby/object:Gem::Version
77
- version: 2.1.3
77
+ version: 2.2.0
78
78
  - !ruby/object:Gem::Dependency
79
79
  name: rails
80
80
  requirement: !ruby/object:Gem::Requirement
@@ -182,9 +182,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
182
182
  required_rubygems_version: !ruby/object:Gem::Requirement
183
183
  none: false
184
184
  requirements:
185
- - - ! '>'
185
+ - - ! '>='
186
186
  - !ruby/object:Gem::Version
187
- version: 1.3.1
187
+ version: '0'
188
188
  requirements: []
189
189
  rubyforge_project: fuelux-rails
190
190
  rubygems_version: 1.8.24