diff --git a/frappe/__init__.py b/frappe/__init__.py index f19504b216..68ca5acca7 100644 --- a/frappe/__init__.py +++ b/frappe/__init__.py @@ -7,13 +7,13 @@ globals attached to frappe module from __future__ import unicode_literals from werkzeug.local import Local, release_local -import os, importlib, inspect, json +import os, sys, importlib, inspect, json # public from .exceptions import * from .utils.jinja import get_jenv, get_template, render_template -__version__ = "7.0.9" +__version__ = "7.0.10" local = Local() @@ -755,6 +755,9 @@ def get_hooks(hook=None, default=None, app_name=None): # if app is not installed while restoring # ignore it pass + print 'Could not find app "{0}"'.format(app_name) + if not request: + sys.exit(1) raise for key in dir(app_hooks): if not key.startswith("_"): diff --git a/frappe/commands/utils.py b/frappe/commands/utils.py index 3fc3e508b5..9798458774 100644 --- a/frappe/commands/utils.py +++ b/frappe/commands/utils.py @@ -128,7 +128,7 @@ def add_to_email_queue(context, email_path): with frappe.init_site(site): frappe.connect() for email in os.listdir(email_path): - with open(os.path.join(email_path, email)) as email_data: + with open(os.path.join(email_path, email)) as email_data: kwargs = json.load(email_data) kwargs['delayed'] = True frappe.sendmail(**kwargs) @@ -152,10 +152,10 @@ def export_doc(context, doctype, docname): @click.command('export-json') @click.argument('doctype') -@click.argument('name') @click.argument('path') +@click.option('--name', help='Export only one document') @pass_context -def export_json(context, doctype, name, path): +def export_json(context, doctype, path, name=None): "Export doclist as json to the given path, use '-' as name for Singles." from frappe.core.page.data_import_tool import data_import_tool for site in context.sites: diff --git a/frappe/core/page/data_import_tool/data_import_tool.py b/frappe/core/page/data_import_tool/data_import_tool.py index a567f02333..be66a52b4e 100644 --- a/frappe/core/page/data_import_tool/data_import_tool.py +++ b/frappe/core/page/data_import_tool/data_import_tool.py @@ -63,6 +63,11 @@ def export_json(doctype, path, filters=None, name=None): for doc in frappe.get_all(doctype, fields=["name"], filters=filters, limit_page_length=0, order_by="creation asc"): out.append(frappe.get_doc(doctype, doc.name).as_dict()) post_process(out) + + dirname = os.path.dirname(path) + if not os.path.exists(dirname): + path = os.path.join('..', path) + with open(path, "w") as outfile: outfile.write(frappe.as_json(out)) diff --git a/frappe/installer.py b/frappe/installer.py index 68bffabfb4..32779b5048 100755 --- a/frappe/installer.py +++ b/frappe/installer.py @@ -180,7 +180,7 @@ def remove_app(app_name, dry_run=False): for module_name in frappe.get_module_list(app_name): for doctype in frappe.get_list("DocType", filters={"module": module_name}, fields=["name", "issingle"]): - print "removing {0}...".format(doctype.name) + print "removing DocType {0}...".format(doctype.name) # drop table if not dry_run: @@ -189,7 +189,15 @@ def remove_app(app_name, dry_run=False): if not doctype.issingle: drop_doctypes.append(doctype.name) + for page in frappe.get_list("Page", filters={"module": module_name}): + print "removing Page {0}...".format(page.name) + # drop table + + if not dry_run: + frappe.delete_doc("Page", page.name) + print "removing Module {0}...".format(module_name) + if not dry_run: frappe.delete_doc("Module Def", module_name) diff --git a/frappe/model/rename_doc.py b/frappe/model/rename_doc.py index 4bc3ac2040..a3bf6f6963 100644 --- a/frappe/model/rename_doc.py +++ b/frappe/model/rename_doc.py @@ -89,7 +89,7 @@ def rename_parent_and_child(doctype, old, new, meta): def validate_rename(doctype, new, meta, merge, force, ignore_permissions): # using for update so that it gets locked and someone else cannot edit it while this rename is going on! - exists = frappe.db.sql("select name from `tab{doctype}` where name=%s for update".format(doctype=frappe.db.escape(doctype)), new) + exists = frappe.db.sql("select name from `tab{doctype}` where name=%s COLLATE utf8mb4_unicode_ci for update".format(doctype=frappe.db.escape(doctype)), new) exists = exists[0][0] if exists else None if merge and not exists: diff --git a/frappe/public/css/desk.css b/frappe/public/css/desk.css index df6a0aa0b7..8d946d6d02 100644 --- a/frappe/public/css/desk.css +++ b/frappe/public/css/desk.css @@ -405,10 +405,10 @@ fieldset[disabled] .form-control { .ui-menu .ui-menu-item { font-size: 12px; } -.ui-menu .ui-menu-item a, -.ui-menu .ui-menu-item div { +.ui-menu .ui-menu-item .ui-menu-item-wrapper { padding: 9px 11.8px !important; text-decoration: none; + margin: 0; } @media (min-width: 768px) { .video-modal { diff --git a/frappe/public/css/docs.css b/frappe/public/css/docs.css index ca262cdaf6..e404d9fa2f 100644 --- a/frappe/public/css/docs.css +++ b/frappe/public/css/docs.css @@ -57,16 +57,18 @@ } #search-modal .modal-header { background: #fff; - display: table; width: 100%; } -#search-modal .modal-header form, -#search-modal .modal-header button { - display: table-cell; +#search-modal .modal-header form { vertical-align: middle; } #search-modal .modal-header button { - height: 30px; + line-height: 0; + position: absolute; + right: 0; + top: 0; + z-index: 9; + padding: 9px; } .dropdown-navbar-new-comments > a { border: 0; diff --git a/frappe/public/css/navbar.css b/frappe/public/css/navbar.css index a702a41207..60e906c106 100644 --- a/frappe/public/css/navbar.css +++ b/frappe/public/css/navbar.css @@ -57,16 +57,18 @@ } #search-modal .modal-header { background: #fff; - display: table; width: 100%; } -#search-modal .modal-header form, -#search-modal .modal-header button { - display: table-cell; +#search-modal .modal-header form { vertical-align: middle; } #search-modal .modal-header button { - height: 30px; + line-height: 0; + position: absolute; + right: 0; + top: 0; + z-index: 9; + padding: 9px; } .dropdown-navbar-new-comments > a { border: 0; diff --git a/frappe/public/css/sidebar.css b/frappe/public/css/sidebar.css index f742029c2b..98d99a773b 100644 --- a/frappe/public/css/sidebar.css +++ b/frappe/public/css/sidebar.css @@ -219,7 +219,6 @@ body[data-route^="Module"] .main-menu .form-sidebar { box-shadow: 5px 0 25px 0px rgba(0, 0, 0, 0.3); height: 100%; width: 40%; - padding: 25px; display: block !important; transition: transform 200ms ease-in-out; } @@ -227,11 +226,31 @@ body[data-route^="Module"] .main-menu .form-sidebar { transform: translateX(0); overflow-y: auto; } + .layout-side-section .overlay-sidebar .divider { + height: 1px; + background-color: #d8dfe5; + opacity: 0.7; + } + .layout-side-section .overlay-sidebar li:not(.divider):not(.tagit-new):not(.module-sidebar-item) { + padding: 10px 15px; + } + .layout-side-section .overlay-sidebar .modified-by, + .layout-side-section .overlay-sidebar .created-by { + margin: 0; + } + .layout-side-section .overlay-sidebar .badge { + top: 9px; + right: 15px; + } .layout-side-section .overlay-sidebar .reports-dropdown { - margin: 10px 0; + margin-top: 10px; + margin-bottom: -10px; } .layout-side-section .overlay-sidebar .reports-dropdown li:not(.divider) { - padding: 10px 0; + padding: 12.5px 0 !important; + } + .layout-side-section .overlay-sidebar .reports-dropdown li.divider { + height: 0; } } @media (max-width: 767px) { @@ -260,7 +279,7 @@ body[data-route^="Module"] .main-menu .form-sidebar { padding-right: 0; } .layout-side-section .module-sidebar-nav .module-link { - padding-left: 25px; + padding: 15px 15px 15px 25px; } } .sidebar-left .list-sidebar .stat-label, diff --git a/frappe/public/css/website.css b/frappe/public/css/website.css index ea25145a6c..be733bb491 100644 --- a/frappe/public/css/website.css +++ b/frappe/public/css/website.css @@ -694,8 +694,8 @@ fieldset { background-color: #fafbfc; position: absolute; height: 100%; - width: 4000px; - left: -2000px; + width: 100vw; + left: calc((100vw - 100%)/ -2); z-index: -1; } .blog-comment-row { diff --git a/frappe/public/js/frappe/form/templates/form_sidebar.html b/frappe/public/js/frappe/form/templates/form_sidebar.html index 0017d0b6f5..7233397ffe 100644 --- a/frappe/public/js/frappe/form/templates/form_sidebar.html +++ b/frappe/public/js/frappe/form/templates/form_sidebar.html @@ -36,7 +36,6 @@ diff --git a/frappe/public/js/frappe/list/list_sidebar.html b/frappe/public/js/frappe/list/list_sidebar.html index 5438f39258..4038d91ad7 100644 --- a/frappe/public/js/frappe/list/list_sidebar.html +++ b/frappe/public/js/frappe/list/list_sidebar.html @@ -13,6 +13,7 @@ +
  • diff --git a/frappe/public/js/frappe/ui/toolbar/navbar.html b/frappe/public/js/frappe/ui/toolbar/navbar.html index 6aae9b6189..6d5f4862b1 100644 --- a/frappe/public/js/frappe/ui/toolbar/navbar.html +++ b/frappe/public/js/frappe/ui/toolbar/navbar.html @@ -61,9 +61,9 @@
    +
    - diff --git a/frappe/public/js/frappe/views/reports/query_report.js b/frappe/public/js/frappe/views/reports/query_report.js index f2111720cf..8d65e7e232 100644 --- a/frappe/public/js/frappe/views/reports/query_report.js +++ b/frappe/public/js/frappe/views/reports/query_report.js @@ -201,7 +201,7 @@ frappe.views.QueryReport = Class.extend({ formData.append("blob", blob); var xhr = new XMLHttpRequest(); - xhr.open("POST", '/api/method/frappe.www.print.report_to_pdf'); + xhr.open("POST", '/api/method/frappe.utils.print_format.report_to_pdf'); xhr.setRequestHeader("X-Frappe-CSRF-Token", frappe.csrf_token); xhr.responseType = "arraybuffer"; diff --git a/frappe/public/less/common.less b/frappe/public/less/common.less index 31e3ca03e3..a9d6cdbd5a 100644 --- a/frappe/public/less/common.less +++ b/frappe/public/less/common.less @@ -7,6 +7,10 @@ // font-family: "Open Sans", "Helvetica", Arial, "sans-serif"; // } +html { + // overflow-x: hidden; +} + body { font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Roboto", "Oxygen", "Ubuntu", "Cantarell", diff --git a/frappe/public/less/desk.less b/frappe/public/less/desk.less index 64bf17525e..a3434f3746 100644 --- a/frappe/public/less/desk.less +++ b/frappe/public/less/desk.less @@ -221,9 +221,10 @@ textarea.form-control { .ui-menu .ui-menu-item { font-size: @text-medium; - a, div { + .ui-menu-item-wrapper{ padding: 9px 11.8px !important; text-decoration: none; + margin: 0; } } diff --git a/frappe/public/less/navbar.less b/frappe/public/less/navbar.less index fbc96336cc..51435ed1dd 100644 --- a/frappe/public/less/navbar.less +++ b/frappe/public/less/navbar.less @@ -69,15 +69,19 @@ } .modal-header { background: #fff; - display: table; width: 100%; - form, button { - display: table-cell; + form { vertical-align: middle; } + button { - height: 30px; + line-height: 0; + position: absolute; + right: 0; + top: 0; + z-index: 9; + padding: 9px; } } } diff --git a/frappe/public/less/sidebar.less b/frappe/public/less/sidebar.less index 2baae84691..655b2e3604 100644 --- a/frappe/public/less/sidebar.less +++ b/frappe/public/less/sidebar.less @@ -288,7 +288,6 @@ body[data-route^="Module"] .main-menu { box-shadow: 5px 0 25px 0px rgba(0,0,0,0.3); height: 100%; width: 40%; - padding: 25px; display: block !important; transition: transform 200ms ease-in-out; @@ -297,11 +296,35 @@ body[data-route^="Module"] .main-menu { overflow-y: auto; } + .divider { + height: 1px; + background-color: #d8dfe5; + opacity: 0.7; + } + + li:not(.divider):not(.tagit-new):not(.module-sidebar-item) { + padding: 10px 15px; + } + + .modified-by, .created-by { + margin: 0; + } + + .badge { + top: 9px; + right: 15px; + } + .reports-dropdown { - margin: 10px 0; + margin-top: 10px; + margin-bottom: -10px; li:not(.divider) { - padding: 10px 0; + padding: 12.5px 0 !important; + } + + li.divider { + height: 0; } } } @@ -334,7 +357,7 @@ body[data-route^="Module"] .main-menu { padding-right: 0; .module-link { - padding-left: 25px; + padding: 15px 15px 15px 25px; } } } diff --git a/frappe/public/less/website.less b/frappe/public/less/website.less index ddb4b1d04e..1175be249b 100644 --- a/frappe/public/less/website.less +++ b/frappe/public/less/website.less @@ -405,8 +405,8 @@ fieldset { background-color: @light-bg; position: absolute; height: 100%; - width: 4000px; - left: -2000px; + width: 100vw; + left: ~"calc((100vw - 100%)/ -2)"; z-index: -1; } diff --git a/socketio.js b/socketio.js index a2f7251e85..316b7f73d9 100644 --- a/socketio.js +++ b/socketio.js @@ -171,12 +171,14 @@ function get_task_room(socket, task_id) { } function get_site_name(socket) { - if (conf.default_site) { - return conf.default_site; - } - else if (socket.request.headers['x-frappe-site-name']) { + if (socket.request.headers['x-frappe-site-name']) { return get_hostname(socket.request.headers['x-frappe-site-name']); } + else if (['localhost', '127.0.0.1'].indexOf(socket.request.headers.host) !== -1 + && conf.default_site) { + // from currentsite.txt since host is localhost + return conf.default_site; + } else if (socket.request.headers.origin) { return get_hostname(socket.request.headers.origin); }