poke_js 0.1.9 → 0.1.10
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/poke_js/version.rb +1 -1
- data/lib/poke_js/view_helpers.rb +29 -27
- metadata +4 -4
data/lib/poke_js/version.rb
CHANGED
data/lib/poke_js/view_helpers.rb
CHANGED
@@ -19,13 +19,13 @@ module PokeJs
|
|
19
19
|
|
20
20
|
def poke_js_params(template=@poke_js_template)
|
21
21
|
controller, action = extract_template(template)
|
22
|
-
raw "APP.#{controller.gsub("/", ".")}.#{
|
22
|
+
raw "APP.#{controller.gsub("/", ".")}.#{formats.first}.#{action}_params"
|
23
23
|
end
|
24
24
|
|
25
25
|
def define_poke_js_params(template=@poke_js_template)
|
26
26
|
controller, action = extract_template(template)
|
27
27
|
|
28
|
-
params = { controller: controller, action: action, method: request.method, path: request.env['PATH_INFO'], format:
|
28
|
+
params = { controller: controller, action: action, method: request.method, path: request.env['PATH_INFO'], format: formats.first }
|
29
29
|
if self.respond_to? :add_params
|
30
30
|
params.reverse_merge! add_params
|
31
31
|
end
|
@@ -47,35 +47,37 @@ module PokeJs
|
|
47
47
|
controller, action = extract_template(template)
|
48
48
|
poke_lambda = -> do
|
49
49
|
if format == :html
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
end
|
71
|
-
}
|
50
|
+
javascript_tag do
|
51
|
+
raw %Q/
|
52
|
+
POKE.create_namespace('#{poke_js_params}');
|
53
|
+
#{poke_js_params} = #{ define_poke_js_params do
|
54
|
+
with_format :js do
|
55
|
+
if lookup_context.template_exists? "#{controller}/#{action}_params"
|
56
|
+
render(template: "#{controller}/#{action}_params")
|
57
|
+
end
|
58
|
+
end
|
59
|
+
end };
|
60
|
+
#{
|
61
|
+
if @source_poke
|
62
|
+
%Q/$(function() { POKE.exec_all(#{poke_js_params}); });/
|
63
|
+
else
|
64
|
+
%Q/
|
65
|
+
POKE.define('POKE', {
|
66
|
+
params: #{poke_js_params},
|
67
|
+
init: function() { POKE.exec_all(POKE.params); },
|
68
|
+
});
|
69
|
+
$(POKE.init);
|
72
70
|
/
|
73
71
|
end
|
72
|
+
}
|
73
|
+
/
|
74
74
|
end
|
75
75
|
elsif format == :js
|
76
|
-
|
77
|
-
|
78
|
-
|
76
|
+
with_format :js do
|
77
|
+
content_for :head do
|
78
|
+
javascript_tag do
|
79
|
+
raw "$(function(){#{render template: "#{controller}/#{action}", formats: [:js], layout: "layouts/application"}});"
|
80
|
+
end
|
79
81
|
end
|
80
82
|
end
|
81
83
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: poke_js
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.10
|
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: 2013-
|
12
|
+
date: 2013-06-26 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rails
|
@@ -77,7 +77,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
77
77
|
version: '0'
|
78
78
|
segments:
|
79
79
|
- 0
|
80
|
-
hash:
|
80
|
+
hash: 1017681906546173350
|
81
81
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
82
82
|
none: false
|
83
83
|
requirements:
|
@@ -86,7 +86,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
86
86
|
version: '0'
|
87
87
|
segments:
|
88
88
|
- 0
|
89
|
-
hash:
|
89
|
+
hash: 1017681906546173350
|
90
90
|
requirements: []
|
91
91
|
rubyforge_project:
|
92
92
|
rubygems_version: 1.8.25
|