Merge branch 'rebrand-ui' of https://github.com/frappe/frappe into rebrand-ui
This commit is contained in:
commit
f39b7f2be9
3 changed files with 23 additions and 14 deletions
|
|
@ -1098,17 +1098,20 @@ frappe.views.ListView = class ListView extends frappe.views.BaseList {
|
|||
if (
|
||||
$target.hasClass("filterable") ||
|
||||
$target.hasClass("icon-heart") ||
|
||||
$target.is(":checkbox") ||
|
||||
$target.is("a")
|
||||
$target.is(":checkbox")
|
||||
) {
|
||||
e.stopPropagation();
|
||||
return;
|
||||
}
|
||||
// open form
|
||||
|
||||
// link, let the event be handled via set_route
|
||||
if ($target.is("a")) { return; }
|
||||
|
||||
// clicked on the row, open form
|
||||
const $row = $(e.currentTarget);
|
||||
const link = $row.find(".list-subject a").get(0);
|
||||
if (link) {
|
||||
window.location.href = link.href;
|
||||
frappe.set_route(link.pathname);
|
||||
return false;
|
||||
}
|
||||
});
|
||||
|
|
|
|||
|
|
@ -24,37 +24,41 @@ $(window).on('hashchange', function() {
|
|||
}
|
||||
});
|
||||
|
||||
window.addEventListener('popstate', () => {
|
||||
window.addEventListener('popstate', (e) => {
|
||||
// forward-back button, just re-render based on current route
|
||||
frappe.router.route();
|
||||
e.preventDefault();
|
||||
return false;
|
||||
});
|
||||
|
||||
// routing v2, capture all clicks so that the target is managed with push-state
|
||||
$('body').on('click', 'a', function(e) {
|
||||
let override = (e, route) => {
|
||||
let override = (route) => {
|
||||
e.preventDefault();
|
||||
frappe.set_route(route);
|
||||
return false;
|
||||
};
|
||||
|
||||
// click handled, but not by href
|
||||
if (e.currentTarget.getAttribute('onclick')) return;
|
||||
if (e.currentTarget.getAttribute('onclick')) {
|
||||
return;
|
||||
}
|
||||
|
||||
const href = e.currentTarget.getAttribute('href');
|
||||
if (href==='#') return;
|
||||
|
||||
if (href==='') {
|
||||
return override(e, '/app');
|
||||
return override('/app');
|
||||
}
|
||||
|
||||
// target has "#" ,this is a v1 style route, so remake it.
|
||||
if (e.currentTarget.hash) {
|
||||
return override(e, e.currentTarget.hash);
|
||||
return override(e.currentTarget.hash);
|
||||
}
|
||||
|
||||
// target has "/app, this is a v2 style route.
|
||||
if (e.currentTarget.pathname && frappe.router.is_app_route()) {
|
||||
return override(e, e.currentTarget.pathname);
|
||||
if (e.currentTarget.pathname && frappe.router.is_app_route(e.currentTarget.pathname)) {
|
||||
return override(e.currentTarget.pathname);
|
||||
}
|
||||
});
|
||||
|
||||
|
|
@ -65,9 +69,8 @@ frappe.router = {
|
|||
list_views: ['list', 'kanban', 'report', 'calendar', 'tree', 'gantt', 'dashboard', 'image', 'inbox'],
|
||||
layout_mapped: {},
|
||||
|
||||
is_app_route() {
|
||||
is_app_route(path) {
|
||||
// desk paths must begin with /app or doctype route
|
||||
let path = window.location.pathname;
|
||||
if (path.substr(0, 1) === '/') path = path.substr(1);
|
||||
path = path.split('/');
|
||||
if (path[0]) {
|
||||
|
|
|
|||
|
|
@ -34,7 +34,10 @@ def get_context(context):
|
|||
boot_json = frappe.as_json(boot)
|
||||
|
||||
# remove script tags from boot
|
||||
boot_json = re.sub("\<script\>[^<]*\</script\>", "", boot_json)
|
||||
boot_json = re.sub("\<script[^<]*\</script\>", "", boot_json)
|
||||
|
||||
# TODO: Fix better fix
|
||||
boot_json = re.sub("</script\>", "", boot_json)
|
||||
|
||||
context.update({
|
||||
"no_cache": 1,
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue