script_flow 0.0.2 → 0.0.3

Sign up to get free protection for your applications and to get access to all the features.
data/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # ScriptFlow
2
2
 
3
- TODO: Write a gem description
3
+ When you rendering the ERB templates/partials, utility remembers javascript syntax and add it to the end of Ajax response body
4
4
 
5
5
  ## Installation
6
6
 
@@ -18,7 +18,19 @@ Or install it yourself as:
18
18
 
19
19
  ## Usage
20
20
 
21
- TODO: Write usage instructions here
21
+ View html.erb template/partial:
22
+
23
+ <%= script do %>
24
+ alert('Hello Script Flow');
25
+ <% end %>
26
+
27
+ # When current request format is Mime::HTML acts as `javascript_tag` helper. During Ajax request (Mime::JS) add script to the end of response body.
28
+
29
+ <%= script_for :head do %>
30
+ alert('Hello Script Flow');
31
+ <% end %>
32
+
33
+ # When current request format is Mime::HTML acts as `content_for :head` with `javascript_tag` helpers. During Ajax request (Mime::JS) add script to the end of response body.
22
34
 
23
35
  ## Contributing
24
36
 
@@ -7,10 +7,11 @@ module ScriptFlow
7
7
  content = capture(&block)
8
8
  end
9
9
  if content
10
- if request.xhr?
10
+ case request.format
11
+ when Mime::JS then
11
12
  script_flow.add_script(content)
12
13
  nil
13
- else
14
+ when Mime::HTML then
14
15
  javascript_tag(content)
15
16
  end
16
17
  end
@@ -1,3 +1,3 @@
1
1
  module ScriptFlow
2
- VERSION = "0.0.2"
2
+ VERSION = "0.0.3"
3
3
  end
data/script_flow.gemspec CHANGED
@@ -8,7 +8,7 @@ Gem::Specification.new do |gem|
8
8
  gem.version = ScriptFlow::VERSION
9
9
  gem.authors = ["Valery Kvon"]
10
10
  gem.email = ["addagger@gmail.com"]
11
- gem.description = %q{When you rendering the ERB templates/partials, utility remembers javascript syntax and add it to the end of JS response body}
11
+ gem.description = %q{When you rendering the ERB templates/partials, utility remembers javascript syntax and add it to the end of Ajax response body}
12
12
  gem.summary = %q{Auto load script from rendered ERB during Ajax request}
13
13
  gem.homepage = ""
14
14
  gem.homepage = %q{http://vkvon.ru/projects/script_flow}
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: script_flow
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 0.0.3
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,10 +9,10 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-01-04 00:00:00.000000000 Z
12
+ date: 2013-01-05 00:00:00.000000000 Z
13
13
  dependencies: []
14
14
  description: When you rendering the ERB templates/partials, utility remembers javascript
15
- syntax and add it to the end of JS response body
15
+ syntax and add it to the end of Ajax response body
16
16
  email:
17
17
  - addagger@gmail.com
18
18
  executables: []