fuelux-rails 2.1.3 → 2.2.0.beta.1
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.
- data/COPYING +28 -0
- data/README.md +59 -0
- data/THIRD-PARTY +25 -0
- data/lib/fuelux-rails/version.rb +1 -1
- data/vendor/assets/images/form.png +0 -0
- data/vendor/assets/javascripts/fuelux/checkbox.js +106 -0
- data/vendor/assets/javascripts/fuelux/combobox.js +122 -11
- data/vendor/assets/javascripts/fuelux/datagrid.js +7 -3
- data/vendor/assets/javascripts/fuelux/loader.js +1045 -43
- data/vendor/assets/javascripts/fuelux/pillbox.js +2 -1
- data/vendor/assets/javascripts/fuelux/radio.js +106 -0
- data/vendor/assets/javascripts/fuelux/search.js +1 -2
- data/vendor/assets/javascripts/fuelux/select.js +166 -0
- data/vendor/assets/javascripts/fuelux/spinner.js +2 -3
- data/vendor/assets/javascripts/fuelux/tree.js +166 -0
- data/vendor/assets/javascripts/fuelux/util.js +26 -0
- data/vendor/assets/javascripts/fuelux/wizard.js +154 -0
- data/vendor/assets/javascripts/fuelux.js +6 -0
- data/vendor/toolkit/fuelux/checkbox.less +52 -0
- data/vendor/toolkit/fuelux/combobox.less +0 -0
- data/vendor/toolkit/fuelux/datagrid.less +0 -0
- data/vendor/toolkit/fuelux/pillbox.less +0 -0
- data/vendor/toolkit/fuelux/radio.less +52 -0
- data/vendor/toolkit/fuelux/select.less +17 -0
- data/vendor/toolkit/fuelux/spinner.less +0 -0
- data/vendor/toolkit/fuelux/tree.less +97 -0
- data/vendor/toolkit/fuelux/wizard.less +147 -0
- data/vendor/toolkit/fuelux.less +7 -0
- metadata +20 -7
- data/MIT-LICENSE +0 -20
- data/README.rdoc +0 -3
data/COPYING
ADDED
@@ -0,0 +1,28 @@
|
|
1
|
+
Copyright (C) 2012, LivePage, LLC.
|
2
|
+
All rights reserved.
|
3
|
+
|
4
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy of
|
5
|
+
this software and associated documentation files (the "Software"), to deal in the
|
6
|
+
Software without restriction, including without limitation the rights to use, copy,
|
7
|
+
modify, merge, publish, distribute, sublicense, and/or sell copies of the Software,
|
8
|
+
and to permit persons to whom the Software is furnished to do so, subject to the
|
9
|
+
following conditions:
|
10
|
+
|
11
|
+
The above copyright notice and this permission notice shall be included in all
|
12
|
+
copies or substantial portions of the Software.
|
13
|
+
|
14
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
|
15
|
+
INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
|
16
|
+
PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
|
17
|
+
HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
|
18
|
+
CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE
|
19
|
+
OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
20
|
+
|
21
|
+
====================================================================
|
22
|
+
|
23
|
+
The above license does not apply to the following bundled components:
|
24
|
+
|
25
|
+
• Fuel UX Located under vendor/assets/javascripts/fuelux
|
26
|
+
• Fuel UX Located under vendor/toolkit/fuelux
|
27
|
+
|
28
|
+
Licensing information regarding the above packages can be found in the THIRD-PARTY file.
|
data/README.md
ADDED
@@ -0,0 +1,59 @@
|
|
1
|
+
# Fuel UX for Rails 3.1 Asset Pipeline
|
2
|
+
Extends Twitter Bootstrap with additional lightweight JavaScript controls. Easy to install, customize, update, and optimize.
|
3
|
+
|
4
|
+
fuelux-rails project integrates Fuel UX into the Twitter Bootstrap CSS toolkit for Rails 3.1 Asset Pipeline (Rails 3.2 supported)
|
5
|
+
|
6
|
+
## Installing Gem
|
7
|
+
|
8
|
+
Include the [FuelUX Rails gem](http://rubygems.org/gems/fuelux-rails) in Gemfile to install it from [RubyGems.org](http://rubygems.org);
|
9
|
+
|
10
|
+
```ruby
|
11
|
+
gem "fuelux-rails"
|
12
|
+
```
|
13
|
+
|
14
|
+
or you can install from latest build;
|
15
|
+
|
16
|
+
```ruby
|
17
|
+
gem 'fuelux-rails', :git => 'git://github.com/stephenbaldwin/fuelux-rails.git'
|
18
|
+
```
|
19
|
+
|
20
|
+
You can run bundle from command line
|
21
|
+
|
22
|
+
bundle install
|
23
|
+
|
24
|
+
|
25
|
+
## Installing to App (using Generators)
|
26
|
+
|
27
|
+
You can run following generators to get started with Twitter Bootstrap quickly.
|
28
|
+
|
29
|
+
|
30
|
+
Install (requires directives to Asset pipeline.)
|
31
|
+
|
32
|
+
|
33
|
+
Usage:
|
34
|
+
|
35
|
+
rails g fuelux:install
|
36
|
+
|
37
|
+
## Using with Less
|
38
|
+
|
39
|
+
Fuel UX was built with Preboot, an open-source pack of mixins and variables to be used in conjunction with Less, a CSS preprocessor for faster and easier web development.
|
40
|
+
|
41
|
+
## Using stylesheets with Less
|
42
|
+
|
43
|
+
You have to require Fuel UX Rails LESS (fuelux.less) in your bootstrap_and_overrides.css.less
|
44
|
+
|
45
|
+
```css
|
46
|
+
@import 'fuelux.less';
|
47
|
+
```
|
48
|
+
|
49
|
+
## Using Javascripts
|
50
|
+
|
51
|
+
You have to require Fuel UX (fuelux.js) in your application.js
|
52
|
+
|
53
|
+
```js
|
54
|
+
//= require fuelux.js
|
55
|
+
|
56
|
+
$(document).ready(function(){
|
57
|
+
/* Your javascripts goes here... */
|
58
|
+
});
|
59
|
+
```
|
data/THIRD-PARTY
ADDED
@@ -0,0 +1,25 @@
|
|
1
|
+
This file lists bundled packages and their associated licensing terms.
|
2
|
+
|
3
|
+
MIT
|
4
|
+
|
5
|
+
• Fuel UX located under vendor/assets/javascripts/fuelux. Copyright (C) 2012, ExactTarget, Inc
|
6
|
+
• Fuel UX located under vendor/toolkit/fuelux. Copyright (C) 2012, ExactTarget, Inc
|
7
|
+
|
8
|
+
All rights reserved.
|
9
|
+
|
10
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy of
|
11
|
+
this software and associated documentation files (the "Software"), to deal in the
|
12
|
+
Software without restriction, including without limitation the rights to use, copy,
|
13
|
+
modify, merge, publish, distribute, sublicense, and/or sell copies of the Software,
|
14
|
+
and to permit persons to whom the Software is furnished to do so, subject to the
|
15
|
+
following conditions:
|
16
|
+
|
17
|
+
The above copyright notice and this permission notice shall be included in all
|
18
|
+
copies or substantial portions of the Software.
|
19
|
+
|
20
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
|
21
|
+
INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
|
22
|
+
PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
|
23
|
+
HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
|
24
|
+
CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE
|
25
|
+
OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/lib/fuelux-rails/version.rb
CHANGED
Binary file
|
@@ -0,0 +1,106 @@
|
|
1
|
+
/*
|
2
|
+
* Fuel UX Checkbox
|
3
|
+
* https://github.com/ExactTarget/fuelux
|
4
|
+
*
|
5
|
+
* Copyright (c) 2012 ExactTarget
|
6
|
+
* Licensed under the MIT license.
|
7
|
+
*/
|
8
|
+
|
9
|
+
!function ($) {
|
10
|
+
|
11
|
+
// CHECKBOX CONSTRUCTOR AND PROTOTYPE
|
12
|
+
|
13
|
+
var Checkbox = function (element, options) {
|
14
|
+
|
15
|
+
this.$element = $(element);
|
16
|
+
this.options = $.extend({}, $.fn.checkbox.defaults, options);
|
17
|
+
|
18
|
+
// cache elements
|
19
|
+
this.$label = this.$element.parent();
|
20
|
+
this.$icon = this.$label.find('i');
|
21
|
+
this.$chk = this.$label.find('input[type=checkbox]');
|
22
|
+
|
23
|
+
// set default state
|
24
|
+
this.setState(this.$chk);
|
25
|
+
|
26
|
+
// handle events
|
27
|
+
this.$chk.on('change', $.proxy(this.itemchecked, this));
|
28
|
+
};
|
29
|
+
|
30
|
+
Checkbox.prototype = {
|
31
|
+
|
32
|
+
constructor: Checkbox,
|
33
|
+
|
34
|
+
setState: function ($chk) {
|
35
|
+
var checked = $chk.is(':checked');
|
36
|
+
var disabled = $chk.is(':disabled');
|
37
|
+
|
38
|
+
// reset classes
|
39
|
+
this.$icon.removeClass('checked').removeClass('disabled');
|
40
|
+
|
41
|
+
// set state of checkbox
|
42
|
+
if (checked === true) {
|
43
|
+
this.$icon.addClass('checked');
|
44
|
+
}
|
45
|
+
if (disabled === true) {
|
46
|
+
this.$icon.addClass('disabled');
|
47
|
+
}
|
48
|
+
},
|
49
|
+
|
50
|
+
enable: function () {
|
51
|
+
this.$chk.attr('disabled', false);
|
52
|
+
this.$icon.removeClass('disabled');
|
53
|
+
},
|
54
|
+
|
55
|
+
disable: function () {
|
56
|
+
this.$chk.attr('disabled', true);
|
57
|
+
this.$icon.addClass('disabled');
|
58
|
+
},
|
59
|
+
|
60
|
+
toggle: function () {
|
61
|
+
this.$chk.click();
|
62
|
+
},
|
63
|
+
|
64
|
+
itemchecked: function (e) {
|
65
|
+
var chk = $(e.target);
|
66
|
+
this.setState(chk);
|
67
|
+
}
|
68
|
+
};
|
69
|
+
|
70
|
+
|
71
|
+
// CHECKBOX PLUGIN DEFINITION
|
72
|
+
|
73
|
+
$.fn.checkbox = function (option, value) {
|
74
|
+
var methodReturn;
|
75
|
+
|
76
|
+
var $set = this.each(function () {
|
77
|
+
var $this = $(this);
|
78
|
+
var data = $this.data('checkbox');
|
79
|
+
var options = typeof option === 'object' && option;
|
80
|
+
|
81
|
+
if (!data) $this.data('checkbox', (data = new Checkbox(this, options)));
|
82
|
+
if (typeof option === 'string') methodReturn = data[option](value);
|
83
|
+
});
|
84
|
+
|
85
|
+
return (methodReturn === undefined) ? $set : methodReturn;
|
86
|
+
};
|
87
|
+
|
88
|
+
$.fn.checkbox.defaults = {};
|
89
|
+
|
90
|
+
$.fn.checkbox.Constructor = Checkbox;
|
91
|
+
|
92
|
+
|
93
|
+
// CHECKBOX DATA-API
|
94
|
+
|
95
|
+
$(function () {
|
96
|
+
$(window).on('load', function () {
|
97
|
+
//$('i.checkbox').each(function () {
|
98
|
+
$('.checkbox-custom > input[type=checkbox]').each(function () {
|
99
|
+
var $this = $(this);
|
100
|
+
if ($this.data('checkbox')) return;
|
101
|
+
$this.checkbox($this.data());
|
102
|
+
});
|
103
|
+
});
|
104
|
+
});
|
105
|
+
|
106
|
+
}(window.jQuery);
|
@@ -6,31 +6,129 @@
|
|
6
6
|
* Licensed under the MIT license.
|
7
7
|
*/
|
8
8
|
|
9
|
-
!function($){
|
10
|
-
|
11
|
-
|
9
|
+
!function ($) {
|
10
|
+
|
12
11
|
// COMBOBOX CONSTRUCTOR AND PROTOTYPE
|
13
12
|
|
14
13
|
var Combobox = function (element, options) {
|
15
14
|
this.$element = $(element);
|
16
15
|
this.options = $.extend({}, $.fn.combobox.defaults, options);
|
17
16
|
this.$element.on('click', 'a', $.proxy(this.itemclicked, this));
|
17
|
+
this.$element.on('change', 'input', $.proxy(this.inputchanged, this));
|
18
18
|
this.$input = this.$element.find('input');
|
19
|
+
this.$button = this.$element.find('.btn');
|
20
|
+
|
21
|
+
// set default selection
|
22
|
+
this.setDefaultSelection();
|
19
23
|
};
|
20
24
|
|
21
25
|
Combobox.prototype = {
|
22
26
|
|
23
27
|
constructor: Combobox,
|
24
28
|
|
25
|
-
|
26
|
-
this.$
|
27
|
-
|
29
|
+
selectedItem: function () {
|
30
|
+
var item = this.$selectedItem;
|
31
|
+
var data = {};
|
32
|
+
|
33
|
+
if (item) {
|
34
|
+
var txt = this.$selectedItem.text();
|
35
|
+
data = $.extend({ text: txt }, this.$selectedItem.data());
|
36
|
+
}
|
37
|
+
else {
|
38
|
+
data = { text: this.$input.val()};
|
39
|
+
}
|
40
|
+
|
41
|
+
return data;
|
42
|
+
},
|
43
|
+
|
44
|
+
selectByText: function (text) {
|
45
|
+
var selector = 'li:fuelTextExactCI(' + text + ')';
|
46
|
+
this.selectBySelector(selector);
|
47
|
+
},
|
48
|
+
|
49
|
+
selectByValue: function (value) {
|
50
|
+
var selector = 'li[data-value=' + value + ']';
|
51
|
+
this.selectBySelector(selector);
|
52
|
+
},
|
53
|
+
|
54
|
+
selectByIndex: function (index) {
|
55
|
+
// zero-based index
|
56
|
+
var selector = 'li:eq(' + index + ')';
|
57
|
+
this.selectBySelector(selector);
|
58
|
+
},
|
59
|
+
|
60
|
+
selectBySelector: function (selector) {
|
61
|
+
var $item = this.$element.find(selector);
|
62
|
+
|
63
|
+
if (typeof $item[0] !== 'undefined') {
|
64
|
+
this.$selectedItem = $item;
|
65
|
+
this.$input.val(this.$selectedItem.text());
|
66
|
+
}
|
67
|
+
else {
|
68
|
+
this.$selectedItem = null;
|
69
|
+
}
|
70
|
+
},
|
71
|
+
|
72
|
+
setDefaultSelection: function () {
|
73
|
+
var selector = 'li[data-selected=true]:first';
|
74
|
+
var item = this.$element.find(selector);
|
75
|
+
if (item.length === 0) {
|
76
|
+
// select first item
|
77
|
+
this.selectByIndex(0);
|
78
|
+
}
|
79
|
+
else {
|
80
|
+
// select by data-attribute
|
81
|
+
this.selectBySelector(selector);
|
82
|
+
item.removeData('selected');
|
83
|
+
item.removeAttr('data-selected');
|
84
|
+
}
|
85
|
+
},
|
86
|
+
|
87
|
+
enable: function () {
|
88
|
+
this.$input.removeAttr('disabled');
|
89
|
+
this.$button.removeClass('disabled');
|
90
|
+
},
|
91
|
+
|
92
|
+
disable: function () {
|
93
|
+
this.$input.attr('disabled', true);
|
94
|
+
this.$button.addClass('disabled');
|
28
95
|
},
|
29
96
|
|
30
97
|
itemclicked: function (e) {
|
31
|
-
this
|
32
|
-
|
98
|
+
this.$selectedItem = $(e.target).parent();
|
99
|
+
|
100
|
+
// set input text and trigger input change event marked as synthetic
|
101
|
+
this.$input.val(this.$selectedItem.text()).trigger('change', { synthetic: true });
|
102
|
+
|
103
|
+
// pass object including text and any data-attributes
|
104
|
+
// to onchange event
|
105
|
+
var data = this.selectedItem();
|
106
|
+
|
107
|
+
// trigger changed event
|
108
|
+
this.$element.trigger('changed', data);
|
109
|
+
|
33
110
|
e.preventDefault();
|
111
|
+
},
|
112
|
+
|
113
|
+
inputchanged: function (e, extra) {
|
114
|
+
|
115
|
+
// skip processing for internally-generated synthetic event
|
116
|
+
// to avoid double processing
|
117
|
+
if (extra && extra.synthetic) return;
|
118
|
+
|
119
|
+
var val = $(e.target).val();
|
120
|
+
this.selectByText(val);
|
121
|
+
|
122
|
+
// find match based on input
|
123
|
+
// if no match, pass the input value
|
124
|
+
var data = this.selectedItem();
|
125
|
+
if (data.text.length === 0) {
|
126
|
+
data = { text: val };
|
127
|
+
}
|
128
|
+
|
129
|
+
// trigger changed event
|
130
|
+
this.$element.trigger('changed', data);
|
131
|
+
|
34
132
|
}
|
35
133
|
|
36
134
|
};
|
@@ -38,15 +136,19 @@
|
|
38
136
|
|
39
137
|
// COMBOBOX PLUGIN DEFINITION
|
40
138
|
|
41
|
-
$.fn.combobox = function (option) {
|
42
|
-
|
139
|
+
$.fn.combobox = function (option, value) {
|
140
|
+
var methodReturn;
|
141
|
+
|
142
|
+
var $set = this.each(function () {
|
43
143
|
var $this = $(this);
|
44
144
|
var data = $this.data('combobox');
|
45
145
|
var options = typeof option === 'object' && option;
|
46
146
|
|
47
147
|
if (!data) $this.data('combobox', (data = new Combobox(this, options)));
|
48
|
-
if (typeof option === 'string') data[option]();
|
148
|
+
if (typeof option === 'string') methodReturn = data[option](value);
|
49
149
|
});
|
150
|
+
|
151
|
+
return (methodReturn === undefined) ? $set : methodReturn;
|
50
152
|
};
|
51
153
|
|
52
154
|
$.fn.combobox.defaults = {};
|
@@ -57,6 +159,15 @@
|
|
57
159
|
// COMBOBOX DATA-API
|
58
160
|
|
59
161
|
$(function () {
|
162
|
+
|
163
|
+
$(window).on('load', function () {
|
164
|
+
$('.combobox').each(function () {
|
165
|
+
var $this = $(this);
|
166
|
+
if ($this.data('combobox')) return;
|
167
|
+
$this.combobox($this.data());
|
168
|
+
});
|
169
|
+
});
|
170
|
+
|
60
171
|
$('body').on('mousedown.combobox.data-api', '.combobox', function (e) {
|
61
172
|
var $this = $(this);
|
62
173
|
if ($this.data('combobox')) return;
|
@@ -6,8 +6,7 @@
|
|
6
6
|
* Licensed under the MIT license.
|
7
7
|
*/
|
8
8
|
|
9
|
-
!function($){
|
10
|
-
|
9
|
+
!function ($) {
|
11
10
|
|
12
11
|
// DATAGRID CONSTRUCTOR AND PROTOTYPE
|
13
12
|
|
@@ -186,6 +185,11 @@
|
|
186
185
|
next: function () {
|
187
186
|
this.options.dataOptions.pageIndex++;
|
188
187
|
this.renderData();
|
188
|
+
},
|
189
|
+
|
190
|
+
reload: function () {
|
191
|
+
this.options.dataOptions.pageIndex = 0;
|
192
|
+
this.renderData();
|
189
193
|
}
|
190
194
|
|
191
195
|
};
|
@@ -213,4 +217,4 @@
|
|
213
217
|
|
214
218
|
$.fn.datagrid.Constructor = Datagrid;
|
215
219
|
|
216
|
-
}(window.jQuery);
|
220
|
+
}(window.jQuery);
|