js-namespace-rails 1.0.0 → 1.0.1

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: fe0b83f913fadbc40f98ce658c77de91c0bef46f
4
- data.tar.gz: 3d3d5955da1b367240c78da70b59f93e8af4621a
3
+ metadata.gz: 03dd3af7647f1ec0adb2184a10be2df1e1c5b4db
4
+ data.tar.gz: 9653ea1d9336402cd1b46d145f8ec323285167b3
5
5
  SHA512:
6
- metadata.gz: eec5bb362b618e9c09ad71b2a62a9778ada9dd5402de75f03142e058b1149e065b72dfef5eb3eea853d94e2d9a1e34d636db5c6805f25177e352c4adec2b8d66
7
- data.tar.gz: 89e4d5d598a1e03d00073175a50ea6cb21154d9ed79a0f6ba2d0f8de2d822d3581ef370a7664234fcfdd344c3b3cac1caa4b951860ad77ed381086b52918180f
6
+ metadata.gz: df5036638b1133f602a8029a841c2925c3a365266bfa810cdaf3c02f8b0b50a9bb449dfa165e94e74941073671113534440ffbd9816f8644350ae8a0c26e6773
7
+ data.tar.gz: e64aa4a4c1bf66008195ea42259b995c7a68a89cfc77b619de990cc377602b5d85266114c26d78b750c78d6c874b6d869a25fb4179a2b5ba6002478f0cdc9df0
data/README.md CHANGED
@@ -1,4 +1,4 @@
1
- # JsNamespaceRails [![Build Status](https://travis-ci.org/falm/js-namespace-rails.svg?branch=master)](https://travis-ci.org/falm/js-namespace-rails) [![Coverage Status](https://coveralls.io/repos/github/falm/js-namespace-rails/badge.svg?branch=master)](https://coveralls.io/github/falm/js-namespace-rails?branch=master) [![Code Climate](https://codeclimate.com/github/falm/js-namespace-rails/badges/gpa.svg)](https://codeclimate.com/github/falm/js-namespace-rails) [![Dependency Status](https://gemnasium.com/badges/github.com/falm/js-namespace-rails.svg)](https://gemnasium.com/github.com/falm/js-namespace-rails)
1
+ # JsNamespaceRails [![Build Status](https://travis-ci.org/falm/js-namespace-rails.svg?branch=master)](https://travis-ci.org/falm/js-namespace-rails) [![Coverage Status](https://coveralls.io/repos/github/falm/js-namespace-rails/badge.svg?branch=master)](https://coveralls.io/github/falm/js-namespace-rails?branch=master) [![Code Climate](https://codeclimate.com/github/falm/js-namespace-rails/badges/gpa.svg)](https://codeclimate.com/github/falm/js-namespace-rails) [![Dependency Status](https://gemnasium.com/badges/github.com/falm/js-namespace-rails.svg)](https://gemnasium.com/github.com/falm/js-namespace-rails) [![Gem Version](https://badge.fury.io/rb/js-namespace-rails.svg)](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 bundle,notice js-namespace-rails depends on jquery so you need require 'jquery' before
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.
@@ -1,2 +1,3 @@
1
+ JsSpace.params = <%= raw @js_namespace_rails_params.to_json %>;
1
2
 
2
3
  JsSpace.init('<%= controller_path.gsub(/\//,'_')%>', '<%= action_name %>');
@@ -1,3 +1,3 @@
1
1
  module JsNamespaceRails
2
- VERSION = '1.0.0'
2
+ VERSION = '1.0.1'
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: 1.0.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-07 00:00:00.000000000 Z
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.5.1
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