poke_js 0.1.9 → 0.1.10

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,3 +1,3 @@
1
1
  module PokeJs
2
- VERSION = "0.1.9"
2
+ VERSION = "0.1.10"
3
3
  end
@@ -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("/", ".")}.#{request.format.symbol}.#{action}_params"
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: request.format.symbol }
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
- with_format(:js) do
51
- javascript_tag do
52
- raw %Q/
53
- POKE.create_namespace('#{poke_js_params}');
54
- #{poke_js_params} = #{ define_poke_js_params do
55
- if lookup_context.template_exists? "#{controller}/#{action}_params"
56
- render(template: "#{controller}/#{action}_params")
57
- end
58
- end };
59
- #{
60
- if @source_poke
61
- %Q/$(function() { POKE.exec_all(#{poke_js_params}); });/
62
- else
63
- %Q/
64
- POKE.define('POKE', {
65
- params: #{poke_js_params},
66
- init: function() { POKE.exec_all(POKE.params); },
67
- });
68
- $(POKE.init);
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
- content_for :head do
77
- javascript_tag do
78
- raw "$(function(){#{render template: "#{controller}/#{action}", formats: [:js], layout: "layouts/application"}});"
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.9
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-05-07 00:00:00.000000000 Z
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: 4368850175419377970
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: 4368850175419377970
89
+ hash: 1017681906546173350
90
90
  requirements: []
91
91
  rubyforge_project:
92
92
  rubygems_version: 1.8.25