better_frame 0.3.1 → 0.3.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: 13d2177a2085fbc59122813f41ce7eea8d248e94
|
|
4
|
+
data.tar.gz: ac8ea62d957ecb4f3e42029d2e2942192b9ade9c
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: aec1bf79d43e0bdcde5f87d79aa3f0bec953da5aef2ec4b9d7f4100d8a1de37fdcf644ee9d85960355d20eae5ed64ba5af6add43e22933511020ab452811c31d
|
|
7
|
+
data.tar.gz: 1254e457555eff500ce75aeb4fc177d28a7d2a2cb098729906a186313402198ac8aaafc5c88fdbb09e8d9f32ae8774b9bcb66f0d902328de8bfed488f1ae6ee0
|
|
@@ -35,7 +35,7 @@
|
|
|
35
35
|
fill(url).then(storeURLInHistory);
|
|
36
36
|
}
|
|
37
37
|
|
|
38
|
-
$(document).on("click", "#app-content a:not([target=\"_blank\"]):not([data-ignore-better-frame])", handleLinks);
|
|
38
|
+
$(document).on("click", "#app-content a:not([target=\"_blank\"]):not([data-ignore-better-frame]):not([data-method])", handleLinks);
|
|
39
39
|
|
|
40
40
|
$(document).on("ajax:success", "#app-content form", function(e, data, status, xhr) {
|
|
41
41
|
fillContent(data);
|
|
@@ -99,7 +99,7 @@
|
|
|
99
99
|
|
|
100
100
|
// Default way to get an element's href. May be overridden at $.rails.href.
|
|
101
101
|
href: function(element) {
|
|
102
|
-
return element[0].href;
|
|
102
|
+
return element[0].getAttribute("href");
|
|
103
103
|
},
|
|
104
104
|
|
|
105
105
|
// Checks "data-remote" if true to handle the request through a XHR request.
|
|
@@ -117,14 +117,7 @@
|
|
|
117
117
|
|
|
118
118
|
if (element.is('form')) {
|
|
119
119
|
method = element.data('ujs:submit-button-formmethod') || element.attr('method');
|
|
120
|
-
|
|
121
|
-
var railsURL = $("#app-content").data("railsurl");
|
|
122
|
-
// if url_or_path starts with a slash assume it's a path
|
|
123
|
-
if (url_or_path.match(/^\//) && railsURL !== undefined) {
|
|
124
|
-
url = railsURL + url_or_path;
|
|
125
|
-
} else {
|
|
126
|
-
url = url_or_path;
|
|
127
|
-
}
|
|
120
|
+
url = element.data('ujs:submit-button-formaction') || element.attr('action');
|
|
128
121
|
data = $(element[0]).serializeArray();
|
|
129
122
|
// memoized value from clicked submit button
|
|
130
123
|
var button = element.data('ujs:submit-button');
|
|
@@ -149,6 +142,13 @@
|
|
|
149
142
|
url = rails.href(element);
|
|
150
143
|
data = element.data('params') || null;
|
|
151
144
|
}
|
|
145
|
+
var railsURL = $("#app-content").data("railsurl");
|
|
146
|
+
// if url starts with a slash assume it's a path
|
|
147
|
+
if (url.match(/^\//) && railsURL !== undefined) {
|
|
148
|
+
url = railsURL + url;
|
|
149
|
+
} else {
|
|
150
|
+
url = url;
|
|
151
|
+
}
|
|
152
152
|
|
|
153
153
|
options = {
|
|
154
154
|
type: method || 'GET', data: data, dataType: dataType,
|
|
@@ -229,12 +229,13 @@
|
|
|
229
229
|
// <a href="/users/5" data-method="delete" rel="nofollow" data-confirm="Are you sure?">Delete</a>
|
|
230
230
|
handleMethod: function(link) {
|
|
231
231
|
var href = rails.href(link),
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
232
|
+
method = link.data('method'),
|
|
233
|
+
target = link.attr('target'),
|
|
234
|
+
csrfToken = rails.csrfToken(),
|
|
235
|
+
csrfParam = rails.csrfParam(),
|
|
236
|
+
remote = rails.isRemote(link),
|
|
237
|
+
form = $('<form method="post" action="' + href + '" data-with-credentials="true" data-remote="true"></form>'),
|
|
238
|
+
metadataInput = '<input name="_method" value="' + method + '" type="hidden" />';
|
|
238
239
|
|
|
239
240
|
if (csrfParam !== undefined && csrfToken !== undefined && !rails.isCrossDomain(href)) {
|
|
240
241
|
metadataInput += '<input name="' + csrfParam + '" value="' + csrfToken + '" type="hidden" />';
|
|
@@ -242,7 +243,7 @@
|
|
|
242
243
|
|
|
243
244
|
if (target) { form.attr('target', target); }
|
|
244
245
|
|
|
245
|
-
form.hide().append(metadataInput).appendTo('
|
|
246
|
+
form.hide().append(metadataInput).appendTo('#app-content');
|
|
246
247
|
form.submit();
|
|
247
248
|
},
|
|
248
249
|
|
data/lib/better_frame/version.rb
CHANGED
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: better_frame
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.3.
|
|
4
|
+
version: 0.3.2
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Yves Siegrist
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2016-07-
|
|
11
|
+
date: 2016-07-26 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: bundler
|