diff --git a/public/js/legacy/form.js b/public/js/legacy/form.js
index a5b931df9e..7139e1bbb1 100644
--- a/public/js/legacy/form.js
+++ b/public/js/legacy/form.js
@@ -353,7 +353,6 @@ _f.Frm.prototype.check_doc_perm = function() {
this.perm = wn.perm.get_perm(dt, dn);
if(!this.perm[0][READ]) {
- wn.set_route("403");
return 0;
}
return 1
diff --git a/public/js/wn/form/layout.js b/public/js/wn/form/layout.js
index 281e39a7fa..d0f78dd341 100644
--- a/public/js/wn/form/layout.js
+++ b/public/js/wn/form/layout.js
@@ -115,7 +115,9 @@ wn.ui.form.Layout = Class.extend({
});
}
if(df.description) {
- $('
' + df.description + '
').appendTo(this.section);
+ $('' + df.description + '
')
+ .css("padding-left", "40px")
+ .appendTo(this.section);
}
if(df.label || df.description) {
// spacer
diff --git a/public/js/wn/request.js b/public/js/wn/request.js
index 0d73dfa0fc..ec543bd867 100644
--- a/public/js/wn/request.js
+++ b/public/js/wn/request.js
@@ -170,7 +170,7 @@ wn.request.cleanup = function(opts, r) {
}
if(r['403']) {
- wn.set_route('403');
+ wn.show_not_permitted(wn.get_route_str());
}
if(r.docs) {
diff --git a/public/js/wn/views/container.js b/public/js/wn/views/container.js
index e5b54d20d5..619632f646 100644
--- a/public/js/wn/views/container.js
+++ b/public/js/wn/views/container.js
@@ -88,7 +88,7 @@ wn.views.Factory = Class.extend({
if(route[1]) {
me.make(route);
} else {
- wn.set_route('404');
+ wn.show_not_found(route);
}
}
},
diff --git a/public/js/wn/views/formview.js b/public/js/wn/views/formview.js
index 4e15131e02..097d06ad23 100644
--- a/public/js/wn/views/formview.js
+++ b/public/js/wn/views/formview.js
@@ -44,7 +44,7 @@ wn.views.FormFactory = wn.views.Factory.extend({
wn.set_route("Form", dt, new_name)
}
} else {
- wn.set_route('404');
+ wn.show_not_found(route);
}
return;
}
diff --git a/public/js/wn/views/pageview.js b/public/js/wn/views/pageview.js
index 04331f4eb2..75289d4718 100644
--- a/public/js/wn/views/pageview.js
+++ b/public/js/wn/views/pageview.js
@@ -38,7 +38,7 @@ wn.views.pageview = {
wn.views.pageview.with_page(name, function(r) {
if(r && r.exc) {
if(!r['403'])
- wn.set_route('404');
+ wn.show_not_found(name);
} else if(!wn.pages[name]) {
new wn.views.Page(name);
}
@@ -59,6 +59,10 @@ wn.views.Page = Class.extend({
wn.pages[window.page_name] = this.wrapper;
} else {
this.pagedoc = locals.Page[this.name];
+ if(!this.pagedoc) {
+ wn.show_not_found(name);
+ return;
+ }
this.wrapper = wn.container.add_page(this.name);
this.wrapper.label = this.pagedoc.title || this.pagedoc.name;
this.wrapper.page_name = this.pagedoc.name;
@@ -89,21 +93,20 @@ wn.views.Page = Class.extend({
}
})
-
-wn.standard_pages["404"] = function() {
- var page = wn.container.add_page('404');
+wn.show_not_found = function(page_name) {
+ var page = wn.pages[page_name] || wn.container.add_page(page_name);
$(page).html('');
-};
+}
-wn.standard_pages["403"] = function() {
- var page = wn.container.add_page('403');
+wn.show_not_permitted = function(page_name) {
+ var page = wn.pages[page_name] || wn.container.add_page(page_name);
$(page).html('');
-};
\ No newline at end of file
+}
\ No newline at end of file
diff --git a/public/js/wn/views/reportview.js b/public/js/wn/views/reportview.js
index 85b2038858..65dcb37548 100644
--- a/public/js/wn/views/reportview.js
+++ b/public/js/wn/views/reportview.js
@@ -10,7 +10,7 @@ wn.views.ReportFactory = wn.views.Factory.extend({
wn.views.ReportViewPage = Class.extend({
init: function(doctype, docname) {
if(!wn.model.can_get_report(doctype)) {
- wn.set_route("403");
+ wn.show_not_permitted(wn.get_route_str());
return;
};