jcontroller 1.0.3 → 1.0.4
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.
- checksums.yaml +4 -4
- data/app/assets/javascripts/jcontroller.js +10 -8
- data/lib/jcontroller/version.rb +1 -1
- data/spec/fake_app/app/assets/javascripts/jcontrollers/empty_parents_jcontroller.js +2 -0
- data/spec/fake_app/app/controllers.rb +5 -0
- data/spec/fake_app/app/views/empty_parents/index.html.erb +0 -0
- data/spec/fake_app/routes.rb +1 -0
- data/spec/features/jcontroller_spec.rb +4 -0
- metadata +5 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 22c4aaa4a7e3d6508cdfbfd704f751a684a228df
|
4
|
+
data.tar.gz: 91bf54f58ab80341995d6e5313ba1224956c772b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3bd0f42b2f358a68c6a5a9b7bee0ada5e31a6aed48522e0cd9d78a09246b84ad189e9083ad89d6dfdf40317255d0f910ca2565b48786321ef103388f6cb29570
|
7
|
+
data.tar.gz: 2e9d1744c7b07e75ca7c03a944a517ea565148dac4c2d68767302ae9ae73877f8131614abd4a112ca19b187263f13d790a24ddda7f2fe12181708c7b3186d1c5
|
@@ -19,22 +19,24 @@ var Jcontroller = {
|
|
19
19
|
},
|
20
20
|
|
21
21
|
execute_action: function() {
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
this.execute_pre_order_filter('after');
|
26
|
-
}
|
22
|
+
this.execute_post_order_filter('before');
|
23
|
+
this.execute_post_order_filter(this.action_name);
|
24
|
+
this.execute_pre_order_filter('after');
|
27
25
|
},
|
28
26
|
execute_post_order_filter: function(filter) {
|
29
27
|
if (Jcontroller.present(this.parent())) { this.parent().execute_post_order_filter(filter); }
|
30
|
-
this.execute_filter(
|
28
|
+
this.execute_filter(filter);
|
31
29
|
},
|
32
30
|
execute_pre_order_filter: function(filter) {
|
33
|
-
this.execute_filter(
|
31
|
+
this.execute_filter(filter);
|
34
32
|
if (Jcontroller.present(this.parent())) { this.parent().execute_pre_order_filter(filter); }
|
35
33
|
},
|
36
34
|
execute_filter: function(filter) {
|
37
|
-
|
35
|
+
var f = this[this.format];
|
36
|
+
if (!$.isPlainObject(f)) { return; }
|
37
|
+
f = f[filter];
|
38
|
+
if (!$.isFunction(f)) { return; }
|
39
|
+
$.proxy(f, this)(this.params, this.state);
|
38
40
|
}
|
39
41
|
},
|
40
42
|
definition
|
data/lib/jcontroller/version.rb
CHANGED
File without changes
|
data/spec/fake_app/routes.rb
CHANGED
@@ -61,6 +61,10 @@ feature 'invoke correct filter', :js => true do
|
|
61
61
|
visit superusers_path
|
62
62
|
test_elements filters('superusers', "index", %w[application users])
|
63
63
|
end
|
64
|
+
scenario 'with empty parent controller' do
|
65
|
+
visit empty_parents_path
|
66
|
+
test_elements filters('empty_parents', "index")
|
67
|
+
end
|
64
68
|
|
65
69
|
scenario 'with no action defined' do
|
66
70
|
visit no_action_users_path
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: jcontroller
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Steve Chung
|
@@ -165,11 +165,13 @@ files:
|
|
165
165
|
- spec/fake_app/app/assets/javascripts/application.js
|
166
166
|
- spec/fake_app/app/assets/javascripts/jcontrollers/admin/admins_jcontroller.js
|
167
167
|
- spec/fake_app/app/assets/javascripts/jcontrollers/application_jcontroller.js
|
168
|
+
- spec/fake_app/app/assets/javascripts/jcontrollers/empty_parents_jcontroller.js
|
168
169
|
- spec/fake_app/app/assets/javascripts/jcontrollers/superusers_jcontroller.js
|
169
170
|
- spec/fake_app/app/assets/javascripts/jcontrollers/users_jcontroller.js
|
170
171
|
- spec/fake_app/app/controllers.rb
|
171
172
|
- spec/fake_app/app/helpers.rb
|
172
173
|
- spec/fake_app/app/views/admin/users/index.html.erb
|
174
|
+
- spec/fake_app/app/views/empty_parents/index.html.erb
|
173
175
|
- spec/fake_app/app/views/layouts/application.html.erb
|
174
176
|
- spec/fake_app/app/views/superusers/index.html.erb
|
175
177
|
- spec/fake_app/app/views/users/action_and_parameters.html.erb
|
@@ -218,11 +220,13 @@ test_files:
|
|
218
220
|
- spec/fake_app/app/assets/javascripts/application.js
|
219
221
|
- spec/fake_app/app/assets/javascripts/jcontrollers/admin/admins_jcontroller.js
|
220
222
|
- spec/fake_app/app/assets/javascripts/jcontrollers/application_jcontroller.js
|
223
|
+
- spec/fake_app/app/assets/javascripts/jcontrollers/empty_parents_jcontroller.js
|
221
224
|
- spec/fake_app/app/assets/javascripts/jcontrollers/superusers_jcontroller.js
|
222
225
|
- spec/fake_app/app/assets/javascripts/jcontrollers/users_jcontroller.js
|
223
226
|
- spec/fake_app/app/controllers.rb
|
224
227
|
- spec/fake_app/app/helpers.rb
|
225
228
|
- spec/fake_app/app/views/admin/users/index.html.erb
|
229
|
+
- spec/fake_app/app/views/empty_parents/index.html.erb
|
226
230
|
- spec/fake_app/app/views/layouts/application.html.erb
|
227
231
|
- spec/fake_app/app/views/superusers/index.html.erb
|
228
232
|
- spec/fake_app/app/views/users/action_and_parameters.html.erb
|