js-namespace-rails 1.0.0 → 1.0.1
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/README.md +25 -3
- data/app/views/js_namespace_rails/_init.js.erb +1 -0
- data/lib/js_namespace_rails/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 03dd3af7647f1ec0adb2184a10be2df1e1c5b4db
|
4
|
+
data.tar.gz: 9653ea1d9336402cd1b46d145f8ec323285167b3
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: df5036638b1133f602a8029a841c2925c3a365266bfa810cdaf3c02f8b0b50a9bb449dfa165e94e74941073671113534440ffbd9816f8644350ae8a0c26e6773
|
7
|
+
data.tar.gz: e64aa4a4c1bf66008195ea42259b995c7a68a89cfc77b619de990cc377602b5d85266114c26d78b750c78d6c874b6d869a25fb4179a2b5ba6002478f0cdc9df0
|
data/README.md
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
# JsNamespaceRails [](https://travis-ci.org/falm/js-namespace-rails) [](https://coveralls.io/github/falm/js-namespace-rails?branch=master) [](https://codeclimate.com/github/falm/js-namespace-rails) [](https://gemnasium.com/github.com/falm/js-namespace-rails)
|
1
|
+
# JsNamespaceRails [](https://travis-ci.org/falm/js-namespace-rails) [](https://coveralls.io/github/falm/js-namespace-rails?branch=master) [](https://codeclimate.com/github/falm/js-namespace-rails) [](https://gemnasium.com/github.com/falm/js-namespace-rails) [](https://badge.fury.io/rb/js-namespace-rails)
|
2
2
|
|
3
3
|
|
4
4
|
Rails's asset pipeline compiles all of js file into a single file which is executed on all pages.
|
@@ -15,11 +15,11 @@ gem 'js-namespace-rails'
|
|
15
15
|
|
16
16
|
## Setup
|
17
17
|
|
18
|
-
Require js-namespace-rails file in application.js or other
|
18
|
+
Require js-namespace-rails file in application.js or other main file,
|
19
|
+
**notice** js-namespace-rails has no dependency
|
19
20
|
|
20
21
|
``` js
|
21
22
|
|
22
|
-
//= require jquery
|
23
23
|
//= require js-namespace-rails
|
24
24
|
|
25
25
|
```
|
@@ -48,5 +48,27 @@ JsSpace.on('articles', {
|
|
48
48
|
});
|
49
49
|
```
|
50
50
|
|
51
|
+
## Feature
|
52
|
+
### Passing Parameters to js
|
53
|
+
```ruby
|
54
|
+
class ArticlesController < ApplicationController
|
55
|
+
def show
|
56
|
+
@article = Article.find(params[:id])
|
57
|
+
js author: @article.author
|
58
|
+
# also you can passing an object
|
59
|
+
js article: @article
|
60
|
+
end
|
61
|
+
end
|
62
|
+
```
|
63
|
+
|
64
|
+
```js
|
65
|
+
// app/assets/javascripts/articles.js.erb
|
66
|
+
JsSpace.on('articles', {
|
67
|
+
show: function(){
|
68
|
+
console.log(this.params.author); // get author from params
|
69
|
+
console.log(this.params.article.title); // get title of article
|
70
|
+
}
|
71
|
+
});
|
72
|
+
```
|
51
73
|
## License
|
52
74
|
MIT License.
|
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: 1.0.
|
4
|
+
version: 1.0.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jason Hou
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-07-
|
11
|
+
date: 2016-07-14 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: railties
|
@@ -173,7 +173,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
173
173
|
version: '0'
|
174
174
|
requirements: []
|
175
175
|
rubyforge_project:
|
176
|
-
rubygems_version: 2.
|
176
|
+
rubygems_version: 2.6.6
|
177
177
|
signing_key:
|
178
178
|
specification_version: 4
|
179
179
|
summary: js-namespace-rails let you choose which javascript snippet can execute in
|