render_async 1.1.2 → 1.1.3

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: e057fbb8641218f58f60e10f8f746028f74a02d9
4
- data.tar.gz: 6ed74b31920f184c7331691e3682420e02fc0bf2
3
+ metadata.gz: c603221d8623559e475f5dd31847ca30d86c3a6a
4
+ data.tar.gz: 54c76dde479ea0cfc2c500126f419752e50749a6
5
5
  SHA512:
6
- metadata.gz: 3a970ab3fd004b50f43d44fac587f3b651c2df007804f09d30a2e68a496d1dc7f1e1a0dde5a21f955b8274912f01a77f620308c2db5e26f541ca1a39e6aa0f81
7
- data.tar.gz: 7d2ef5381bb2a6bd798c81d65437c75305a97ee9e56b3918071d357ad82b26b134a915702b93d3e4a21dde23d55f6c6ed351ce6ae6d10b8c9a8ac09205885584
6
+ metadata.gz: b111b20c0440b3933b687469f851521b17163b31b5b312b180d1c7393b5b1222f96704832b52ca61d8e6dbb013ece9bf45ee2625a977b2f8083aa1bb1ac16461
7
+ data.tar.gz: c5853c4de18b1c7af54980e5656a1badcb3d9e39c9005eb133a5f3ce1b93bafadd795b1a5e8b8fa6523a1c23f0925a15e806d37a4ba3782fc5f943972e70e368
@@ -77,6 +77,15 @@
77
77
  "code",
78
78
  "doc"
79
79
  ]
80
+ },
81
+ {
82
+ "login": "elsurudo",
83
+ "name": "Ernest Surudo",
84
+ "avatar_url": "https://avatars3.githubusercontent.com/u/50223?v=4",
85
+ "profile": "http://elsurudo.com",
86
+ "contributions": [
87
+ "code"
88
+ ]
80
89
  }
81
90
  ]
82
91
  }
