@@ -164,7 +164,7 @@ def get_data(): | |||||
{ | { | ||||
"type": "doctype", | "type": "doctype", | ||||
"name": "Print Format", | "name": "Print Format", | ||||
"description": _("Customized HTML Templates for printing transctions.") | |||||
"description": _("Customized HTML Templates for printing transactions.") | |||||
}, | }, | ||||
] | ] | ||||
}, | }, | ||||
@@ -32,7 +32,10 @@ | |||||
margin: 0px; | margin: 0px; | ||||
padding: 15px; | padding: 15px; | ||||
} | } | ||||
.form-section:nth-child(even), | |||||
.empty-section { | |||||
display: none !important; | |||||
} | |||||
.shaded-section, | |||||
.timeline-item:nth-child(even) { | .timeline-item:nth-child(even) { | ||||
background-color: #fafbfc; | background-color: #fafbfc; | ||||
} | } | ||||
@@ -117,6 +120,9 @@ | |||||
.frappe-control .help-box { | .frappe-control .help-box { | ||||
margin-top: 3px; | margin-top: 3px; | ||||
} | } | ||||
.hide-control { | |||||
display: none !important; | |||||
} | |||||
.shared-user { | .shared-user { | ||||
margin-bottom: 10px; | margin-bottom: 10px; | ||||
} | } | ||||
@@ -41,6 +41,11 @@ | |||||
border-color: #d1d8dd !important; | border-color: #d1d8dd !important; | ||||
color: #8d99a6 !important; | color: #8d99a6 !important; | ||||
} | } | ||||
.slick-header-column:hover, | |||||
.slick-header-column-active { | |||||
background-image: none; | |||||
background-color: #d9e7f1; | |||||
} | |||||
.slick-row.odd .slick-cell { | .slick-row.odd .slick-cell { | ||||
background-color: #fafbfc; | background-color: #fafbfc; | ||||
} | } |
@@ -57,7 +57,7 @@ frappe.ui.form.Control = Class.extend({ | |||||
refresh: function() { | refresh: function() { | ||||
this.disp_status = this.get_status(); | this.disp_status = this.get_status(); | ||||
this.$wrapper | this.$wrapper | ||||
&& this.$wrapper.toggle(this.disp_status!="None") | |||||
&& this.$wrapper.toggleClass("hide-control", this.disp_status=="None") | |||||
&& this.$wrapper.trigger("refresh"); | && this.$wrapper.trigger("refresh"); | ||||
}, | }, | ||||
get_doc: function() { | get_doc: function() { | ||||
@@ -524,7 +524,7 @@ frappe.ui.form.GridRow = Class.extend({ | |||||
$.extend(me.fields_dict[fieldname], fi); | $.extend(me.fields_dict[fieldname], fi); | ||||
} | } | ||||
this.toggle_add_delete_button_display(this.wrapper.find(".panel:first")); | |||||
this.toggle_add_delete_button_display(this.wrapper); | |||||
this.grid.open_grid_row = this; | this.grid.open_grid_row = this; | ||||
this.frm.script_manager.trigger(this.doc.parentfield + "_on_form_rendered", this); | this.frm.script_manager.trigger(this.doc.parentfield + "_on_form_rendered", this); | ||||
@@ -68,6 +68,9 @@ frappe.ui.form.Layout = Class.extend({ | |||||
// dependent fields | // dependent fields | ||||
this.refresh_dependency(); | this.refresh_dependency(); | ||||
// refresh sections | |||||
this.refresh_sections(); | |||||
}, | }, | ||||
render: function() { | render: function() { | ||||
var me = this; | var me = this; | ||||
@@ -188,14 +191,41 @@ frappe.ui.form.Layout = Class.extend({ | |||||
wrapper: section | wrapper: section | ||||
}; | }; | ||||
section.refresh = function() { | section.refresh = function() { | ||||
if(!this.df) return; | |||||
$(this).toggle(this.df.hidden || this.df.hidden_due_to_dependency | |||||
? false : (me.frm ? !!me.frm.get_perm(this.df.permlevel, "read") : true)); | |||||
if(!this.df) | |||||
return; | |||||
// hide if explictly hidden | |||||
var hide = this.df.hidden || this.df.hidden_due_to_dependency; | |||||
// hide if no perm | |||||
if(!hide && me.frm && !me.frm.get_perm(this.df.permlevel || 0, "read")) { | |||||
hide = true; | |||||
} | |||||
$(this).toggleClass("hide-control", !!hide); | |||||
} | } | ||||
this.column = null; | this.column = null; | ||||
section.refresh.call(section); | section.refresh.call(section); | ||||
return this.section; | return this.section; | ||||
}, | }, | ||||
refresh_sections: function() { | |||||
var cnt = 0; | |||||
this.wrapper.find(".form-section:not(.hide-control)").each(function() { | |||||
var $this = $(this).removeClass("empty-section") | |||||
.removeClass("visible-section") | |||||
.removeClass("shaded-section"); | |||||
if(!$(this).find(".frappe-control:not(.hide-control)").length) { | |||||
// nothing visible, hide the section | |||||
$(this).addClass("empty-section"); | |||||
} else { | |||||
$(this).addClass("visible-section"); | |||||
if(cnt % 2) { | |||||
$(this).addClass("shaded-section"); | |||||
} | |||||
cnt ++; | |||||
} | |||||
}); | |||||
}, | |||||
refresh_section_count: function() { | refresh_section_count: function() { | ||||
this.wrapper.find(".section-count-label:visible").each(function(i) { | this.wrapper.find(".section-count-label:visible").each(function(i) { | ||||
$(this).html(i+1); | $(this).html(i+1); | ||||
@@ -100,9 +100,14 @@ frappe.search.verbs = [ | |||||
function(txt) { | function(txt) { | ||||
var route = frappe.get_route(); | var route = frappe.get_route(); | ||||
if(route[0]==="List" && txt.indexOf(" in") === -1) { | if(route[0]==="List" && txt.indexOf(" in") === -1) { | ||||
// search in title field | |||||
var meta = frappe.get_meta(frappe.container.page.doclistview.doctype); | |||||
var search_field = meta.title_field || "name"; | |||||
var options = {}; | |||||
options[search_field] = ["like", "%" + txt + "%"]; | |||||
frappe.search.options.push({ | frappe.search.options.push({ | ||||
value: __('Find {0} in {1}', ["<b>"+txt+"</b>", "<b>" + route[1] + "</b>"]), | value: __('Find {0} in {1}', ["<b>"+txt+"</b>", "<b>" + route[1] + "</b>"]), | ||||
route_options: {"name": ["like", "%" + txt + "%"]}, | |||||
route_options: options, | |||||
onclick: function() { | onclick: function() { | ||||
frappe.container.page.doclistview.set_route_options(); | frappe.container.page.doclistview.set_route_options(); | ||||
}, | }, | ||||
@@ -214,10 +214,6 @@ _f.Frm.prototype.watch_model_updates = function() { | |||||
}); | }); | ||||
} | } | ||||
_f.Frm.prototype.onhide = function() { | |||||
if(_f.cur_grid_cell) _f.cur_grid_cell.grid.cell_deselect(); | |||||
} | |||||
_f.Frm.prototype.setup_std_layout = function() { | _f.Frm.prototype.setup_std_layout = function() { | ||||
this.form_wrapper = $('<div></div>').appendTo(this.layout_main); | this.form_wrapper = $('<div></div>').appendTo(this.layout_main); | ||||
this.inner_toolbar = $('<div class="form-inner-toolbar hide"></div>').appendTo(this.form_wrapper); | this.inner_toolbar = $('<div class="form-inner-toolbar hide"></div>').appendTo(this.form_wrapper); | ||||
@@ -306,11 +302,6 @@ _f.Frm.prototype.setup_meta = function(doctype) { | |||||
if(this.meta.istable) { this.meta.in_dialog = 1 } | if(this.meta.istable) { this.meta.in_dialog = 1 } | ||||
} | } | ||||
_f.Frm.prototype.defocus_rest = function() { | |||||
// deselect others | |||||
if(_f.cur_grid_cell) _f.cur_grid_cell.grid.cell_deselect(); | |||||
} | |||||
_f.Frm.prototype.refresh_header = function() { | _f.Frm.prototype.refresh_header = function() { | ||||
// set title | // set title | ||||
// main title | // main title | ||||
@@ -493,6 +484,7 @@ _f.Frm.prototype.setnewdoc = function() { | |||||
// this.check_doctype_conflict(docname); | // this.check_doctype_conflict(docname); | ||||
var me = this; | var me = this; | ||||
// hide any open grid | |||||
this.script_manager.trigger("before_load", this.doctype, this.docname, function() { | this.script_manager.trigger("before_load", this.doctype, this.docname, function() { | ||||
me.script_manager.trigger("onload"); | me.script_manager.trigger("onload"); | ||||
me.opendocs[me.docname] = true; | me.opendocs[me.docname] = true; | ||||
@@ -562,6 +554,9 @@ _f.Frm.prototype.save = function(save_action, callback, btn, on_error) { | |||||
btn && $(btn).prop("disabled", true); | btn && $(btn).prop("disabled", true); | ||||
$(document.activeElement).blur(); | $(document.activeElement).blur(); | ||||
var open_form = frappe.ui.form.get_open_grid_form(); | |||||
open_form && open_form.hide_form(); | |||||
// let any pending js process finish | // let any pending js process finish | ||||
var me = this; | var me = this; | ||||
setTimeout(function() { me._save(save_action, callback, btn, on_error) }, 100); | setTimeout(function() { me._save(save_action, callback, btn, on_error) }, 100); | ||||
@@ -43,7 +43,11 @@ | |||||
padding: 15px; | padding: 15px; | ||||
} | } | ||||
.form-section:nth-child(even), .timeline-item:nth-child(even) { | |||||
.empty-section { | |||||
display: none !important; | |||||
} | |||||
.shaded-section, .timeline-item:nth-child(even) { | |||||
background-color: @light-bg; | background-color: @light-bg; | ||||
} | } | ||||
@@ -123,7 +127,6 @@ | |||||
font-weight: bold; | font-weight: bold; | ||||
} | } | ||||
.control-label, .grid-heading-row { | .control-label, .grid-heading-row { | ||||
color: @text-muted; | color: @text-muted; | ||||
font-size: 85%; | font-size: 85%; | ||||
@@ -152,6 +155,10 @@ | |||||
} | } | ||||
} | } | ||||
.hide-control { | |||||
display: none !important; | |||||
} | |||||
.shared-user { | .shared-user { | ||||
margin-bottom: 10px; | margin-bottom: 10px; | ||||
} | } | ||||
@@ -46,6 +46,10 @@ | |||||
border-color: @border-color !important; | border-color: @border-color !important; | ||||
color: @text-muted !important; | color: @text-muted !important; | ||||
} | } | ||||
.slick-header-column:hover, .slick-header-column-active { | |||||
background-image: none; | |||||
background-color: darken(@panel-bg, 8%); | |||||
} | |||||
.slick-row.odd .slick-cell { | .slick-row.odd .slick-cell { | ||||
background-color: @light-bg; | background-color: @light-bg; | ||||