js-namespace-rails 0.1.0 → 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 6549d1e9a3e5654e0478a1d1b653dcb873f53961
4
- data.tar.gz: 28d01f3641b7693489b06a9afdf8f651c88c76e6
3
+ metadata.gz: fc5c9aaf90032ca0b2336b6f3e0378cfd17b9c0c
4
+ data.tar.gz: 29bcbc3fd241d5ae779719fbc95d02a3dda88c29
5
5
  SHA512:
6
- metadata.gz: 945957b13386916a493cfd9c6805ec1e66b83622b6396fae2d90a4d3b240775dac471005a6cbac15ee4fac65771f5e09e4ea279ad785457199736c544c07342a
7
- data.tar.gz: 2adea15411985e2282a441296179d6c7c5b765d60805a120cfb5924a9b115714cedce9c789360b3c07b4662925d59325d64545a47daf056cbdd8652ed2d77895
6
+ metadata.gz: 874d914cca90bd43ee396685cc658535bdea9e08544ee0c7968afd682ea17917060c9d616e746e5cc9aa186e58499bfaec0d1fda1e1533ca6fc6ca6f7aa5d9bc
7
+ data.tar.gz: 3ac478149a622ed55ef664810c075130ef84e8fd4ee0301e073174649cad4e8e32df940d6eb6bb7c6e45b769f5c99cac74f8f3d9d95547cf428bbe165a888bf9
data/README.md CHANGED
@@ -10,7 +10,7 @@ js-namespace-rails can handle this problem by using it's method to namespace and
10
10
  Add this line to your application's Gemfile:
11
11
 
12
12
  ```ruby
13
- gem 'js-namespace-rails', github: 'falm/js-namepsace-rails'
13
+ gem 'js-namespace-rails'
14
14
  ```
15
15
 
16
16
  ## Setup
@@ -18,8 +18,10 @@ gem 'js-namespace-rails', github: 'falm/js-namepsace-rails'
18
18
  Require js-namespace-rails file in application.js or other bundle,notice js-namespace-rails depends on jquery so you need require 'jquery' before
19
19
 
20
20
  ``` js
21
+
21
22
  //= require jquery
22
23
  //= require js-namespace-rails
24
+
23
25
  ```
24
26
 
25
27
 
@@ -33,7 +35,7 @@ Assume your project have articles_controller
33
35
  ```
34
36
  And its corresponding js file app/assets/javascripts/articles.js.erb
35
37
 
36
- then you just need to write blew into the js file
38
+ then you just need to write below into the js file
37
39
  ``` js
38
40
  // app/assets/javascripts/articles.js.erb
39
41
  JsSpace.on('articles', {
@@ -46,6 +48,9 @@ then you just need to write blew into the js file
46
48
  });
47
49
  ```
48
50
 
51
+ ## License
52
+ MIT License.
53
+
49
54
 
50
55
 
51
56
 
@@ -1,21 +1,25 @@
1
1
 
2
2
  module ActionView::Helpers::AssetTagHelper
3
3
 
4
- alias_method :old_javascript_include_tag, :javascript_include_tag
4
+ alias_method :javascript_include_tag_without_controller, :javascript_include_tag
5
5
 
6
6
  def javascript_include_tag(*source)
7
7
 
8
- origin_result = old_javascript_include_tag(*source)
8
+ origin_result = javascript_include_tag_without_controller(*source)
9
9
 
10
- _controller = controller_path.gsub(/\//,'_')
10
+ if defined?(controller_path)
11
+ _controller = controller_path.gsub(/\//,'_')
11
12
 
12
- script = <<STRING
13
- document.addEventListener('DOMContentLoaded', function() {
14
- document.getElementsByTagName('body')[0].setAttribute('data-controller', '#{_controller}');
15
- document.getElementsByTagName('body')[0].setAttribute('data-action', '#{action_name}');
16
- });
13
+ script = <<STRING
14
+ document.addEventListener('DOMContentLoaded', function() {
15
+ document.getElementsByTagName('body')[0].setAttribute('data-controller', '#{_controller}');
16
+ document.getElementsByTagName('body')[0].setAttribute('data-action', '#{action_name}');
17
+ });
17
18
  STRING
18
- origin_result + concat(javascript_tag(script, defer: 'defer'))
19
+ origin_result + concat(javascript_tag(script, defer: 'defer'))
20
+ end
21
+
22
+ origin_result
19
23
 
20
24
  end
21
25
 
@@ -4,6 +4,8 @@ module JsNamespaceRails
4
4
 
5
5
  class Engine < ::Rails::Engine
6
6
 
7
+ require 'jquery-rails'
8
+ # isolate_namespace
7
9
  end
8
10
 
9
11
  end
@@ -1,3 +1,3 @@
1
1
  module JsNamespaceRails
2
- VERSION = '0.1.0'
2
+ VERSION = '0.2.0'
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: js-namespace-rails
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jason Hou
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2015-12-14 00:00:00.000000000 Z
11
+ date: 2016-02-17 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: railties
@@ -80,6 +80,48 @@ dependencies:
80
80
  - - "~>"
81
81
  - !ruby/object:Gem::Version
82
82
  version: '10.0'
83
+ - !ruby/object:Gem::Dependency
84
+ name: rspec-rails
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - ">="
88
+ - !ruby/object:Gem::Version
89
+ version: '0'
90
+ type: :development
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - ">="
95
+ - !ruby/object:Gem::Version
96
+ version: '0'
97
+ - !ruby/object:Gem::Dependency
98
+ name: capybara
99
+ requirement: !ruby/object:Gem::Requirement
100
+ requirements:
101
+ - - ">="
102
+ - !ruby/object:Gem::Version
103
+ version: '0'
104
+ type: :development
105
+ prerelease: false
106
+ version_requirements: !ruby/object:Gem::Requirement
107
+ requirements:
108
+ - - ">="
109
+ - !ruby/object:Gem::Version
110
+ version: '0'
111
+ - !ruby/object:Gem::Dependency
112
+ name: capybara-webkit
113
+ requirement: !ruby/object:Gem::Requirement
114
+ requirements:
115
+ - - ">="
116
+ - !ruby/object:Gem::Version
117
+ version: '0'
118
+ type: :development
119
+ prerelease: false
120
+ version_requirements: !ruby/object:Gem::Requirement
121
+ requirements:
122
+ - - ">="
123
+ - !ruby/object:Gem::Version
124
+ version: '0'
83
125
  description: Namespace and Selectively Execute Javascript
84
126
  email:
85
127
  - hjj1992@gmail.com
@@ -95,7 +137,8 @@ files:
95
137
  - lib/js_namespace_rails/engine.rb
96
138
  - lib/js_namespace_rails/version.rb
97
139
  homepage: https://github.com/falm/js-namespace-rails
98
- licenses: []
140
+ licenses:
141
+ - MIT
99
142
  metadata: {}
100
143
  post_install_message:
101
144
  rdoc_options: []