diff --git a/core/page/data_import_tool/data_import_tool.py b/core/page/data_import_tool/data_import_tool.py index fc4236dc8b..80c5ae3554 100644 --- a/core/page/data_import_tool/data_import_tool.py +++ b/core/page/data_import_tool/data_import_tool.py @@ -483,7 +483,7 @@ def import_file_by_path(path, ignore_links=False, overwrite=False): def export_csv(doctype, path): with open(path, "w") as csvfile: get_template(doctype=doctype, all_doctypes="Yes", with_data="Yes") - csvfile.write(webnotes.response.result) + csvfile.write(webnotes.response.result.encode("utf-8")) def export_json(doctype, name, path): from webnotes.handler import json_handler diff --git a/public/css/common.css b/public/css/common.css index 39a9f6c271..b0b307e2b2 100644 --- a/public/css/common.css +++ b/public/css/common.css @@ -170,17 +170,17 @@ div#freeze { background-color: #e7e7e7; } -.appframe-titlebar .container { - display: table; -} - - .titlebar-item { - display: table-cell; - vertical-align: middle; - width: 33.3333%; + padding-top: 10px; + padding-bottom: 10px; } +.titlebar-center-item { + padding-top: 0px; + padding-bottom: 0px; +} + + .appframe-header { margin-bottom: 20px; } @@ -227,6 +227,7 @@ div#freeze { .appframe-form input, .appframe-form select, .appframe-form label { font-size: 90%; + padding: 4px; } .appframe-form .form-group { @@ -234,7 +235,7 @@ div#freeze { } .appframe-form .form-control { - height: 20px; + height: 28px; } .iconbar { @@ -541,8 +542,6 @@ textarea.form-control { } .toolbar-banner { - margin-top: -20px; - margin-bottom: 20px; text-align: center; background-color: #fcf8e3; padding: 7px; diff --git a/public/js/wn/form/toolbar.js b/public/js/wn/form/toolbar.js index e90fdb532d..effb8b3f97 100644 --- a/public/js/wn/form/toolbar.js +++ b/public/js/wn/form/toolbar.js @@ -20,6 +20,7 @@ wn.ui.form.Toolbar = Class.extend({ } else { this.appframe.iconbar.clear(1) this.make_file_menu(); + this.make_cancel_amend_button(); this.show_infobar(); if(this.frm.doc.__islocal) { this.appframe.iconbar.hide(2); @@ -91,6 +92,25 @@ wn.ui.form.Toolbar = Class.extend({ me.frm.save('Save', null, this);}, 'icon-save'); } + // Submit + if(docstatus==0 && !this.frm.doc.__unsaved && p[SUBMIT] && !this.read_only) { + this.appframe.add_dropdown_button("File", wn._("Submit"), function() { + me.frm.savesubmit(this);}, 'icon-lock'); + } + + // Cancel + if(docstatus==1 && p[CANCEL] && !this.read_only) { + this.appframe.add_dropdown_button("File", wn._("Cancel"), function() { + me.frm.savecancel(this);}, 'icon-remove'); + } + + // Amend + if(docstatus==2 && p[AMEND] && !this.read_only) { + this.appframe.add_dropdown_button("File", wn._("Amend"), function() { + me.frm.amend_doc();}, 'icon-pencil'); + this.appframe.set_title_right("Amend", function() { me.frm.amend_doc(); }); + } + // Print if(!(me.frm.doc.__islocal || me.frm.meta.allow_print)) { this.appframe.add_dropdown_button("File", wn._("Print..."), function() { @@ -154,14 +174,22 @@ wn.ui.form.Toolbar = Class.extend({ else if(docstatus==0) { this.make_save_button(); } - else if(docstatus==1 && p[CANCEL]) { - this.appframe.add_button('Cancel', function() { - me.frm.savecancel(this) }, 'icon-remove'); - } - else if(docstatus==2 && p[AMEND]) { - this.appframe.add_button('Amend', function() { - me.frm.amend_doc() }, 'icon-pencil', true); - } + } + }, + make_cancel_amend_button: function() { + var me = this; + var docstatus = cint(this.frm.doc.docstatus); + var p = this.frm.perm[0]; + var has_workflow = wn.model.get("Workflow", {document_type: me.frm.doctype}).length; + + if(has_workflow) { + return; + } else if(docstatus==1 && p[CANCEL]) { + this.appframe.add_button('Cancel', function() { + me.frm.savecancel(this) }, 'icon-remove'); + } else if(docstatus==2 && p[AMEND]) { + this.appframe.add_button('Amend', function() { + me.frm.amend_doc() }, 'icon-pencil', true); } }, make_save_button: function() { @@ -190,10 +218,5 @@ wn.ui.form.Toolbar = Class.extend({ .toggleClass("text-warning", this.frm.doc.__unsaved ? true : false); this.set_title(); this.set_title_button(); - }, - make_actions_menu: function() { - if(this.actions_setup) return; - var menu = this.get_dropdown_menu("Actions"); - this.actions_setup = true; - } + } }) \ No newline at end of file diff --git a/public/js/wn/misc/user.js b/public/js/wn/misc/user.js index 581305a3ab..ef5a85263f 100644 --- a/public/js/wn/misc/user.js +++ b/public/js/wn/misc/user.js @@ -34,8 +34,8 @@ wn.ui.set_user_background = function(src) { if(!src) src = "lib/images/ui/field.jpg"; wn.dom.set_style(repl('#page-desktop { \ position: fixed;\ - top: 0px; left: 0px; min-width: 100%; height: 100%; overflow: auto;\ - padding-top: 50px; \ + left: 0px; min-width: 100%; height: 100%; overflow: auto;\ + padding-top: 14px; \ background: url("%(src)s") no-repeat center center fixed; \ -webkit-background-size: cover; -moz-background-size: cover; \ -o-background-size: cover; \ diff --git a/public/js/wn/ui/appframe.js b/public/js/wn/ui/appframe.js index 1e02c06803..5d22f4a31e 100644 --- a/public/js/wn/ui/appframe.js +++ b/public/js/wn/ui/appframe.js @@ -53,16 +53,19 @@ wn.ui.AppFrame = Class.extend({ }, set_title_right: function(txt, click, icon) { - this.primary_dropdown = null; - this.primary_action = null; - this.title_right = null; - var $right = this.parent.find(".titlebar-item.text-right").empty(); + var $right = this.parent.find(".titlebar-item.text-right") if(txt) { + this.title_right && this.title_right.remove(); this.title_right = $("") .html((icon ? ' ' : "") + txt) .click(click) .appendTo($right); return this.title_right; + } else { + $right.empty(); + this.title_right = null; + this.primary_dropdown = null; + this.primary_action = null; } }, @@ -81,9 +84,10 @@ wn.ui.AppFrame = Class.extend({ .attr("id", id) .attr("data-toggle", "dropdown") .addClass("dropdown-toggle") - .parent().addClass("dropdown"); + .parent() + .addClass("dropdown") this.primary_dropdown = $('') + aria-labelledby="'+ id +'">') .appendTo(this.primary_action.parent()).dropdown(); } @@ -308,9 +312,11 @@ wn.ui.make_app_page = function(opts) { $wrapper = $(opts.parent) $('
\
\ -
\ -
\ -
\ +
\ +
\ +
\ +
\ +
\
\
\
\