@@ -90,6 +90,33 @@ | |||
"set_only_once": 0, | |||
"unique": 0 | |||
}, | |||
{ | |||
"allow_on_submit": 0, | |||
"bold": 0, | |||
"collapsible": 0, | |||
"default": "1", | |||
"depends_on": "istable", | |||
"fieldname": "editable_grid", | |||
"fieldtype": "Check", | |||
"hidden": 0, | |||
"ignore_user_permissions": 0, | |||
"ignore_xss_filter": 0, | |||
"in_filter": 0, | |||
"in_list_view": 0, | |||
"label": "Editable Grid", | |||
"length": 0, | |||
"no_copy": 0, | |||
"permlevel": 0, | |||
"precision": "", | |||
"print_hide": 0, | |||
"print_hide_if_no_value": 0, | |||
"read_only": 0, | |||
"report_hide": 0, | |||
"reqd": 0, | |||
"search_index": 0, | |||
"set_only_once": 0, | |||
"unique": 0 | |||
}, | |||
{ | |||
"allow_on_submit": 0, | |||
"bold": 0, | |||
@@ -244,8 +271,8 @@ | |||
"allow_on_submit": 0, | |||
"bold": 0, | |||
"collapsible": 0, | |||
"default": "0", | |||
"depends_on": "eval: doc.image_field", | |||
"default": 0, | |||
"fieldname": "image_view", | |||
"fieldtype": "Check", | |||
"hidden": 0, | |||
@@ -1119,13 +1146,14 @@ | |||
"hide_toolbar": 0, | |||
"icon": "icon-bolt", | |||
"idx": 6, | |||
"image_view": 0, | |||
"in_create": 0, | |||
"in_dialog": 0, | |||
"is_submittable": 0, | |||
"issingle": 0, | |||
"istable": 0, | |||
"max_attachments": 0, | |||
"modified": "2016-06-01 12:28:01.048158", | |||
"modified": "2016-07-08 04:38:09.088871", | |||
"modified_by": "Administrator", | |||
"module": "Core", | |||
"name": "DocType", | |||
@@ -9,6 +9,7 @@ | |||
"docstatus": 0, | |||
"doctype": "DocType", | |||
"document_type": "Document", | |||
"editable_grid": 1, | |||
"fields": [ | |||
{ | |||
"allow_on_submit": 0, | |||
@@ -134,6 +135,57 @@ | |||
"set_only_once": 0, | |||
"unique": 0 | |||
}, | |||
{ | |||
"allow_on_submit": 0, | |||
"bold": 0, | |||
"collapsible": 0, | |||
"fieldname": "istable", | |||
"fieldtype": "Check", | |||
"hidden": 0, | |||
"ignore_user_permissions": 0, | |||
"ignore_xss_filter": 0, | |||
"in_filter": 0, | |||
"in_list_view": 0, | |||
"label": "Is Table", | |||
"length": 0, | |||
"no_copy": 0, | |||
"permlevel": 0, | |||
"precision": "", | |||
"print_hide": 0, | |||
"print_hide_if_no_value": 0, | |||
"read_only": 1, | |||
"report_hide": 0, | |||
"reqd": 0, | |||
"search_index": 0, | |||
"set_only_once": 0, | |||
"unique": 0 | |||
}, | |||
{ | |||
"allow_on_submit": 0, | |||
"bold": 0, | |||
"collapsible": 0, | |||
"depends_on": "istable", | |||
"fieldname": "editable_grid", | |||
"fieldtype": "Check", | |||
"hidden": 0, | |||
"ignore_user_permissions": 0, | |||
"ignore_xss_filter": 0, | |||
"in_filter": 0, | |||
"in_list_view": 0, | |||
"label": "Editable Grid", | |||
"length": 0, | |||
"no_copy": 0, | |||
"permlevel": 0, | |||
"precision": "", | |||
"print_hide": 0, | |||
"print_hide_if_no_value": 0, | |||
"read_only": 0, | |||
"report_hide": 0, | |||
"reqd": 0, | |||
"search_index": 0, | |||
"set_only_once": 0, | |||
"unique": 0 | |||
}, | |||
{ | |||
"allow_on_submit": 0, | |||
"bold": 0, | |||
@@ -448,7 +500,7 @@ | |||
"issingle": 1, | |||
"istable": 0, | |||
"max_attachments": 0, | |||
"modified": "2016-06-01 12:29:28.272410", | |||
"modified": "2016-07-08 04:40:57.045612", | |||
"modified_by": "Administrator", | |||
"module": "Custom", | |||
"name": "Customize Form", | |||
@@ -22,7 +22,9 @@ doctype_properties = { | |||
'default_print_format': 'Data', | |||
'read_only_onload': 'Check', | |||
'allow_copy': 'Check', | |||
'istable': 'Check', | |||
'quick_entry': 'Check', | |||
'editable_grid': 'Check', | |||
'max_attachments': 'Int', | |||
'image_view': 'Check' | |||
} | |||
@@ -112,6 +112,7 @@ CREATE TABLE `tabDocType` ( | |||
`search_fields` varchar(255) DEFAULT NULL, | |||
`issingle` int(1) NOT NULL DEFAULT 0, | |||
`istable` int(1) NOT NULL DEFAULT 0, | |||
`editable_grid` int(1) NOT NULL DEFAULT 1, | |||
`module` varchar(255) DEFAULT NULL, | |||
`app` varchar(255) DEFAULT NULL, | |||
`autoname` varchar(255) DEFAULT NULL, | |||
@@ -25,7 +25,7 @@ | |||
margin: 0px; | |||
} | |||
.data-row textarea { | |||
height: 40px !important; | |||
height: 40px; | |||
} | |||
.grid-body { | |||
background-color: #fff; | |||
@@ -76,10 +76,18 @@ | |||
margin-top: 7px; | |||
} | |||
.grid-body .editable-row .btn-open-row { | |||
margin-top: 0px; | |||
padding: 5px 17px; | |||
margin: -10px -4px; | |||
padding: 15px 6px; | |||
margin-right: -20px; | |||
} | |||
.grid-body .editable-row .checkbox { | |||
margin: 0px; | |||
margin-right: -7px; | |||
text-align: center; | |||
} | |||
.grid-body .editable-row textarea { | |||
height: none; | |||
} | |||
.grid-body .editable-row .field-area { | |||
margin-right: -11px; | |||
margin-top: -1px; | |||
@@ -26,13 +26,6 @@ frappe.ui.form.Grid = Class.extend({ | |||
this.template = this.frm.meta.__form_grid_templates[this.df.fieldname]; | |||
} | |||
// set rows editable if less that 4 fields and no text, image, button, html field | |||
if(this.meta.fields.length < 4 && !has_common(['Text', 'Small Text', 'Image', | |||
'Text Editor', 'HTML', 'Section Break', 'Column Break'], | |||
$.map(this.meta.fields, function(f) { return f.fieldtype }))) { | |||
this.on_grid_editing = true; | |||
} | |||
this.is_grid = true; | |||
}, | |||
@@ -42,7 +35,7 @@ frappe.ui.form.Grid = Class.extend({ | |||
} else if(this.editable_fields) { | |||
return true; | |||
} else { | |||
return this.on_grid_editing; | |||
return this.meta.editable_grid; | |||
} | |||
}, | |||
make: function() { | |||
@@ -620,9 +613,13 @@ frappe.ui.form.GridRow = Class.extend({ | |||
// remove row | |||
if(!this.remove_row) { | |||
this.remove_row = $('<a class="close pull-right btn-open-row">\ | |||
<span class="octicon octicon-chevron-down"</a>') | |||
<span class="octicon octicon-chevron-down"></span></a>') | |||
.appendTo(this.row) | |||
.on('click', function() { me.toggle_view(); return false; }); | |||
if(this.row.width() < 400) { | |||
this.remove_row.css({'padding-right': '3px'}); | |||
} | |||
} | |||
} | |||
} | |||
@@ -88,14 +88,12 @@ frappe.msgprint = function(msg, title) { | |||
} | |||
} | |||
if(!data.indicator) { | |||
data.indicator = 'blue'; | |||
} | |||
if(data.message instanceof Array) { | |||
$.each(data.message, function(i,v) { | |||
if(v) { | |||
msgprint(v); | |||
} | |||
}) | |||
return; | |||
data.message = $.map(data.message, function(m) { return '<p>' + m + '</p>'}).join(''); | |||
} | |||
if(data.alert) { | |||
@@ -30,7 +30,7 @@ | |||
} | |||
.data-row textarea { | |||
height: 40px !important; | |||
height: 40px; | |||
} | |||
.grid-body { | |||
@@ -95,11 +95,21 @@ | |||
} | |||
.btn-open-row { | |||
margin-top: 0px; | |||
padding: 5px 17px; | |||
margin: -10px -4px; | |||
padding: 15px 6px; | |||
margin-right: -20px; | |||
} | |||
.checkbox { | |||
margin: 0px; | |||
margin-right: -7px; | |||
text-align: center; | |||
} | |||
textarea { | |||
height: none; | |||
} | |||
.field-area { | |||
margin-right: -11px; | |||
margin-top: -1px; | |||