If error in pushState ajax, reload page
This commit is contained in:
parent
8eb0b3c126
commit
fe34d271d1
4 changed files with 10 additions and 5 deletions
|
|
@ -12,7 +12,7 @@
|
|||
|
||||
{%- block head -%}
|
||||
{%- if meta_description is defined %}
|
||||
<meta name="description" content="{{ meta_description }}">
|
||||
<meta name="description" content="{{ meta_description|striptags }}">
|
||||
{%- endif -%}
|
||||
|
||||
{%- for link in web_include_js %}
|
||||
|
|
|
|||
|
|
@ -27,7 +27,7 @@
|
|||
$(function() {
|
||||
if(window.logged_in && getCookie("system_user")==="yes") {
|
||||
frappe.has_permission("Blog Post", "{{ name }}", "write", function(r) {
|
||||
frappe.require("assets/frappe/js/frappe/website/editable.js");
|
||||
frappe.require("/assets/frappe/js/frappe/website/editable.js");
|
||||
frappe.make_editable($('[itemprop="articleBody"]'), "Blog Post", "{{ name }}", "content");
|
||||
});
|
||||
}
|
||||
|
|
|
|||
|
|
@ -43,7 +43,7 @@
|
|||
$(function() {
|
||||
if(window.logged_in && getCookie("system_user")==="yes") {
|
||||
frappe.has_permission("Web Page", "{{ docname }}", "write", function(r) {
|
||||
frappe.require("assets/frappe/js/frappe/website/editable.js");
|
||||
frappe.require("/assets/frappe/js/frappe/website/editable.js");
|
||||
frappe.make_editable($(".web-page-content"), "Web Page", "{{ docname }}", "main_section");
|
||||
});
|
||||
}
|
||||
|
|
|
|||
|
|
@ -236,7 +236,7 @@ $.extend(frappe, {
|
|||
return
|
||||
|
||||
// our custom logic
|
||||
if (link.href.indexOf("cmd=")!==-1)
|
||||
if (link.href.indexOf("cmd=")!==-1 || link.hasAttribute("dont-use-ajax"))
|
||||
return
|
||||
|
||||
event.preventDefault()
|
||||
|
|
@ -255,6 +255,11 @@ $.extend(frappe, {
|
|||
frappe.render_json(data);
|
||||
}).always(function() {
|
||||
NProgress.done();
|
||||
}).fail(function(xhr, status, error) {
|
||||
if(!xhr.responseText && status==="error") {
|
||||
// ajax failed without response. Try reloading the full page.
|
||||
window.location.reload();
|
||||
}
|
||||
});
|
||||
},
|
||||
render_json: function(data) {
|
||||
|
|
@ -442,7 +447,7 @@ $(document).ready(function() {
|
|||
// switch to app link
|
||||
if(getCookie("system_user")==="yes") {
|
||||
$("#website-post-login .dropdown-menu").append('<li class="divider"></li>\
|
||||
<li><a href="app.html"><i class="icon-fixed-width icon-th-large"></i> Switch To App</a></li>');
|
||||
<li><a href="/app" dont-use-ajax><i class="icon-fixed-width icon-th-large"></i> Switch To App</a></li>');
|
||||
}
|
||||
|
||||
frappe.render_user();
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue