cells 3.8.6 → 3.8.7
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGES.textile +4 -0
- data/Gemfile +1 -1
- data/README.rdoc +2 -2
- data/cells.gemspec +2 -3
- data/lib/cell/base.rb +8 -3
- data/lib/cell/rails.rb +1 -0
- data/lib/cell/rails3_0_strategy.rb +10 -8
- data/lib/cell/rails3_1_strategy.rb +10 -8
- data/lib/cell/test_case.rb +1 -1
- data/lib/cells/engines.rb +0 -2
- data/lib/cells/version.rb +1 -1
- data/test/cell_generator_test.rb +102 -104
- data/test/cell_module_test.rb +37 -33
- data/test/cells_module_test.rb +7 -7
- data/test/deprecations_test.rb +14 -14
- data/test/dummy/config/environments/test.rb +1 -0
- data/test/dummy/config/routes.rb +1 -1
- data/test/helper_test.rb +23 -7
- data/test/rails/caching_test.rb +102 -82
- data/test/rails/capture_test.rb +30 -11
- data/test/rails/cells_test.rb +24 -23
- data/test/rails/integration_test.rb +9 -9
- data/test/rails/render_test.rb +30 -26
- data/test/rails/router_test.rb +6 -6
- data/test/rails/view_test.rb +9 -9
- data/test/rails_helper_api_test.rb +1 -1
- data/test/test_case_test.rb +30 -30
- data/test/test_helper.rb +1 -3
- metadata +6 -29
- data/lib/cell.rb +0 -2
- data/test/dummy/public/javascripts/application.js +0 -2
- data/test/dummy/public/javascripts/controls.js +0 -965
- data/test/dummy/public/javascripts/dragdrop.js +0 -974
- data/test/dummy/public/javascripts/effects.js +0 -1123
- data/test/dummy/public/javascripts/prototype.js +0 -4874
- data/test/dummy/public/javascripts/rails.js +0 -118
@@ -1,118 +0,0 @@
|
|
1
|
-
document.observe("dom:loaded", function() {
|
2
|
-
function handleRemote(element) {
|
3
|
-
var method, url, params;
|
4
|
-
|
5
|
-
if (element.tagName.toLowerCase() === 'form') {
|
6
|
-
method = element.readAttribute('method') || 'post';
|
7
|
-
url = element.readAttribute('action');
|
8
|
-
params = element.serialize(true);
|
9
|
-
} else {
|
10
|
-
method = element.readAttribute('data-method') || 'get';
|
11
|
-
url = element.readAttribute('href');
|
12
|
-
params = {};
|
13
|
-
}
|
14
|
-
|
15
|
-
var event = element.fire("ajax:before");
|
16
|
-
if (event.stopped) return false;
|
17
|
-
|
18
|
-
new Ajax.Request(url, {
|
19
|
-
method: method,
|
20
|
-
parameters: params,
|
21
|
-
asynchronous: true,
|
22
|
-
evalScripts: true,
|
23
|
-
|
24
|
-
onLoading: function(request) { element.fire("ajax:loading", {request: request}); },
|
25
|
-
onLoaded: function(request) { element.fire("ajax:loaded", {request: request}); },
|
26
|
-
onInteractive: function(request) { element.fire("ajax:interactive", {request: request}); },
|
27
|
-
onComplete: function(request) { element.fire("ajax:complete", {request: request}); },
|
28
|
-
onSuccess: function(request) { element.fire("ajax:success", {request: request}); },
|
29
|
-
onFailure: function(request) { element.fire("ajax:failure", {request: request}); }
|
30
|
-
});
|
31
|
-
|
32
|
-
element.fire("ajax:after");
|
33
|
-
}
|
34
|
-
|
35
|
-
function handleMethod(element) {
|
36
|
-
var method, url, token_name, token;
|
37
|
-
|
38
|
-
method = element.readAttribute('data-method');
|
39
|
-
url = element.readAttribute('href');
|
40
|
-
csrf_param = $$('meta[name=csrf-param]').first();
|
41
|
-
csrf_token = $$('meta[name=csrf-token]').first();
|
42
|
-
|
43
|
-
var form = new Element('form', { method: "POST", action: url, style: "display: none;" });
|
44
|
-
element.parentNode.appendChild(form);
|
45
|
-
|
46
|
-
if (method != 'post') {
|
47
|
-
var field = new Element('input', { type: 'hidden', name: '_method', value: method });
|
48
|
-
form.appendChild(field);
|
49
|
-
}
|
50
|
-
|
51
|
-
if (csrf_param) {
|
52
|
-
var param = csrf_param.readAttribute('content');
|
53
|
-
var token = csrf_token.readAttribute('content');
|
54
|
-
var field = new Element('input', { type: 'hidden', name: param, value: token });
|
55
|
-
form.appendChild(field);
|
56
|
-
}
|
57
|
-
|
58
|
-
form.submit();
|
59
|
-
}
|
60
|
-
|
61
|
-
$(document.body).observe("click", function(event) {
|
62
|
-
var message = event.findElement().readAttribute('data-confirm');
|
63
|
-
if (message && !confirm(message)) {
|
64
|
-
event.stop();
|
65
|
-
return false;
|
66
|
-
}
|
67
|
-
|
68
|
-
var element = event.findElement("a[data-remote]");
|
69
|
-
if (element) {
|
70
|
-
handleRemote(element);
|
71
|
-
event.stop();
|
72
|
-
return true;
|
73
|
-
}
|
74
|
-
|
75
|
-
var element = event.findElement("a[data-method]");
|
76
|
-
if (element) {
|
77
|
-
handleMethod(element);
|
78
|
-
event.stop();
|
79
|
-
return true;
|
80
|
-
}
|
81
|
-
});
|
82
|
-
|
83
|
-
// TODO: I don't think submit bubbles in IE
|
84
|
-
$(document.body).observe("submit", function(event) {
|
85
|
-
var element = event.findElement(),
|
86
|
-
message = element.readAttribute('data-confirm');
|
87
|
-
if (message && !confirm(message)) {
|
88
|
-
event.stop();
|
89
|
-
return false;
|
90
|
-
}
|
91
|
-
|
92
|
-
var inputs = element.select("input[type=submit][data-disable-with]");
|
93
|
-
inputs.each(function(input) {
|
94
|
-
input.disabled = true;
|
95
|
-
input.writeAttribute('data-original-value', input.value);
|
96
|
-
input.value = input.readAttribute('data-disable-with');
|
97
|
-
});
|
98
|
-
|
99
|
-
var element = event.findElement("form[data-remote]");
|
100
|
-
if (element) {
|
101
|
-
handleRemote(element);
|
102
|
-
event.stop();
|
103
|
-
}
|
104
|
-
});
|
105
|
-
|
106
|
-
$(document.body).observe("ajax:after", function(event) {
|
107
|
-
var element = event.findElement();
|
108
|
-
|
109
|
-
if (element.tagName.toLowerCase() === 'form') {
|
110
|
-
var inputs = element.select("input[type=submit][disabled=true][data-disable-with]");
|
111
|
-
inputs.each(function(input) {
|
112
|
-
input.value = input.readAttribute('data-original-value');
|
113
|
-
input.writeAttribute('data-original-value', null);
|
114
|
-
input.disabled = false;
|
115
|
-
});
|
116
|
-
}
|
117
|
-
});
|
118
|
-
});
|