data/README.md CHANGED
@@ -1,5 +1,5 @@
1
1
  [![Build Status](https://semaphoreci.com/api/v1/renderedtext/render_async/branches/master/shields_badge.svg)](https://semaphoreci.com/renderedtext/render_async)
2
- [![All Contributors](https://img.shields.io/badge/all_contributors-7-orange.svg?style=flat-square)](#contributors)
2
+ [![All Contributors](https://img.shields.io/badge/all_contributors-8-orange.svg?style=flat-square)](#contributors)
3
3
  [![Gem Version](https://badge.fury.io/rb/render_async.svg)](https://badge.fury.io/rb/render_async)
4
4
  [![Code Climate](https://codeclimate.com/github/renderedtext/render_async/badges/gpa.svg)](https://codeclimate.com/github/renderedtext/render_async)
5
5
  [![Test Coverage](https://codeclimate.com/github/renderedtext/render_async/badges/coverage.svg)](https://codeclimate.com/github/renderedtext/render_async/coverage)
@@ -38,24 +38,18 @@ And then execute:
38
38
 
39
39
  ## Usage
40
40
 
41
- 1. Include `render_async` view helper somewhere in your views:
41
+ 1. Include `render_async` view helper somewhere in your views (e.g. `app/views/comments/show.html.erb`):
42
42
  ```erb
43
- # app/views/comments/show.html.erb
44
-
45
43
  <%= render_async comment_stats_path %>
46
44
  ```
47
45
 
48
- 2. Then create a route that will `config/routes.rb`
46
+ 2. Then create a route that will `config/routes.rb`:
49
47
  ```ruby
50
- # config/routes.rb
51
-
52
48
  get :comment_stats, :controller => :comments
53
49
  ```
54
50
 
55
- 3. Fill in the logic in your controller
51
+ 3. Fill in the logic in your controller (e.g. `app/controllers/comments_controller.rb`):
56
52
  ```ruby
57
- # app/controllers/comments_controller.rb
58
-
59
53
  def comment_stats
60
54
  @stats = Comment.get_stats
61
55
 
@@ -63,19 +57,15 @@ And then execute:
63
57
  end
64
58
  ```
65
59
 
66
- 4. Create a partial that will render
60
+ 4. Create a partial that will render (e.g. `app/views/comments/_comment_stats.html.erb`):
67
61
  ```erb
68
- # app/views/comments/_comment_stats.html.erb
69
-
70
62
  <div class="col-md-6">
71
63
  <%= @stats %>
72
64
  </div>
73
65
  ```
74
66
 
75
- 5. Add `content_for` in your base view file
67
+ 5. Add `content_for` in your base view file (e.g. `app/views/layouts/application.html.erb`):
76
68
  ```erb
77
- # application.html.erb
78
-
79
69
  <%= content_for :render_async %>
80
70
  ```
81
71
 
@@ -174,17 +164,14 @@ document.addEventListener("users-loaded", function() {
174
164
 
175
165
  `render_async` can utilize view fragment caching to avoid extra AJAX calls.
176
166
 
177
- In your views:
167
+ In your views (e.g. `app/views/comments/show.html.erb`):
178
168
  ```erb
179
- # app/views/comments/show.html.erb
180
-
181
169
  # note 'render_async_cache' instead of standard 'render_async'
182
170
  <%= render_async_cache comment_stats_path %>
183
171
  ```
184
172
 
173
+ Then, in the partial (e.g. `app/views/comments/_comment_stats.html.erb`):
185
174
  ```erb
186
- # app/views/comments/_comment_stats.html.erb
187
-
188
175
  <% cache render_async_cache_key(request.path), :skip_digest => true do %>
189
176
  <div class="col-md-6">
190
177
  <%= @stats %>
@@ -207,7 +194,7 @@ likely show up as an empty div.
207
194
  To resolve, tell turbolinks to reload your `render_async` call as follows:
208
195
 
209
196
  ```erb
210
- <%= render_async events_path, 'data-turbolinks-track': 'reload' %>
197
+ <%= render_async events_path, 'data-turbolinks-track': 'reload' %>
211
198
  ```
212
199
 
213
200
  ## Development
@@ -231,6 +218,7 @@ Thanks goes to these wonderful people ([emoji key](https://github.com/kentcdodds
231
218
  <!-- ALL-CONTRIBUTORS-LIST:START - Do not remove or modify this section -->
232
219
  | [<img src="https://avatars2.githubusercontent.com/u/3028124?v=4" width="100px;"/><br /><sub>Nikola Đuza</sub>](http://nikoladjuza.me/)<br />[💬](#question-nikolalsvk "Answering Questions") [🐛](https://github.com/renderedtext/render_async/issues?q=author%3Anikolalsvk "Bug reports") [💻](https://github.com/renderedtext/render_async/commits?author=nikolalsvk "Code") [📖](https://github.com/renderedtext/render_async/commits?author=nikolalsvk "Documentation") [💡](#example-nikolalsvk "Examples") [👀](#review-nikolalsvk "Reviewed Pull Requests") | [<img src="https://avatars0.githubusercontent.com/u/3866868?v=4" width="100px;"/><br /><sub>Colin</sub>](http://www.colinxfleming.com)<br />[💻](https://github.com/renderedtext/render_async/commits?author=colinxfleming "Code") [📖](https://github.com/renderedtext/render_async/commits?author=colinxfleming "Documentation") | [<img src="https://avatars2.githubusercontent.com/u/334273?v=4" width="100px;"/><br /><sub>Kasper Grubbe</sub>](http://kaspergrubbe.com)<br />[💻](https://github.com/renderedtext/render_async/commits?author=kaspergrubbe "Code") | [<img src="https://avatars2.githubusercontent.com/u/163584?v=4" width="100px;"/><br /><sub>Sai Ram Kunala</sub>](https://sairam.xyz/)<br />[📖](https://github.com/renderedtext/render_async/commits?author=sairam "Documentation") | [<img src="https://avatars2.githubusercontent.com/u/3065882?v=4" width="100px;"/><br /><sub>Josh Arnold</sub>](https://github.com/nightsurge)<br />[💻](https://github.com/renderedtext/render_async/commits?author=nightsurge "Code") [📖](https://github.com/renderedtext/render_async/commits?author=nightsurge "Documentation") | [<img src="https://avatars3.githubusercontent.com/u/107798?v=4" width="100px;"/><br /><sub>Elad Shahar</sub>](https://eladshahar.com)<br />[💻](https://github.com/renderedtext/render_async/commits?author=SaladFork "Code") | [<img src="https://avatars3.githubusercontent.com/u/232392?v=4" width="100px;"/><br /><sub>Sasha</sub>](http://www.revzin.co.il)<br />[💻](https://github.com/renderedtext/render_async/commits?author=sasharevzin "Code") [📖](https://github.com/renderedtext/render_async/commits?author=sasharevzin "Documentation") |
233
220
  | :---: | :---: | :---: | :---: | :---: | :---: | :---: |
221
+ | [<img src="https://avatars3.githubusercontent.com/u/50223?v=4" width="100px;"/><br /><sub>Ernest Surudo</sub>](http://elsurudo.com)<br />[💻](https://github.com/renderedtext/render_async/commits?author=elsurudo "Code") |
234
222
  <!-- ALL-CONTRIBUTORS-LIST:END -->
235
223
 
236
224
  This project follows the [all-contributors](https://github.com/kentcdodds/all-contributors) specification. Contributions of any kind welcome!
@@ -26,7 +26,7 @@
26
26
  request.onload = function() {
27
27
  if (request.status >= SUCCESS && request.status < ERROR) {
28
28
  var container = document.getElementById("<%= container_id %>");
29
- container.parentNode.innerHTML = request.response;
29
+ container.outerHTML = request.response;
30
30
 
31
31
  <% if event_name.present? %>
32
32
  document.dispatchEvent(new Event("<%= event_name %>"));
@@ -1,3 +1,3 @@
1
1
  module RenderAsync
2
- VERSION = "1.1.2"
2
+ VERSION = "1.1.3"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: render_async
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.2
4
+ version: 1.1.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Kasper Grubbe
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: exe
11
11
  cert_chain: []
12
- date: 2017-11-17 00:00:00.000000000 Z
12
+ date: 2017-11-22 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: bundler