render_async 1.1.1 → 1.1.2
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:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e057fbb8641218f58f60e10f8f746028f74a02d9
|
4
|
+
data.tar.gz: 6ed74b31920f184c7331691e3682420e02fc0bf2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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 %>"));
|
data/lib/render_async/version.rb
CHANGED
@@ -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.
|
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-
|
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.
|
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
|