Browse Source

[fixes] various

version-14
Rushabh Mehta 10 years ago
parent
commit
2ad5612b56
10 changed files with 71 additions and 19 deletions
  1. +1
    -1
      frappe/config/setup.py
  2. +7
    -1
      frappe/public/css/form.css
  3. +5
    -0
      frappe/public/css/slickgrid.css
  4. +1
    -1
      frappe/public/js/frappe/form/control.js
  5. +1
    -1
      frappe/public/js/frappe/form/grid.js
  6. +33
    -3
      frappe/public/js/frappe/form/layout.js
  7. +6
    -1
      frappe/public/js/frappe/ui/toolbar/awesome_bar.js
  8. +4
    -9
      frappe/public/js/legacy/form.js
  9. +9
    -2
      frappe/public/less/form.less
  10. +4
    -0
      frappe/public/less/slickgrid.less

+ 1
- 1
frappe/config/setup.py View File

@@ -164,7 +164,7 @@ def get_data():
{
"type": "doctype",
"name": "Print Format",
"description": _("Customized HTML Templates for printing transctions.")
"description": _("Customized HTML Templates for printing transactions.")
},
]
},


+ 7
- 1
frappe/public/css/form.css View File

@@ -32,7 +32,10 @@
margin: 0px;
padding: 15px;
}
.form-section:nth-child(even),
.empty-section {
display: none !important;
}
.shaded-section,
.timeline-item:nth-child(even) {
background-color: #fafbfc;
}
@@ -117,6 +120,9 @@
.frappe-control .help-box {
margin-top: 3px;
}
.hide-control {
display: none !important;
}
.shared-user {
margin-bottom: 10px;
}


+ 5
- 0
frappe/public/css/slickgrid.css View File

@@ -41,6 +41,11 @@
border-color: #d1d8dd !important;
color: #8d99a6 !important;
}
.slick-header-column:hover,
.slick-header-column-active {
background-image: none;
background-color: #d9e7f1;
}
.slick-row.odd .slick-cell {
background-color: #fafbfc;
}

+ 1
- 1
frappe/public/js/frappe/form/control.js View File

@@ -57,7 +57,7 @@ frappe.ui.form.Control = Class.extend({
refresh: function() {
this.disp_status = this.get_status();
this.$wrapper
&& this.$wrapper.toggle(this.disp_status!="None")
&& this.$wrapper.toggleClass("hide-control", this.disp_status=="None")
&& this.$wrapper.trigger("refresh");
},
get_doc: function() {


+ 1
- 1
frappe/public/js/frappe/form/grid.js View File

@@ -524,7 +524,7 @@ frappe.ui.form.GridRow = Class.extend({
$.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.frm.script_manager.trigger(this.doc.parentfield + "_on_form_rendered", this);


+ 33
- 3
frappe/public/js/frappe/form/layout.js View File

@@ -68,6 +68,9 @@ frappe.ui.form.Layout = Class.extend({

// dependent fields
this.refresh_dependency();

// refresh sections
this.refresh_sections();
},
render: function() {
var me = this;
@@ -188,14 +191,41 @@ frappe.ui.form.Layout = Class.extend({
wrapper: section
};
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;
section.refresh.call(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() {
this.wrapper.find(".section-count-label:visible").each(function(i) {
$(this).html(i+1);


+ 6
- 1
frappe/public/js/frappe/ui/toolbar/awesome_bar.js View File

@@ -100,9 +100,14 @@ frappe.search.verbs = [
function(txt) {
var route = frappe.get_route();
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({
value: __('Find {0} in {1}', ["<b>"+txt+"</b>", "<b>" + route[1] + "</b>"]),
route_options: {"name": ["like", "%" + txt + "%"]},
route_options: options,
onclick: function() {
frappe.container.page.doclistview.set_route_options();
},


+ 4
- 9
frappe/public/js/legacy/form.js View File

@@ -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() {
this.form_wrapper = $('<div></div>').appendTo(this.layout_main);
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 }
}

_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() {
// set title
// main title
@@ -493,6 +484,7 @@ _f.Frm.prototype.setnewdoc = function() {
// this.check_doctype_conflict(docname);
var me = this;

// hide any open grid
this.script_manager.trigger("before_load", this.doctype, this.docname, function() {
me.script_manager.trigger("onload");
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);
$(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
var me = this;
setTimeout(function() { me._save(save_action, callback, btn, on_error) }, 100);


+ 9
- 2
frappe/public/less/form.less View File

@@ -43,7 +43,11 @@
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;
}

@@ -123,7 +127,6 @@
font-weight: bold;
}


.control-label, .grid-heading-row {
color: @text-muted;
font-size: 85%;
@@ -152,6 +155,10 @@
}
}

.hide-control {
display: none !important;
}

.shared-user {
margin-bottom: 10px;
}


+ 4
- 0
frappe/public/less/slickgrid.less View File

@@ -46,6 +46,10 @@
border-color: @border-color !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 {
background-color: @light-bg;


Loading…
Cancel
Save