compass-jquery-plugin 0.2.4.4 → 0.2.4.5
Sign up to get free protection for your applications and to get access to all the features.
- data/README.textile +2 -2
- data/VERSION.yml +2 -2
- data/compass-jquery-plugin.gemspec +2 -2
- data/lib/jquery/jqgrid.rb +59 -19
- data/templates/jqgrid/i18n/jqgrid/locale-bg.js +132 -132
- data/templates/jqgrid/i18n/jqgrid/locale-bg1251.js +132 -132
- data/templates/jqgrid/i18n/jqgrid/locale-cat.js +128 -128
- data/templates/jqgrid/i18n/jqgrid/locale-cs.js +127 -127
- data/templates/jqgrid/i18n/jqgrid/locale-de.js +127 -127
- data/templates/jqgrid/i18n/jqgrid/locale-dk.js +128 -128
- data/templates/jqgrid/i18n/jqgrid/locale-el.js +126 -126
- data/templates/jqgrid/i18n/jqgrid/locale-en.js +128 -128
- data/templates/jqgrid/i18n/jqgrid/locale-fa.js +125 -125
- data/templates/jqgrid/i18n/jqgrid/locale-fi.js +128 -128
- data/templates/jqgrid/i18n/jqgrid/locale-fr.js +126 -126
- data/templates/jqgrid/i18n/jqgrid/locale-he.js +127 -127
- data/templates/jqgrid/i18n/jqgrid/locale-is.js +126 -126
- data/templates/jqgrid/i18n/jqgrid/locale-it.js +126 -126
- data/templates/jqgrid/i18n/jqgrid/locale-jp.js +127 -127
- data/templates/jqgrid/i18n/jqgrid/locale-nl.js +148 -148
- data/templates/jqgrid/i18n/jqgrid/locale-no.js +121 -121
- data/templates/jqgrid/i18n/jqgrid/locale-pl.js +126 -126
- data/templates/jqgrid/i18n/jqgrid/locale-pt-br.js +127 -127
- data/templates/jqgrid/i18n/jqgrid/locale-pt-br.min.js +1 -1
- data/templates/jqgrid/i18n/jqgrid/locale-pt.js +125 -125
- data/templates/jqgrid/i18n/jqgrid/locale-ro.js +139 -139
- data/templates/jqgrid/i18n/jqgrid/locale-ru.js +127 -127
- data/templates/jqgrid/i18n/jqgrid/locale-sp.js +128 -128
- data/templates/jqgrid/i18n/jqgrid/locale-sv.js +117 -117
- data/templates/jqgrid/i18n/jqgrid/locale-tr.js +126 -126
- data/templates/jqgrid/i18n/jqgrid/locale-ua.js +127 -127
- data/templates/jqgrid/jquery.jqGrid.js +9921 -9913
- data/templates/jqgrid/jquery.jqGrid.min.js +1 -1
- data/templates/jqgrid/jquery.ui/jqGrid.sass +746 -745
- data/templates/jqgrid/manifest.rb +62 -62
- data/templates/jqgrid/public/stylesheets/ellipsis-xbl.xml +13 -13
- data/templates/jrails/jquery.js +7644 -7644
- data/templates/jrails/jquery.min.js +18 -18
- data/templates/jrails/jrails.js +192 -192
- data/templates/secret_sauce/app/views/ui/_ui_grid_for_without_block.js.haml +139 -139
- metadata +2 -2
data/templates/jrails/jrails.js
CHANGED
@@ -1,192 +1,192 @@
|
|
1
|
-
/*
|
2
|
-
*
|
3
|
-
* jRails ajax extras
|
4
|
-
* version 0.1
|
5
|
-
* <aaron@ennerchi.com> | http://www.ennerchi.com
|
6
|
-
*
|
7
|
-
*/
|
8
|
-
|
9
|
-
(function($) {
|
10
|
-
$.ajaxSettings.accepts._default = "text/javascript, text/html, application/xml, text/xml, */*";
|
11
|
-
})(jQuery);
|
12
|
-
|
13
|
-
|
14
|
-
/*
|
15
|
-
*
|
16
|
-
* jRails form extras
|
17
|
-
* <aaron@ennerchi.com> | http://www.ennerchi.com
|
18
|
-
*
|
19
|
-
*/
|
20
|
-
|
21
|
-
|
22
|
-
(function($) {
|
23
|
-
// reset a form
|
24
|
-
$.fn.reset = function() {
|
25
|
-
return this.each(function() {
|
26
|
-
// guard against an input with the name of 'reset'
|
27
|
-
// note that IE reports the reset function as an 'object'
|
28
|
-
if (typeof this.reset == 'function' || (typeof this.reset == 'object' && !this.reset.nodeType))
|
29
|
-
this.reset();
|
30
|
-
});
|
31
|
-
};
|
32
|
-
// enable a form element
|
33
|
-
$.fn.enable = function() {
|
34
|
-
return this.each(function() {
|
35
|
-
this.disabled = false;
|
36
|
-
});
|
37
|
-
};
|
38
|
-
// disable a form element
|
39
|
-
$.fn.disable = function() {
|
40
|
-
return this.each(function() {
|
41
|
-
this.disabled = true;
|
42
|
-
});
|
43
|
-
};
|
44
|
-
|
45
|
-
})(jQuery);
|
46
|
-
|
47
|
-
/*
|
48
|
-
*
|
49
|
-
* jRails form observer plugin
|
50
|
-
* version 0.2
|
51
|
-
* <aaron@ennerchi.com> | http://www.ennerchi.com
|
52
|
-
*
|
53
|
-
*/
|
54
|
-
|
55
|
-
(function($) {
|
56
|
-
$.extend({ // Translate field to event
|
57
|
-
fieldEvent: function(el, obs) {
|
58
|
-
var field = el[0] || el, e = 'change';
|
59
|
-
if (field.type == 'radio' || field.type == 'checkbox') e = 'click';
|
60
|
-
else if (obs && field.type == 'text' || field.type == 'textarea') e = 'keyup';
|
61
|
-
return e;
|
62
|
-
}
|
63
|
-
});
|
64
|
-
$.fn.extend({ // Delayed observer for fields and forms
|
65
|
-
delayedObserver: function(delay, callback){
|
66
|
-
var el = $(this);
|
67
|
-
if (typeof window.delayedObserverStack == 'undefined') window.delayedObserverStack = [];
|
68
|
-
if (typeof window.delayedObserverCallback == 'undefined') {
|
69
|
-
window.delayedObserverCallback = function(stackPos) {
|
70
|
-
var observed = window.delayedObserverStack[stackPos];
|
71
|
-
if (observed.timer) clearTimeout(observed.timer);
|
72
|
-
observed.timer = setTimeout(function(){
|
73
|
-
observed.timer = null;
|
74
|
-
observed.callback(observed.obj, observed.obj.formVal());
|
75
|
-
}, observed.delay * 1000);
|
76
|
-
observed.oldVal = observed.obj.formVal();
|
77
|
-
};
|
78
|
-
}
|
79
|
-
window.delayedObserverStack.push({
|
80
|
-
obj: el, timer: null, delay: delay,
|
81
|
-
oldVal: el.formVal(), callback: callback
|
82
|
-
});
|
83
|
-
var stackPos = window.delayedObserverStack.length-1;
|
84
|
-
if (el[0].tagName == 'FORM') {
|
85
|
-
$(':input', el).each(function(){
|
86
|
-
var field = $(this);
|
87
|
-
field.bind($.fieldEvent(field, delay), function(){
|
88
|
-
var observed = window.delayedObserverStack[stackPos];
|
89
|
-
if (observed.obj.formVal() == observed.oldVal) return;
|
90
|
-
else window.delayedObserverCallback(stackPos);
|
91
|
-
});
|
92
|
-
});
|
93
|
-
} else {
|
94
|
-
el.bind($.fieldEvent(el, delay), function(){
|
95
|
-
var observed = window.delayedObserverStack[stackPos];
|
96
|
-
if (observed.obj.formVal() == observed.oldVal) return;
|
97
|
-
else window.delayedObserverCallback(stackPos);
|
98
|
-
});
|
99
|
-
};
|
100
|
-
},
|
101
|
-
formVal: function() { // Gets form values
|
102
|
-
var el = this[0];
|
103
|
-
if(el.tagName == 'FORM') return this.serialize();
|
104
|
-
if(el.type == 'checkbox' || el.type == 'radio') return this.filter('input:checked').val() || '';
|
105
|
-
else return this.val();
|
106
|
-
}
|
107
|
-
});
|
108
|
-
})(jQuery);
|
109
|
-
|
110
|
-
/*
|
111
|
-
*
|
112
|
-
* jRails visual effects stubs
|
113
|
-
* version 0.2
|
114
|
-
* <aaron@ennerchi.com> | http://www.ennerchi.com
|
115
|
-
*
|
116
|
-
*/
|
117
|
-
|
118
|
-
(function($) {
|
119
|
-
$.fn.extend({
|
120
|
-
visualEffect : function(o) {
|
121
|
-
e = o.replace(/\_(.)/g, function(m, l){return l.toUpperCase()});
|
122
|
-
return eval('$(this).'+e+'()');
|
123
|
-
},
|
124
|
-
appear : function(speed, callback) {
|
125
|
-
return this.fadeIn(speed, callback);
|
126
|
-
},
|
127
|
-
blindDown : function(speed, callback) {
|
128
|
-
return this.show('blind', { direction: 'vertical' }, speed, callback);
|
129
|
-
},
|
130
|
-
blindUp : function(speed, callback) {
|
131
|
-
return this.hide('blind', { direction: 'vertical' }, speed, callback);
|
132
|
-
},
|
133
|
-
blindRight : function(speed, callback) {
|
134
|
-
return this.show('blind', { direction: 'horizontal' }, speed, callback);
|
135
|
-
},
|
136
|
-
blindLeft : function(speed, callback) {
|
137
|
-
this.hide('blind', { direction: 'horizontal' }, speed, callback);
|
138
|
-
return this;
|
139
|
-
},
|
140
|
-
dropOut : function(speed, callback) {
|
141
|
-
return this.hide('drop', {direction: 'down' }, speed, callback);
|
142
|
-
},
|
143
|
-
dropIn : function(speed, callback) {
|
144
|
-
return this.show('drop', { direction: 'up' }, speed, callback);
|
145
|
-
},
|
146
|
-
fade : function(speed, callback) {
|
147
|
-
return this.fadeOut(speed, callback);
|
148
|
-
},
|
149
|
-
fadeToggle : function(speed, callback) {
|
150
|
-
return this.animate({opacity: 'toggle'}, speed, callback);
|
151
|
-
},
|
152
|
-
fold : function(speed, callback) {
|
153
|
-
return this.hide('fold', {}, speed, callback);
|
154
|
-
},
|
155
|
-
foldOut : function(speed, callback) {
|
156
|
-
return this.show('fold', {}, speed, callback);
|
157
|
-
},
|
158
|
-
grow : function(speed, callback) {
|
159
|
-
return this.show('scale', {}, speed, callback);
|
160
|
-
},
|
161
|
-
highlight : function(speed, callback) {
|
162
|
-
return this.show('highlight', {}, speed, callback);
|
163
|
-
},
|
164
|
-
puff : function(speed, callback) {
|
165
|
-
return this.hide('puff', {}, speed, callback);
|
166
|
-
},
|
167
|
-
pulsate : function(speed, callback) {
|
168
|
-
return this.show('pulsate', {}, speed, callback);
|
169
|
-
},
|
170
|
-
shake : function(speed, callback) {
|
171
|
-
return this.show('shake', {}, speed, callback);
|
172
|
-
},
|
173
|
-
shrink : function(speed, callback) {
|
174
|
-
return this.hide('scale', {}, speed, callback);
|
175
|
-
},
|
176
|
-
squish : function(speed, callback) {
|
177
|
-
return this.hide('scale', { origin: ['top', 'left'] }, speed, callback);
|
178
|
-
},
|
179
|
-
slideUp : function(speed, callback) {
|
180
|
-
return this.hide('slide', { direction: 'up'}, speed, callback);
|
181
|
-
},
|
182
|
-
slideDown : function(speed, callback) {
|
183
|
-
return this.show('slide', { direction: 'up'}, speed, callback);
|
184
|
-
},
|
185
|
-
switchOff : function(speed, callback) {
|
186
|
-
return this.hide('clip', {}, speed, callback);
|
187
|
-
},
|
188
|
-
switchOn : function(speed, callback) {
|
189
|
-
return this.show('clip', {}, speed, callback);
|
190
|
-
}
|
191
|
-
});
|
192
|
-
})(jQuery);
|
1
|
+
/*
|
2
|
+
*
|
3
|
+
* jRails ajax extras
|
4
|
+
* version 0.1
|
5
|
+
* <aaron@ennerchi.com> | http://www.ennerchi.com
|
6
|
+
*
|
7
|
+
*/
|
8
|
+
|
9
|
+
(function($) {
|
10
|
+
$.ajaxSettings.accepts._default = "text/javascript, text/html, application/xml, text/xml, */*";
|
11
|
+
})(jQuery);
|
12
|
+
|
13
|
+
|
14
|
+
/*
|
15
|
+
*
|
16
|
+
* jRails form extras
|
17
|
+
* <aaron@ennerchi.com> | http://www.ennerchi.com
|
18
|
+
*
|
19
|
+
*/
|
20
|
+
|
21
|
+
|
22
|
+
(function($) {
|
23
|
+
// reset a form
|
24
|
+
$.fn.reset = function() {
|
25
|
+
return this.each(function() {
|
26
|
+
// guard against an input with the name of 'reset'
|
27
|
+
// note that IE reports the reset function as an 'object'
|
28
|
+
if (typeof this.reset == 'function' || (typeof this.reset == 'object' && !this.reset.nodeType))
|
29
|
+
this.reset();
|
30
|
+
});
|
31
|
+
};
|
32
|
+
// enable a form element
|
33
|
+
$.fn.enable = function() {
|
34
|
+
return this.each(function() {
|
35
|
+
this.disabled = false;
|
36
|
+
});
|
37
|
+
};
|
38
|
+
// disable a form element
|
39
|
+
$.fn.disable = function() {
|
40
|
+
return this.each(function() {
|
41
|
+
this.disabled = true;
|
42
|
+
});
|
43
|
+
};
|
44
|
+
|
45
|
+
})(jQuery);
|
46
|
+
|
47
|
+
/*
|
48
|
+
*
|
49
|
+
* jRails form observer plugin
|
50
|
+
* version 0.2
|
51
|
+
* <aaron@ennerchi.com> | http://www.ennerchi.com
|
52
|
+
*
|
53
|
+
*/
|
54
|
+
|
55
|
+
(function($) {
|
56
|
+
$.extend({ // Translate field to event
|
57
|
+
fieldEvent: function(el, obs) {
|
58
|
+
var field = el[0] || el, e = 'change';
|
59
|
+
if (field.type == 'radio' || field.type == 'checkbox') e = 'click';
|
60
|
+
else if (obs && field.type == 'text' || field.type == 'textarea') e = 'keyup';
|
61
|
+
return e;
|
62
|
+
}
|
63
|
+
});
|
64
|
+
$.fn.extend({ // Delayed observer for fields and forms
|
65
|
+
delayedObserver: function(delay, callback){
|
66
|
+
var el = $(this);
|
67
|
+
if (typeof window.delayedObserverStack == 'undefined') window.delayedObserverStack = [];
|
68
|
+
if (typeof window.delayedObserverCallback == 'undefined') {
|
69
|
+
window.delayedObserverCallback = function(stackPos) {
|
70
|
+
var observed = window.delayedObserverStack[stackPos];
|
71
|
+
if (observed.timer) clearTimeout(observed.timer);
|
72
|
+
observed.timer = setTimeout(function(){
|
73
|
+
observed.timer = null;
|
74
|
+
observed.callback(observed.obj, observed.obj.formVal());
|
75
|
+
}, observed.delay * 1000);
|
76
|
+
observed.oldVal = observed.obj.formVal();
|
77
|
+
};
|
78
|
+
}
|
79
|
+
window.delayedObserverStack.push({
|
80
|
+
obj: el, timer: null, delay: delay,
|
81
|
+
oldVal: el.formVal(), callback: callback
|
82
|
+
});
|
83
|
+
var stackPos = window.delayedObserverStack.length-1;
|
84
|
+
if (el[0].tagName == 'FORM') {
|
85
|
+
$(':input', el).each(function(){
|
86
|
+
var field = $(this);
|
87
|
+
field.bind($.fieldEvent(field, delay), function(){
|
88
|
+
var observed = window.delayedObserverStack[stackPos];
|
89
|
+
if (observed.obj.formVal() == observed.oldVal) return;
|
90
|
+
else window.delayedObserverCallback(stackPos);
|
91
|
+
});
|
92
|
+
});
|
93
|
+
} else {
|
94
|
+
el.bind($.fieldEvent(el, delay), function(){
|
95
|
+
var observed = window.delayedObserverStack[stackPos];
|
96
|
+
if (observed.obj.formVal() == observed.oldVal) return;
|
97
|
+
else window.delayedObserverCallback(stackPos);
|
98
|
+
});
|
99
|
+
};
|
100
|
+
},
|
101
|
+
formVal: function() { // Gets form values
|
102
|
+
var el = this[0];
|
103
|
+
if(el.tagName == 'FORM') return this.serialize();
|
104
|
+
if(el.type == 'checkbox' || el.type == 'radio') return this.filter('input:checked').val() || '';
|
105
|
+
else return this.val();
|
106
|
+
}
|
107
|
+
});
|
108
|
+
})(jQuery);
|
109
|
+
|
110
|
+
/*
|
111
|
+
*
|
112
|
+
* jRails visual effects stubs
|
113
|
+
* version 0.2
|
114
|
+
* <aaron@ennerchi.com> | http://www.ennerchi.com
|
115
|
+
*
|
116
|
+
*/
|
117
|
+
|
118
|
+
(function($) {
|
119
|
+
$.fn.extend({
|
120
|
+
visualEffect : function(o) {
|
121
|
+
e = o.replace(/\_(.)/g, function(m, l){return l.toUpperCase()});
|
122
|
+
return eval('$(this).'+e+'()');
|
123
|
+
},
|
124
|
+
appear : function(speed, callback) {
|
125
|
+
return this.fadeIn(speed, callback);
|
126
|
+
},
|
127
|
+
blindDown : function(speed, callback) {
|
128
|
+
return this.show('blind', { direction: 'vertical' }, speed, callback);
|
129
|
+
},
|
130
|
+
blindUp : function(speed, callback) {
|
131
|
+
return this.hide('blind', { direction: 'vertical' }, speed, callback);
|
132
|
+
},
|
133
|
+
blindRight : function(speed, callback) {
|
134
|
+
return this.show('blind', { direction: 'horizontal' }, speed, callback);
|
135
|
+
},
|
136
|
+
blindLeft : function(speed, callback) {
|
137
|
+
this.hide('blind', { direction: 'horizontal' }, speed, callback);
|
138
|
+
return this;
|
139
|
+
},
|
140
|
+
dropOut : function(speed, callback) {
|
141
|
+
return this.hide('drop', {direction: 'down' }, speed, callback);
|
142
|
+
},
|
143
|
+
dropIn : function(speed, callback) {
|
144
|
+
return this.show('drop', { direction: 'up' }, speed, callback);
|
145
|
+
},
|
146
|
+
fade : function(speed, callback) {
|
147
|
+
return this.fadeOut(speed, callback);
|
148
|
+
},
|
149
|
+
fadeToggle : function(speed, callback) {
|
150
|
+
return this.animate({opacity: 'toggle'}, speed, callback);
|
151
|
+
},
|
152
|
+
fold : function(speed, callback) {
|
153
|
+
return this.hide('fold', {}, speed, callback);
|
154
|
+
},
|
155
|
+
foldOut : function(speed, callback) {
|
156
|
+
return this.show('fold', {}, speed, callback);
|
157
|
+
},
|
158
|
+
grow : function(speed, callback) {
|
159
|
+
return this.show('scale', {}, speed, callback);
|
160
|
+
},
|
161
|
+
highlight : function(speed, callback) {
|
162
|
+
return this.show('highlight', {}, speed, callback);
|
163
|
+
},
|
164
|
+
puff : function(speed, callback) {
|
165
|
+
return this.hide('puff', {}, speed, callback);
|
166
|
+
},
|
167
|
+
pulsate : function(speed, callback) {
|
168
|
+
return this.show('pulsate', {}, speed, callback);
|
169
|
+
},
|
170
|
+
shake : function(speed, callback) {
|
171
|
+
return this.show('shake', {}, speed, callback);
|
172
|
+
},
|
173
|
+
shrink : function(speed, callback) {
|
174
|
+
return this.hide('scale', {}, speed, callback);
|
175
|
+
},
|
176
|
+
squish : function(speed, callback) {
|
177
|
+
return this.hide('scale', { origin: ['top', 'left'] }, speed, callback);
|
178
|
+
},
|
179
|
+
slideUp : function(speed, callback) {
|
180
|
+
return this.hide('slide', { direction: 'up'}, speed, callback);
|
181
|
+
},
|
182
|
+
slideDown : function(speed, callback) {
|
183
|
+
return this.show('slide', { direction: 'up'}, speed, callback);
|
184
|
+
},
|
185
|
+
switchOff : function(speed, callback) {
|
186
|
+
return this.hide('clip', {}, speed, callback);
|
187
|
+
},
|
188
|
+
switchOn : function(speed, callback) {
|
189
|
+
return this.show('clip', {}, speed, callback);
|
190
|
+
}
|
191
|
+
});
|
192
|
+
})(jQuery);
|
@@ -1,139 +1,139 @@
|
|
1
|
-
%script{ :type => "text/javascript" }
|
2
|
-
$(document).ready(function() {
|
3
|
-
$.jgrid.no_legacy_api = true;
|
4
|
-
$('##{name}_table').jqGrid(
|
5
|
-
= options.to_json
|
6
|
-
);
|
7
|
-
$('##{name}_table').jqGrid(
|
8
|
-
'navGrid',"##{name}_pager",
|
9
|
-
= nav.to_json
|
10
|
-
);
|
11
|
-
|
12
|
-
- if actions
|
13
|
-
- if actions[:destroy]
|
14
|
-
$("##{name}_table").jqGrid('navButtonAdd',"##{name}_pager", {
|
15
|
-
caption: "",
|
16
|
-
position: "first",
|
17
|
-
buttonicon: "ui-icon-trash",
|
18
|
-
onClickButton: function() {
|
19
|
-
var rowId = $("#{name}_table").getGridParam("selrow")
|
20
|
-
if(rowId == null) {
|
21
|
-
alert("You must first select a row.");
|
22
|
-
} else {
|
23
|
-
var sure = confirm("Are you sure?")
|
24
|
-
if(sure) {
|
25
|
-
$.ajax({url: "#{name}/"+rowId,
|
26
|
-
type: "delete",
|
27
|
-
data: {authenticity_token: "#{form_authenticity_token}"},
|
28
|
-
success: function() {
|
29
|
-
$("##{name}_table").trigger("reloadGrid");
|
30
|
-
}
|
31
|
-
});
|
32
|
-
}
|
33
|
-
}
|
34
|
-
}
|
35
|
-
});
|
36
|
-
|
37
|
-
- if actions[:update]
|
38
|
-
$("##{name}_table").jqGrid('navButtonAdd',"##{name}_pager", {
|
39
|
-
caption: "",
|
40
|
-
position: "first",
|
41
|
-
buttonicon: "ui-icon-pencil",
|
42
|
-
onClickButton: function() {
|
43
|
-
var rowId = $("##{name}_table").getGridParam("selrow")
|
44
|
-
if(rowId == null) {
|
45
|
-
alert("You must first select a row.");
|
46
|
-
} else {
|
47
|
-
$.ajax({method: "get", url: "/#{name}#{actions[:update]}/"+rowId,
|
48
|
-
success: function(data, status) {
|
49
|
-
var dWidth = $(data).css("width")
|
50
|
-
var dHeight = $(data).css("height")
|
51
|
-
$("##{name}_update_dialog").append(data)
|
52
|
-
$("#widget_submit").hide(); // HACK: easy way to make submit on enter work
|
53
|
-
$("##{name}_update_dialog").find("form").submit(function() {
|
54
|
-
$(this).ajaxSubmit({
|
55
|
-
url: $(this).attr("action"),
|
56
|
-
data: $(this).serialize(),
|
57
|
-
type: "put",
|
58
|
-
success: function(response, status) {
|
59
|
-
if(!$(response).is("form")) {
|
60
|
-
$("##{name}_update_dialog").dialog('close');
|
61
|
-
$("##{name}_table").trigger("reloadGrid");
|
62
|
-
} else {
|
63
|
-
$("##{name}_update_dialog").find("form").replaceWith(response);
|
64
|
-
}
|
65
|
-
}
|
66
|
-
});
|
67
|
-
return false;
|
68
|
-
});
|
69
|
-
$("##{name}_update_dialog").dialog({
|
70
|
-
buttons: {
|
71
|
-
"Save": function() {$(this).find("form").submit();},
|
72
|
-
"Cancel": function() {$(this).dialog('close');}
|
73
|
-
},
|
74
|
-
title: "Edit",
|
75
|
-
width: dWidth,
|
76
|
-
height: dHeight,
|
77
|
-
modal: true,
|
78
|
-
draggable: false,
|
79
|
-
resizable: false,
|
80
|
-
close: function() {
|
81
|
-
$(this).dialog('destroy');
|
82
|
-
$("##{name}_update_dialog").children().remove();
|
83
|
-
}
|
84
|
-
});
|
85
|
-
}
|
86
|
-
});
|
87
|
-
}
|
88
|
-
}
|
89
|
-
});
|
90
|
-
|
91
|
-
- if actions[:create]
|
92
|
-
$("##{name}_table").jqGrid('navButtonAdd',"##{name}_pager", {
|
93
|
-
caption: "",
|
94
|
-
position: "first",
|
95
|
-
buttonicon: "ui-icon-plus",
|
96
|
-
onClickButton: function() {
|
97
|
-
$.ajax({method: "get", url: "/#{name}#{actions[:create]}",
|
98
|
-
success: function(data, status) {
|
99
|
-
var dWidth = $(data).css("width");
|
100
|
-
var dHeight = $(data).css("height");
|
101
|
-
$("##{name}_create_dialog").append(data);
|
102
|
-
$("#widget_submit").hide(); // HACK: easy way to make submit on enter work
|
103
|
-
$("##{name}_create_dialog").find("form").submit(function() {
|
104
|
-
$(this).ajaxSubmit({
|
105
|
-
url: $(this).attr("action"),
|
106
|
-
data: $(this).serialize(),
|
107
|
-
type: "post",
|
108
|
-
success: function(response, status) {
|
109
|
-
if(!$(response).is("form")) {
|
110
|
-
$("##{name}_create_dialog").dialog('close');
|
111
|
-
$("##{name}_table").trigger("reloadGrid");
|
112
|
-
} else {
|
113
|
-
$("##{name}_create_dialog").find("form").replaceWith(response);
|
114
|
-
}
|
115
|
-
}
|
116
|
-
});
|
117
|
-
return false;
|
118
|
-
});
|
119
|
-
$("##{name}_create_dialog").dialog({
|
120
|
-
buttons: {
|
121
|
-
"Save": function() {$(this).find("form").submit();},
|
122
|
-
"Cancel": function() {$(this).dialog('close');}
|
123
|
-
},
|
124
|
-
title: "New",
|
125
|
-
width: dWidth,
|
126
|
-
height: dHeight,
|
127
|
-
modal: true,
|
128
|
-
draggable: false,
|
129
|
-
resizable: false,
|
130
|
-
close: function() {
|
131
|
-
$(this).dialog('destroy');
|
132
|
-
$("##{name}_create_dialog").children().remove();
|
133
|
-
}
|
134
|
-
});
|
135
|
-
}
|
136
|
-
});
|
137
|
-
}
|
138
|
-
});
|
139
|
-
});
|
1
|
+
%script{ :type => "text/javascript" }
|
2
|
+
$(document).ready(function() {
|
3
|
+
$.jgrid.no_legacy_api = true;
|
4
|
+
$('##{name}_table').jqGrid(
|
5
|
+
= options.to_json
|
6
|
+
);
|
7
|
+
$('##{name}_table').jqGrid(
|
8
|
+
'navGrid',"##{name}_pager",
|
9
|
+
= nav.to_json
|
10
|
+
);
|
11
|
+
|
12
|
+
- if actions
|
13
|
+
- if actions[:destroy]
|
14
|
+
$("##{name}_table").jqGrid('navButtonAdd',"##{name}_pager", {
|
15
|
+
caption: "",
|
16
|
+
position: "first",
|
17
|
+
buttonicon: "ui-icon-trash",
|
18
|
+
onClickButton: function() {
|
19
|
+
var rowId = $("#{name}_table").getGridParam("selrow")
|
20
|
+
if(rowId == null) {
|
21
|
+
alert("You must first select a row.");
|
22
|
+
} else {
|
23
|
+
var sure = confirm("Are you sure?")
|
24
|
+
if(sure) {
|
25
|
+
$.ajax({url: "#{name}/"+rowId,
|
26
|
+
type: "delete",
|
27
|
+
data: {authenticity_token: "#{form_authenticity_token}"},
|
28
|
+
success: function() {
|
29
|
+
$("##{name}_table").trigger("reloadGrid");
|
30
|
+
}
|
31
|
+
});
|
32
|
+
}
|
33
|
+
}
|
34
|
+
}
|
35
|
+
});
|
36
|
+
|
37
|
+
- if actions[:update]
|
38
|
+
$("##{name}_table").jqGrid('navButtonAdd',"##{name}_pager", {
|
39
|
+
caption: "",
|
40
|
+
position: "first",
|
41
|
+
buttonicon: "ui-icon-pencil",
|
42
|
+
onClickButton: function() {
|
43
|
+
var rowId = $("##{name}_table").getGridParam("selrow")
|
44
|
+
if(rowId == null) {
|
45
|
+
alert("You must first select a row.");
|
46
|
+
} else {
|
47
|
+
$.ajax({method: "get", url: "/#{name}#{actions[:update]}/"+rowId,
|
48
|
+
success: function(data, status) {
|
49
|
+
var dWidth = $(data).css("width")
|
50
|
+
var dHeight = $(data).css("height")
|
51
|
+
$("##{name}_update_dialog").append(data)
|
52
|
+
$("#widget_submit").hide(); // HACK: easy way to make submit on enter work
|
53
|
+
$("##{name}_update_dialog").find("form").submit(function() {
|
54
|
+
$(this).ajaxSubmit({
|
55
|
+
url: $(this).attr("action"),
|
56
|
+
data: $(this).serialize(),
|
57
|
+
type: "put",
|
58
|
+
success: function(response, status) {
|
59
|
+
if(!$(response).is("form")) {
|
60
|
+
$("##{name}_update_dialog").dialog('close');
|
61
|
+
$("##{name}_table").trigger("reloadGrid");
|
62
|
+
} else {
|
63
|
+
$("##{name}_update_dialog").find("form").replaceWith(response);
|
64
|
+
}
|
65
|
+
}
|
66
|
+
});
|
67
|
+
return false;
|
68
|
+
});
|
69
|
+
$("##{name}_update_dialog").dialog({
|
70
|
+
buttons: {
|
71
|
+
"Save": function() {$(this).find("form").submit();},
|
72
|
+
"Cancel": function() {$(this).dialog('close');}
|
73
|
+
},
|
74
|
+
title: "Edit",
|
75
|
+
width: dWidth,
|
76
|
+
height: dHeight,
|
77
|
+
modal: true,
|
78
|
+
draggable: false,
|
79
|
+
resizable: false,
|
80
|
+
close: function() {
|
81
|
+
$(this).dialog('destroy');
|
82
|
+
$("##{name}_update_dialog").children().remove();
|
83
|
+
}
|
84
|
+
});
|
85
|
+
}
|
86
|
+
});
|
87
|
+
}
|
88
|
+
}
|
89
|
+
});
|
90
|
+
|
91
|
+
- if actions[:create]
|
92
|
+
$("##{name}_table").jqGrid('navButtonAdd',"##{name}_pager", {
|
93
|
+
caption: "",
|
94
|
+
position: "first",
|
95
|
+
buttonicon: "ui-icon-plus",
|
96
|
+
onClickButton: function() {
|
97
|
+
$.ajax({method: "get", url: "/#{name}#{actions[:create]}",
|
98
|
+
success: function(data, status) {
|
99
|
+
var dWidth = $(data).css("width");
|
100
|
+
var dHeight = $(data).css("height");
|
101
|
+
$("##{name}_create_dialog").append(data);
|
102
|
+
$("#widget_submit").hide(); // HACK: easy way to make submit on enter work
|
103
|
+
$("##{name}_create_dialog").find("form").submit(function() {
|
104
|
+
$(this).ajaxSubmit({
|
105
|
+
url: $(this).attr("action"),
|
106
|
+
data: $(this).serialize(),
|
107
|
+
type: "post",
|
108
|
+
success: function(response, status) {
|
109
|
+
if(!$(response).is("form")) {
|
110
|
+
$("##{name}_create_dialog").dialog('close');
|
111
|
+
$("##{name}_table").trigger("reloadGrid");
|
112
|
+
} else {
|
113
|
+
$("##{name}_create_dialog").find("form").replaceWith(response);
|
114
|
+
}
|
115
|
+
}
|
116
|
+
});
|
117
|
+
return false;
|
118
|
+
});
|
119
|
+
$("##{name}_create_dialog").dialog({
|
120
|
+
buttons: {
|
121
|
+
"Save": function() {$(this).find("form").submit();},
|
122
|
+
"Cancel": function() {$(this).dialog('close');}
|
123
|
+
},
|
124
|
+
title: "New",
|
125
|
+
width: dWidth,
|
126
|
+
height: dHeight,
|
127
|
+
modal: true,
|
128
|
+
draggable: false,
|
129
|
+
resizable: false,
|
130
|
+
close: function() {
|
131
|
+
$(this).dialog('destroy');
|
132
|
+
$("##{name}_create_dialog").children().remove();
|
133
|
+
}
|
134
|
+
});
|
135
|
+
}
|
136
|
+
});
|
137
|
+
}
|
138
|
+
});
|
139
|
+
});
|