vue_on_rails 0.9.6 → 0.9.7

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: 44cba178d9fcdee4a09bcb8e6969b510590fa589
4
- data.tar.gz: d155a02addcf11b43bf9e540695b0d3bbdf7483d
3
+ metadata.gz: 9ef2c61db2d72d94af6a9bd6d09a77d4e99eb047
4
+ data.tar.gz: 89f9d4529e962d23bf154cc6b8b53661271a4b93
5
5
  SHA512:
6
- metadata.gz: 5a0099fc74fb0918e829317f94c65abc04d7c7aac797d2f7d73b70a535fed81576e2862ba01e7a4bd8d7c3ebdab287eafbeea13856d48332fe68b54294b1017e
7
- data.tar.gz: 1df3b0d77feb32ff16cbec3b32ae920ebf35c87c425acc1160c6bf5f0bb18535a69f78407f07b7395ca1a26d86845fa2f87d3c1c60b4d7630bcdf42ff46a7874
6
+ metadata.gz: f8c06cafd04674c74f8c3c151e8eb0ad8dbb98cf2589d7a6c26e84ae7bd5849e8c7ccfe5c321157e48755547bd0f011d8bcbba6862c4d1a0cc6e108490be91b6
7
+ data.tar.gz: 11ce139ddfe0e735b02723645f57a95e8cd798db9dc6c30aad44d29149f371727087ef229f9b13c0f51a74e3c64cec8fd4c21bf2bd4a7f7df6a5427bd170475f
data/README.md CHANGED
@@ -2,10 +2,9 @@
2
2
 
3
3
  Easy and simple way to use Vue.js with Ruby on Rails and Turbolinks 5.
4
4
 
5
- This gem is intended to sprinkle your Rails app with Vue components.
6
- It's compatible with Turbolinks caching system.
5
+ This gem is intended to sprinkle your Rails app with Vue components. Really lightweight script (1.3KB minified) that mount and destroy Vue components on demand. It's works nicely with Turbolinks rendering and caching system.
7
6
 
8
- If you are building a pure SPA app with Vue and Rails without Turbolinks, please look into:
7
+ If you are building a pure SPA app with Vue and Rails without Turbolinks, you will be better off looking into:
9
8
  https://github.com/adambutler/vuejs-rails
10
9
 
11
10
  ## Requirements
@@ -37,15 +36,15 @@ Require vue_on_rails in application.js
37
36
  //= require vue_on_rails
38
37
  ```
39
38
 
40
- Init and destroy Vue components:
39
+ Mount and destroy Vue components:
41
40
  ```
42
41
  # Mount Vue components
43
42
  document.addEventListener 'turbolinks:load', ->
44
- VueOnRails.init()
43
+ VueOnRails.mountComponents()
45
44
 
46
45
  # Destroy Vue components
47
46
  document.addEventListener 'turbolinks:before-render', ->
48
- VueOnRails.destroy()
47
+ VueOnRails.destroyComponents()
49
48
  ```
50
49
 
51
50
  Example Vue component in my_component.coffee
@@ -1,3 +1,3 @@
1
1
  module VueOnRails
2
- VERSION = '0.9.6'
2
+ VERSION = '0.9.7'
3
3
  end
@@ -22,28 +22,23 @@ this.VueOnRails = (function() {
22
22
  name = component.getAttribute('data-vue-component');
23
23
  props = JSON.parse(component.getAttribute('data-vue-props'));
24
24
  if ((namespace && typeof window[namespace][name] === 'object') || window[name] === 'object') {
25
- el = document.createElement('element-to-be-mounted');
26
- component.innerHTML = '';
27
- component.appendChild(el);
28
- vm = newVueInstance(name, props, el);
25
+ vm = newVueInstance(name, props, component);
29
26
  return vueModels.push(vm);
30
27
  }
31
28
  };
32
29
 
33
- newVueInstance = function(name, props, el) {
34
- var component, element, nameFormatted, obj;
35
- nameFormatted = camelCaseToHyphen(name);
36
- element = document.createElement(nameFormatted);
30
+ newVueInstance = function(name, props, component) {
31
+ var nameFormatted = camelCaseToHyphen(name);
32
+ var element = document.createElement(nameFormatted);
33
+ var componentName = namespace ? window[namespace][name] : window[name];
37
34
  setElementProps(element, props);
38
- component = namespace ? window[namespace][name] : window[name];
35
+ component.innerHTML = '';
36
+ component.appendChild(element);
37
+ componentObj = {};
38
+ componentObj[nameFormatted] = componentName;
39
39
  return new Vue({
40
- el: el,
41
- template: element.outerHTML,
42
- components: (
43
- obj = {},
44
- obj["" + nameFormatted] = component,
45
- obj
46
- )
40
+ el: component,
41
+ components: componentObj
47
42
  });
48
43
  };
49
44
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: vue_on_rails
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.9.6
4
+ version: 0.9.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Benoit Zeler
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2017-05-02 00:00:00.000000000 Z
11
+ date: 2017-07-06 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -96,5 +96,6 @@ rubyforge_project:
96
96
  rubygems_version: 2.6.11
97
97
  signing_key:
98
98
  specification_version: 4
99
- summary: Easy and simple way to use Vue.js with Ruby on Rails and Turbolinks 5.
99
+ summary: Easy and simple way to mount/destroy Vue.js components with Ruby on Rails
100
+ and Turbolinks 5.
100
101
  test_files: []