rad_js 0.0.7 → 0.0.8
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/lib/js/js_helper.rb +1 -1
- data/static/lib/rad.js +19 -29
- metadata +2 -2
data/lib/js/js_helper.rb
CHANGED
data/static/lib/rad.js
CHANGED
@@ -24,11 +24,22 @@ Rad.Request = new Class({
|
|
24
24
|
|
25
25
|
options: {
|
26
26
|
method: 'post',
|
27
|
-
data: {authenticity_token: window.AUTHENTICITY_TOKEN},
|
28
27
|
evalScripts: true,
|
29
|
-
evalResponse: true
|
28
|
+
evalResponse: true
|
29
|
+
// data: {authenticity_token: window.AUTHENTICITY_TOKEN},
|
30
30
|
},
|
31
31
|
|
32
|
+
initialize: function(options){
|
33
|
+
// adding authenticity_token
|
34
|
+
if(options.method != 'get'){
|
35
|
+
if(typeOf(options.data) == 'object') options.data.authenticity_token = window.AUTHENTICITY_TOKEN;
|
36
|
+
else if (typeOf(options.data) == 'string') {
|
37
|
+
options.data = options.data + "&authenticity_token=" + encodeURIComponent(window.AUTHENTICITY_TOKEN);
|
38
|
+
} else options.data = "authenticity_token=" + window.AUTHENTICITY_TOKEN;
|
39
|
+
}
|
40
|
+
this.parent(options);
|
41
|
+
},
|
42
|
+
|
32
43
|
success: function(text, xml){
|
33
44
|
try{
|
34
45
|
this.fireEvent('load', arguments);
|
@@ -54,49 +65,28 @@ Rad.implement({
|
|
54
65
|
call: function(url, data, options){
|
55
66
|
options = options || {};
|
56
67
|
options.url = url;
|
57
|
-
|
68
|
+
if (data._method) options.method = data._method;
|
69
|
+
options.data = Object.merge({}, options.data, data);
|
58
70
|
var request = new Rad.Request(options);
|
59
71
|
request.send();
|
60
72
|
},
|
61
73
|
|
62
74
|
submitFormViaXhr: function(form, data, callback){
|
63
|
-
// callback = callback || function(){};
|
64
|
-
// var url = form.get('action');
|
65
|
-
// var formData = form.toQueryString().parseQueryString();
|
66
|
-
//
|
67
|
-
// options = {
|
68
|
-
// url: url,
|
69
|
-
// data: Object.merge({}, formData, data), // , {format: 'js'}),
|
70
|
-
// onLoad: callback
|
71
|
-
// };
|
72
|
-
// var request = new Rad.Request(options);
|
73
|
-
// request.send();
|
74
|
-
|
75
75
|
callback = callback || function(){};
|
76
|
-
var url = form.get('action');
|
76
|
+
var url = form.get('action');
|
77
77
|
|
78
78
|
var stringData = form.toQueryString();
|
79
|
-
if(data) stringData = stringData + '&' + Object.toQueryString(data);
|
80
|
-
|
79
|
+
if(data) stringData = stringData + '&' + Object.toQueryString(data);
|
80
|
+
|
81
81
|
options = {
|
82
82
|
url: url,
|
83
83
|
data: stringData,
|
84
84
|
onLoad: callback
|
85
85
|
};
|
86
|
+
|
86
87
|
var request = new Rad.Request(options);
|
87
88
|
request.send();
|
88
89
|
},
|
89
|
-
|
90
|
-
// submitForm: function(form, data, options){
|
91
|
-
// var url = form.get('action');
|
92
|
-
// var formData = form.toQueryString().parseQueryString();
|
93
|
-
//
|
94
|
-
// options = options || {};
|
95
|
-
// options.url = url;
|
96
|
-
// options.data = Object.merge({}, options.data, formData, data, {format: 'js'});
|
97
|
-
// var request = new Rad.Request(options);
|
98
|
-
// request.send();
|
99
|
-
// },
|
100
90
|
|
101
91
|
process_js_link: function(event){
|
102
92
|
var target = event.target;
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rad_js
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.8
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -10,7 +10,7 @@ autorequire:
|
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
12
|
|
13
|
-
date: 2011-07-
|
13
|
+
date: 2011-07-30 00:00:00 +04:00
|
14
14
|
default_executable:
|
15
15
|
dependencies:
|
16
16
|
- !ruby/object:Gem::Dependency
|