magic_grid 0.10.3 → 0.10.4
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/assets/javascripts/magic_grid.js +14 -17
- data/lib/magic_grid/version.rb +1 -1
- data/spec/helpers_spec.rb +1 -0
- metadata +4 -4
@@ -32,7 +32,7 @@ $(function () {
|
|
32
32
|
// Micro-plugin for collecting all the listener and search inputs
|
33
33
|
$.fn.getGridParams = $.fn.getGridParams || function (extras) {
|
34
34
|
var listeners = this.data("listeners"),
|
35
|
-
params = $.extend({}, {'magic_grid_id' : this.attr('id')}, extras || {}),
|
35
|
+
params = $.extend({}, this.find("thead").data("params"), {'magic_grid_id' : this.attr('id')}, extras || {}),
|
36
36
|
$input, param_key, listened_id;
|
37
37
|
for (listened_id in listeners) {
|
38
38
|
param_key = listeners[listened_id];
|
@@ -95,14 +95,11 @@ $(function () {
|
|
95
95
|
current = $input.data("current"),
|
96
96
|
value = $input.val(),
|
97
97
|
length = value.length,
|
98
|
-
|
98
|
+
base_url = base_url.split("?", 2)[0],
|
99
99
|
relevant = is_manual || (value != current && (length >= minLength || length == 0)),
|
100
|
-
pos = $input.getCursor()
|
100
|
+
pos = $input.getCursor(),
|
101
|
+
url = base_url + '?' + $.param($grid.getGridParams());
|
101
102
|
clearTimeout(timer);
|
102
|
-
if (! /\?/.test(url)) {
|
103
|
-
url += '?';
|
104
|
-
}
|
105
|
-
url += $.param($grid.getGridParams());
|
106
103
|
if (relevant) {
|
107
104
|
$grid.trigger("magic_grid:loading");
|
108
105
|
if ($grid.data("remote")) {
|
@@ -129,10 +126,13 @@ $(function () {
|
|
129
126
|
$(".magic_grid[data-listeners]").each( function () {
|
130
127
|
var $grid = $(this),
|
131
128
|
listeners = $grid.data("listeners"),
|
132
|
-
grid_id = this.id
|
133
|
-
base_url = $grid.data("current"),
|
129
|
+
grid_id = this.id,
|
134
130
|
handler = function (change) {
|
135
|
-
|
131
|
+
if (! $("#"+change.data.field).hasClass("ready")) {
|
132
|
+
return;
|
133
|
+
}
|
134
|
+
var base_url = $grid.data("current").split("?", 2)[0];
|
135
|
+
var url = base_url + '?' + $.param($grid.getGridParams());
|
136
136
|
$grid.trigger("magic_grid:loading");
|
137
137
|
if ($grid.data("remote")) {
|
138
138
|
$grid.load(url + ' #' + grid_id + " > *", function () {
|
@@ -143,13 +143,10 @@ $(function () {
|
|
143
143
|
}
|
144
144
|
};
|
145
145
|
for (var k in listeners) {
|
146
|
-
|
147
|
-
|
148
|
-
|
149
|
-
|
150
|
-
$(this).on("change", ready.data, handler);
|
151
|
-
});
|
152
|
-
}
|
146
|
+
$("#" + k).on("change", {"field": listeners[k]}, handler);
|
147
|
+
$("#" + k).on("ready", function (ready) {
|
148
|
+
$(this).addClass("ready");
|
149
|
+
});
|
153
150
|
}
|
154
151
|
});
|
155
152
|
|
data/lib/magic_grid/version.rb
CHANGED
data/spec/helpers_spec.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: magic_grid
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.10.
|
4
|
+
version: 0.10.4
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-10-
|
12
|
+
date: 2012-10-12 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rails
|
@@ -208,7 +208,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
208
208
|
version: '0'
|
209
209
|
segments:
|
210
210
|
- 0
|
211
|
-
hash:
|
211
|
+
hash: 591195015863992118
|
212
212
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
213
213
|
none: false
|
214
214
|
requirements:
|
@@ -217,7 +217,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
217
217
|
version: '0'
|
218
218
|
segments:
|
219
219
|
- 0
|
220
|
-
hash:
|
220
|
+
hash: 591195015863992118
|
221
221
|
requirements: []
|
222
222
|
rubyforge_project:
|
223
223
|
rubygems_version: 1.8.23
|