From c6843484e5ab01416723f6d14a881e13ec3484ee Mon Sep 17 00:00:00 2001 From: Rushabh Mehta Date: Wed, 11 Apr 2012 15:28:00 +0530 Subject: [PATCH] form header refactor --- build.json | 1 + css/all-app.css | 65 ++++++++++++++++++++++++++----------------------- js/all-app.js | 16 ++++++------ js/all-web.js | 6 +++-- version.num | 2 +- 5 files changed, 49 insertions(+), 41 deletions(-) diff --git a/build.json b/build.json index e5f09396b5a..3c72277887f 100644 --- a/build.json +++ b/build.json @@ -72,6 +72,7 @@ "lib/css/legacy/sidebar.css", "lib/css/Aristo/aristo.selected.css", "lib/css/ui/list.css", + "lib/css/ui/views.css", "lib/css/ui/fonts.css", "lib/css/bootstrap/headings.css", "lib/css/bootstrap/buttons.css", diff --git a/css/all-app.css b/css/all-app.css index 25147727d94..b64db5c122b 100644 --- a/css/all-app.css +++ b/css/all-app.css @@ -328,37 +328,6 @@ div.notice { */ /* FORMS */ -.breadcrumbs-area { - margin-bottom: 8px; -} - -.breadcrumbs { - color: #000000; -} - -.breadcrumbs a { - color: #000000; -} - -div.form-header-main { - padding: 6px; - background: #eeeeee; /* Old browsers */ - background: -moz-linear-gradient(top, #eeeeee 0%, #cccccc 100%); /* FF3.6+ */ - background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,#eeeeee), color-stop(100%,#cccccc)); /* Chrome,Safari4+ */ - background: -webkit-linear-gradient(top, #eeeeee 0%,#cccccc 100%); /* Chrome10+,Safari5.1+ */ - background: -o-linear-gradient(top, #eeeeee 0%,#cccccc 100%); /* Opera 11.10+ */ - background: -ms-linear-gradient(top, #eeeeee 0%,#cccccc 100%); /* IE10+ */ - background: linear-gradient(top, #eeeeee 0%,#cccccc 100%); /* W3C */ - filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#eeeeee', endColorstr='#cccccc',GradientType=0 ); /* IE6-9 */ - border-bottom: 1px solid #ccc; -} -div.form-header-toolbar { - padding: 4px; - background: #eeeeee; - border-top: 1px solid #f8f8f8; - border-bottom: 1px solid #ccc; -} - div.form-section-head { margin: 11px -15px 3px -15px; border-top: 1px solid #ccc; @@ -1740,6 +1709,40 @@ div.stat-bar { +/* + * lib/css/ui/views.css + */ +.breadcrumbs-area { + margin-bottom: 8px; +} + +.breadcrumbs { + color: #000000; +} + +.breadcrumbs a { + color: #000000; +} + +div.page-app-bar { + padding: 6px; + background: #eeeeee; /* Old browsers */ + background: -moz-linear-gradient(top, #eeeeee 0%, #cccccc 100%); /* FF3.6+ */ + background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,#eeeeee), color-stop(100%,#cccccc)); /* Chrome,Safari4+ */ + background: -webkit-linear-gradient(top, #eeeeee 0%,#cccccc 100%); /* Chrome10+,Safari5.1+ */ + background: -o-linear-gradient(top, #eeeeee 0%,#cccccc 100%); /* Opera 11.10+ */ + background: -ms-linear-gradient(top, #eeeeee 0%,#cccccc 100%); /* IE10+ */ + background: linear-gradient(top, #eeeeee 0%,#cccccc 100%); /* W3C */ + filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#eeeeee', endColorstr='#cccccc',GradientType=0 ); /* IE6-9 */ + border-bottom: 1px solid #ccc; +} +div.page-app-toolbar { + padding: 4px; + background: #eeeeee; + border-top: 1px solid #f8f8f8; + border-bottom: 1px solid #ccc; +} + /* * lib/css/ui/fonts.css */ diff --git a/js/all-app.js b/js/all-app.js index e19e07a9ab3..78deffe0290 100644 --- a/js/all-app.js +++ b/js/all-app.js @@ -359,9 +359,11 @@ wn.views.add_list_btn=function(parent,doctype){$(parent).append(repl('\ -
\ +
\ + \ ×\ - \ +
\ +
\

%(label)s

\
\
Loading...
\ @@ -1605,26 +1607,26 @@ d.cur_frm=f;d.dn=dn;d.table_form=f.meta.istable;f.refresh(dn);d.dialog.show();}) * lib/js/legacy/widgets/form/form_header.js */ _f.FrmHeader=Class.extend({init:function(parent,frm){this.buttons={};this.$w=$('
\ -
\ +
\ \ \ ×\
\ -
\ +
\
\
').appendTo(parent);this.$w.find('.close').click(function(){window.history.back();})},refresh:function(){wn.views.breadcrumbs($(this.$w.find('.breadcrumb-area')),cur_frm.meta.module,cur_frm.meta.name,cur_frm.docname);this.refresh_labels();this.refresh_toolbar();},refresh_labels:function(){var labinfo={0:['Draft',''],1:['Submitted','label-info'],2:['Cancelled','label-important']}[cint(cur_frm.doc.docstatus)];if(cur_frm.doc.__unsaved){labinfo[1]='label-warning'} this.$w.find('.label-area').html(repl('\ - %(lab_status)s',{lab_status:labinfo[0],lab_class:labinfo[1]}));},refresh_toolbar:function(){this.$w.find('.form-header-toolbar').empty();var p=cur_frm.get_doc_perms();if(cur_frm.meta.read_only_onload&&!cur_frm.doc.__islocal){if(!cur_frm.editable) + %(lab_status)s',{lab_status:labinfo[0],lab_class:labinfo[1]}));},refresh_toolbar:function(){this.$w.find('.page-app-toolbar').empty();var p=cur_frm.get_doc_perms();if(cur_frm.meta.read_only_onload&&!cur_frm.doc.__islocal){if(!cur_frm.editable) this.add_button('Edit',function(){cur_frm.edit_doc();},'icon-pencil');else this.add_button('Print View',function(){cur_frm.is_editable[cur_frm.docname]=0;cur_frm.refresh();},'icon-print');} -var docstatus=cint(cur_frm.doc.docstatus);if(docstatus==0&&p[WRITE]){this.add_button('Save',function(){cur_frm.save('Save');},'');this.buttons['Save'].addClass('btn-primary');} +var docstatus=cint(cur_frm.doc.docstatus);if(docstatus==0&&p[WRITE]){this.add_button('Save',function(){cur_frm.save('Save');},'');this.buttons['Save'].addClass('btn-info');} if(docstatus==0&&p[SUBMIT]&&(!cur_frm.doc.__islocal)) this.add_button('Submit',function(){cur_frm.savesubmit();},'icon-lock');if(docstatus==1&&p[SUBMIT]){this.add_button('Update',function(){cur_frm.savesubmit();},'');if(!cur_frm.doc.__unsaved)this.buttons['Update'].toggle(false);} if(docstatus==1&&p[CANCEL]) this.add_button('Cancel',function(){cur_frm.savecancel()},'icon-remove');if(docstatus==2&&p[AMEND]) this.add_button('Amend',function(){cur_frm.amend_doc()},'icon-pencil');},add_button:function(label,click,icon){args={label:label,icon:''};if(icon){args.icon='';} this.buttons[label]=$(repl('',args)).click(click).appendTo(this.$w.find('.form-header-toolbar'));},show:function(){},hide:function(){},hide_close:function(){this.$w.find('.close').toggle(false);}}) + %(icon)s %(label)s',args)).click(click).appendTo(this.$w.find('.page-app-toolbar'));},show:function(){},hide:function(){},hide_close:function(){this.$w.find('.close').toggle(false);}}) /* * lib/js/legacy/widgets/form/form.js */ diff --git a/js/all-web.js b/js/all-web.js index d7f8f1c43e7..d3dfc99b74d 100644 --- a/js/all-web.js +++ b/js/all-web.js @@ -246,9 +246,11 @@ wn.views.add_list_btn=function(parent,doctype){$(parent).append(repl('\ -
\ +
\ + \ ×\ - \ +
\ +
\

%(label)s

\
\
Loading...
\ diff --git a/version.num b/version.num index 8e91b904487..50b710d816e 100644 --- a/version.num +++ b/version.num @@ -1 +1 @@ -1607 \ No newline at end of file +1610 \ No newline at end of file