render_async 1.1.1 → 1.1.2

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: 0e8f5232e6ce897923d42d8d7e13e12f2106596a
4
- data.tar.gz: ffddc0b5d3b6844d443b2b38b3314ad42fbf2b21
3
+ metadata.gz: e057fbb8641218f58f60e10f8f746028f74a02d9
4
+ data.tar.gz: 6ed74b31920f184c7331691e3682420e02fc0bf2
5
5
  SHA512:
6
- metadata.gz: 7a3b034960837da35ba4afd002c2f7c9ea05d55cbc33a20f9b6644e965c17295a48d47156eb418d7346f0204b50e298cd60525d258c174001a382884c05b4dfe
7
- data.tar.gz: 6a74359e25c505cdb82135fa671b966a54d41fc543e989f23e5086242de52bc6dc6ade032c647ea5abae6f1713bddbb25fae583b83241e4e7f1bd36ac826b60b
6
+ metadata.gz: 3a970ab3fd004b50f43d44fac587f3b651c2df007804f09d30a2e68a496d1dc7f1e1a0dde5a21f955b8274912f01a77f620308c2db5e26f541ca1a39e6aa0f81
7
+ data.tar.gz: 7d2ef5381bb2a6bd798c81d65437c75305a97ee9e56b3918071d357ad82b26b134a915702b93d3e4a21dde23d55f6c6ed351ce6ae6d10b8c9a8ac09205885584
@@ -4,9 +4,9 @@
4
4
 
5
5
  <% content_for :render_async do %>
6
6
  <%= javascript_tag html_options do %>
7
- if (jQuery) {
7
+ if (window.jQuery) {
8
8
  (function($){
9
- $.ajax({ url: "<%= path %>" }).always(function(response) {
9
+ $.ajax({ url: "<%= path.html_safe %>" }).always(function(response) {
10
10
  $("#<%= container_id %>").replaceWith(response);
11
11
 
12
12
  <% if event_name.present? %>
@@ -21,11 +21,12 @@
21
21
  var SUCCESS = 200;
22
22
  var ERROR = 400;
23
23
 
24
- request.open("GET", "<%= path %>", asyncRequest);
24
+ request.open("GET", "<%= path.html_safe %>", asyncRequest);
25
25
 
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
30
 
30
31
  <% if event_name.present? %>
31
32
  document.dispatchEvent(new Event("<%= event_name %>"));
@@ -1,3 +1,3 @@
1
1
  module RenderAsync
2
- VERSION = "1.1.1"
2
+ VERSION = "1.1.2"
3
3
  end
@@ -7,13 +7,13 @@ module RenderAsync
7
7
  "render_async_#{path}"
8
8
  end
9
9
 
10
- def render_async_cache(path, options = {})
10
+ def render_async_cache(path, options = {}, &placeholder)
11
11
  cached_view = Rails.cache.read("views/#{render_async_cache_key(path)}")
12
12
 
13
13
  if cached_view.present?
14
14
  render :html => cached_view.html_safe
15
15
  else
16
- render_async(path, options)
16
+ render_async(path, options, &placeholder)
17
17
  end
18
18
  end
19
19
 
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.1
4
+ version: 1.1.2
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-10-14 00:00:00.000000000 Z
12
+ date: 2017-11-17 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: bundler
@@ -109,7 +109,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
109
109
  version: '0'
110
110
  requirements: []
111
111
  rubyforge_project:
112
- rubygems_version: 2.6.13
112
+ rubygems_version: 2.6.14
113
113
  signing_key:
114
114
  specification_version: 4
115
115
  summary: Render parts of the page asynchronously with AJAX