Merge branch 'rebrand-ui' of https://github.com/frappe/frappe into rebrand-ui

This commit is contained in:
prssanna 2021-01-18 14:16:14 +05:30
commit a10623bc71
5 changed files with 64 additions and 48 deletions

View file

@ -948,10 +948,6 @@ def get_installed_apps(sort=False, frappe_last=False):
if not local.all_apps:
local.all_apps = cache().get_value('all_apps', get_all_apps)
#cache bench apps
if not cache().get_value('all_apps'):
cache().set_value('all_apps', local.all_apps)
installed = json.loads(db.get_global("installed_apps") or "[]")
if sort:

View file

@ -13,7 +13,7 @@ common_default_keys = ["__default", "__global"]
doctype_map_keys = ('energy_point_rule_map', 'assignment_rule_map',
'milestone_tracker_map', 'event_consumer_document_type_map')
global_cache_keys = ("app_hooks", "installed_apps",
global_cache_keys = ("app_hooks", "installed_apps", 'all_apps',
"app_modules", "module_app", "system_settings",
'scheduler_events', 'time_zone', 'webhooks', 'active_domains',
'active_modules', 'assignment_rule', 'server_script_map', 'wkhtmltopdf_version',

View file

@ -4,6 +4,15 @@
frappe.provide("frappe.customize_form");
frappe.ui.form.on("Customize Form", {
setup: function(frm) {
// save the last setting if refreshing
window.addEventListener('beforeunload', (event) => {
if (frm.doc.doc_type && frm.doc.doc_type!='undefined') {
localStorage['customize_doctype'] = frm.doc.doc_type;
}
});
},
onload: function(frm) {
frm.disable_save();
frm.set_query("doc_type", function() {
@ -40,12 +49,6 @@ frappe.ui.form.on("Customize Form", {
$(frm.wrapper).on("grid-move-row", function(e, frm) {
frm.trigger("setup_sortable");
});
if (localStorage['customize_doctype']) {
// set default value from customize form
frm.set_value('doc_type', localStorage['customize_doctype']);
}
},
doc_type: function(frm) {
@ -59,7 +62,6 @@ frappe.ui.form.on("Customize Form", {
if (r._server_messages && r._server_messages.length) {
frm.set_value("doc_type", "");
} else {
localStorage['customize_doctype'] = frm.doc.doc_type;
frm.refresh();
frm.trigger("setup_sortable");
}
@ -113,33 +115,58 @@ frappe.ui.form.on("Customize Form", {
frappe.set_route('permission-manager', frm.doc.doc_type);
}, __('Actions'));
if (frappe.boot.developer_mode) {
frm.add_custom_button(__('Export Customizations'), function() {
frappe.prompt(
[
{fieldtype:'Link', fieldname:'module', options:'Module Def',
label: __('Module to Export')},
{fieldtype:'Check', fieldname:'sync_on_migrate',
label: __('Sync on Migrate'), 'default': 1},
{fieldtype:'Check', fieldname:'with_permissions',
label: __('Export Custom Permissions'), 'default': 1},
],
function(data) {
frappe.call({
method: 'frappe.modules.utils.export_customizations',
args: {
doctype: frm.doc.doc_type,
module: data.module,
sync_on_migrate: data.sync_on_migrate,
with_permissions: data.with_permissions
}
});
},
__("Select Module"));
}, __('Actions'));
}
}
frm.events.setup_export(frm);
frm.events.setup_sort_order(frm);
frm.events.set_default_doc_type(frm);
},
set_default_doc_type(frm) {
let doc_type;
if (frappe.route_options && frappe.route_options.doc_type) {
doc_type = frappe.route_options.doc_type;
frappe.route_options = null;
localStorage.removeItem('customize_doctype');
}
if (!doc_type) {
doc_type = localStorage.getItem('customize_doctype');
}
if (doc_type) {
setTimeout(() => frm.set_value("doc_type", doc_type), 1000);
}
},
setup_export(frm) {
if (frappe.boot.developer_mode) {
frm.add_custom_button(__('Export Customizations'), function() {
frappe.prompt(
[
{fieldtype:'Link', fieldname:'module', options:'Module Def',
label: __('Module to Export')},
{fieldtype:'Check', fieldname:'sync_on_migrate',
label: __('Sync on Migrate'), 'default': 1},
{fieldtype:'Check', fieldname:'with_permissions',
label: __('Export Custom Permissions'), 'default': 1},
],
function(data) {
frappe.call({
method: 'frappe.modules.utils.export_customizations',
args: {
doctype: frm.doc.doc_type,
module: data.module,
sync_on_migrate: data.sync_on_migrate,
with_permissions: data.with_permissions
}
});
},
__("Select Module"));
}, __('Actions'));
}
},
setup_sort_order(frm) {
// sort order select
if (frm.doc.doc_type) {
var fields = $.map(frm.doc.fields,
@ -149,13 +176,6 @@ frappe.ui.form.on("Customize Form", {
fields = ["", "name", "modified"].concat(fields);
frm.set_df_property("sort_field", "options", fields);
}
if (frappe.route_options && frappe.route_options.doc_type) {
setTimeout(function() {
frm.set_value("doc_type", frappe.route_options.doc_type);
frappe.route_options = null;
}, 1000);
}
}
});

View file

@ -97,7 +97,7 @@ frappe.socketio = {
frappe.socketio.form_stopped_typing(frm.doctype, frm.docname);
});
window.onbeforeunload = function() {
window.addEventListener('beforeunload', (event) => {
if (!cur_frm || cur_frm.is_new()) {
return;
}
@ -106,7 +106,7 @@ frappe.socketio = {
if (cur_frm.doc) {
frappe.socketio.doc_close(cur_frm.doctype, cur_frm.docname);
}
}
});
},
get_host: function(port = 3000) {
var host = window.location.origin;

View file

@ -55,12 +55,12 @@ hr {
}
.body-content {
padding: 60px 0;
padding: 60px 40px;
}
}
.email-container {
max-width: 400px;
max-width: 600px;
border-spacing: 0;
padding: 30px;
border-radius: $border-radius-lg;