dialog form fixes
This commit is contained in:
parent
97a0b3e9d6
commit
49086492c3
@ -917,14 +917,15 @@ div.dialog_wrapper {
|
||||
display: none;
|
||||
z-index: 90;
|
||||
background-color: #FFF;
|
||||
border: 3px solid #222;
|
||||
box-shadow:1px 1px 5px #777;
|
||||
-moz-box-shadow: 1px 1px 5px #777;
|
||||
-webkit-box-shadow: 1px 1px 5px #777;
|
||||
box-shadow:1px 1px 8px #444;
|
||||
-moz-box-shadow: 1px 1px 8px #444;
|
||||
-webkit-box-shadow: 1px 1px 8px #444;
|
||||
|
||||
border-radius: 5px;
|
||||
-moz-border-radius: 5px;
|
||||
-webkit-border-radius: 5px;
|
||||
-webkit-border-radius: 5px;
|
||||
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
div.dialog_head {
|
||||
@ -948,7 +949,7 @@ div.dialog_back {
|
||||
left: 0px;
|
||||
bottom: 0px;
|
||||
right: 0px;
|
||||
background-color: #EEE;
|
||||
background-color: #aaa;
|
||||
opacity: 0.6;
|
||||
z-index: 50;
|
||||
text-align: center;
|
||||
@ -1738,6 +1739,7 @@ div.appframe-titlebar {
|
||||
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;
|
||||
min-height: 1.2em;
|
||||
}
|
||||
|
||||
div.appframe-toolbar {
|
||||
|
@ -334,14 +334,15 @@ div.dialog_wrapper {
|
||||
display: none;
|
||||
z-index: 90;
|
||||
background-color: #FFF;
|
||||
border: 3px solid #222;
|
||||
box-shadow:1px 1px 5px #777;
|
||||
-moz-box-shadow: 1px 1px 5px #777;
|
||||
-webkit-box-shadow: 1px 1px 5px #777;
|
||||
box-shadow:1px 1px 8px #444;
|
||||
-moz-box-shadow: 1px 1px 8px #444;
|
||||
-webkit-box-shadow: 1px 1px 8px #444;
|
||||
|
||||
border-radius: 5px;
|
||||
-moz-border-radius: 5px;
|
||||
-webkit-border-radius: 5px;
|
||||
-webkit-border-radius: 5px;
|
||||
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
div.dialog_head {
|
||||
@ -365,7 +366,7 @@ div.dialog_back {
|
||||
left: 0px;
|
||||
bottom: 0px;
|
||||
right: 0px;
|
||||
background-color: #EEE;
|
||||
background-color: #aaa;
|
||||
opacity: 0.6;
|
||||
z-index: 50;
|
||||
text-align: center;
|
||||
|
@ -916,8 +916,9 @@ if(f.init)f.init();f.make_body();return f;}
|
||||
* lib/js/wn/views/appframe.js
|
||||
*/
|
||||
wn.views.AppFrame=Class.extend({init:function(parent){this.buttons={};this.$w=$('<div></div>').appendTo(parent);this.$titlebar=$('<div class="appframe-titlebar">\
|
||||
<span class="close">×</span>\
|
||||
</div>').appendTo(this.$w);this.$w.find('.close').click(function(){window.history.back();})},add_button:function(label,click,icon){if(!this.$w.find('.appframe-toolbar').length)
|
||||
<span class="appframe-title"></span>\
|
||||
<span class="close">×</span>\
|
||||
</div>').appendTo(this.$w);this.$w.find('.close').click(function(){window.history.back();})},add_button:function(label,click,icon){if(!this.$w.find('.appframe-toolbar').length)
|
||||
this.$w.append('<div class="appframe-toolbar"></div>');args={label:label,icon:''};if(icon){args.icon='<i class="'+icon+'"></i>';}
|
||||
this.buttons[label]=$(repl('<button class="btn btn-small">\
|
||||
%(icon)s %(label)s</button>',args)).click(click).appendTo(this.$w.find('.appframe-toolbar'));},clear_buttons:function(){this.$w.find('.appframe-toolbar').empty();}})
|
||||
@ -938,14 +939,13 @@ wn.widgets.Dialog=function(opts){this.opts=opts;this.display=false;this.make=fun
|
||||
this.opts=opts;if(!this.opts.width)this.opts.width=480;this.wrapper=$a(popup_cont,'div','dialog_wrapper');if(this.opts.width)
|
||||
this.wrapper.style.width=this.opts.width+'px';this.make_head();this.body=$a(this.wrapper,'div','dialog_body');if(this.opts.fields)
|
||||
this.make_fields(this.body,this.opts.fields);}
|
||||
this.make_head=function(){var me=this;this.head=$a(this.wrapper,'div','dialog_head');var t=make_table(this.head,1,2,'100%',['100%','16px'],{padding:'2px'});$y($td(t,0,0),{paddingLeft:'16px',fontWeight:'bold',fontSize:'14px',textAlign:'center'});$y($td(t,0,1),{textAlign:'right'});var img=$a($td(t,0,01),'img','',{cursor:'pointer'});img.src='lib/images/icons/close.gif';this.title_text=$td(t,0,0);this.set_title(this.opts.title);img.onclick=function(){if(me.oncancel)me.oncancel();me.hide();}
|
||||
this.cancel_img=img;}
|
||||
this.set_title=function(t){this.title_text.innerHTML=t?t:'';}
|
||||
this.make_head=function(){var me=this;this.appframe=new wn.views.AppFrame(this.wrapper);this.appframe.$titlebar.find('.close').unbind('click').click(function(){if(me.oncancel)me.oncancel();me.hide();});this.set_title(this.opts.title);}
|
||||
this.set_title=function(t){this.appframe.$titlebar.find('.appframe-title').html(t||'');}
|
||||
this.set_postion=function(){var d=get_screen_dims();this.wrapper.style.left=((d.w-cint(this.wrapper.style.width))/2)+'px';this.wrapper.style.top=(get_scroll_top()+60)+'px';top_index++;$y(this.wrapper,{zIndex:top_index});}
|
||||
this.show=function(){if(this.display)return;this.set_postion()
|
||||
$ds(this.wrapper);freeze();this.display=true;cur_dialog=this;if(this.onshow)this.onshow();}
|
||||
this.hide=function(){if(this.onhide)this.onhide();unfreeze();$dh(this.wrapper);this.display=false;cur_dialog=null;}
|
||||
this.no_cancel=function(){$dh(this.cancel_img);}
|
||||
this.no_cancel=function(){this.appframe.$titlebar.find('.close').toggle(false);}
|
||||
if(opts)this.make();}
|
||||
wn.widgets.Dialog.prototype=new wn.widgets.FieldGroup();$(document).bind('keydown',function(e){if(cur_dialog&&!cur_dialog.no_cancel_flag&&e.which==27){cur_dialog.hide();}});
|
||||
/*
|
||||
@ -1596,19 +1596,20 @@ if(f.init)f.init();f.make_body();return f;}
|
||||
/*
|
||||
* lib/js/legacy/widgets/form/form_dialog.js
|
||||
*/
|
||||
_f.frm_dialog=null;_f.calling_doc_stack=[];_f.temp_access={};_f.FrmDialog=function(){var me=this;this.last_displayed=null;var d=new Dialog(640,null,'Edit Row');this.body=$a(d.body,'div','dialog_frm');$y(d.body,{backgroundColor:'#EEE'});d.done_btn_area=$a(d.body,'div','',{margin:'8px'});me.on_complete=function(){if(me.table_form){me.dialog.hide();}else{var callback=function(r){var dn=cur_frm.docname;if(!r.exc){me.dialog.hide();}
|
||||
_f.frm_dialog=null;_f.calling_doc_stack=[];_f.temp_access={};_f.FrmDialog=function(){var me=this;this.last_displayed=null;var d=new Dialog(640,null,'Edit Row');this.body=$a(d.body,'div','dialog_frm');d.done_btn_area=$a(d.body,'div','',{margin:'8px'});me.on_complete=function(){if(me.table_form){me.dialog.hide();}else{var callback=function(r){var dn=cur_frm.docname;if(!r.exc){me.dialog.hide();}
|
||||
if(me.on_save_callback)
|
||||
me.on_save_callback(dn);}
|
||||
cur_frm.save('Save',callback);}}
|
||||
d.onshow=function(){d.done_btn_area.innerHTML='';d.done_btn=$btn(d.done_btn_area,'Save',null,null,'green');d.done_btn.onclick=function(){me.on_complete()};if(me.table_form){d.set_title("Editing Row #"+(_f.cur_grid_ridx+1));d.done_btn.innerHTML='Done Editing';}else{d.set_title(cur_frm.doctype==cur_frm.doctype?(cur_frm.doctype):(cur_frm.doctype+': '+cur_frm.docname));d.done_btn.innerHTML='Save';}}
|
||||
d.onhide=function(){if(_f.cur_grid){_f.cur_grid.refresh_row(_f.cur_grid_ridx,me.dn);}
|
||||
if(wn.container.page.frm){cur_frm=wn.container.page.frm;}
|
||||
if(me.cur_frm.cscript.hide_dialog){me.cur_frm.cscript.hide_dialog();}}
|
||||
if(me.cur_frm.cscript.hide_dialog){me.cur_frm.cscript.hide_dialog();}
|
||||
console.log(me.cur_frm.wrapper);$(me.cur_frm.page_layout.wrapper).toggle(false);}
|
||||
this.dialog=d;}
|
||||
_f.edit_record=function(dt,dn){if(!_f.frm_dialog){_f.frm_dialog=new _f.FrmDialog();}
|
||||
var d=_f.frm_dialog;wn.model.with_doctype(dt,function(){wn.model.with_doc(dt,dn,function(dn){if(!_f.frms[dt]){_f.frms[dt]=new _f.Frm(dt,d.body);}
|
||||
var f=_f.frms[dt];if(f.meta.istable){f.parent_doctype=cur_frm.doctype;f.parent_docname=cur_frm.docname;}
|
||||
d.cur_frm=f;d.dn=dn;d.table_form=f.meta.istable;f.refresh(dn);d.dialog.show();})})}
|
||||
d.cur_frm=f;d.dn=dn;d.table_form=f.meta.istable;f.refresh(dn);$(f.page_layout.wrapper).removeClass('layout-wrapper').removeClass('layout-wrapper-background').toggle(true);d.dialog.show();})})}
|
||||
/*
|
||||
* lib/js/legacy/widgets/form/form_header.js
|
||||
*/
|
||||
|
@ -589,14 +589,13 @@ wn.widgets.Dialog=function(opts){this.opts=opts;this.display=false;this.make=fun
|
||||
this.opts=opts;if(!this.opts.width)this.opts.width=480;this.wrapper=$a(popup_cont,'div','dialog_wrapper');if(this.opts.width)
|
||||
this.wrapper.style.width=this.opts.width+'px';this.make_head();this.body=$a(this.wrapper,'div','dialog_body');if(this.opts.fields)
|
||||
this.make_fields(this.body,this.opts.fields);}
|
||||
this.make_head=function(){var me=this;this.head=$a(this.wrapper,'div','dialog_head');var t=make_table(this.head,1,2,'100%',['100%','16px'],{padding:'2px'});$y($td(t,0,0),{paddingLeft:'16px',fontWeight:'bold',fontSize:'14px',textAlign:'center'});$y($td(t,0,1),{textAlign:'right'});var img=$a($td(t,0,01),'img','',{cursor:'pointer'});img.src='lib/images/icons/close.gif';this.title_text=$td(t,0,0);this.set_title(this.opts.title);img.onclick=function(){if(me.oncancel)me.oncancel();me.hide();}
|
||||
this.cancel_img=img;}
|
||||
this.set_title=function(t){this.title_text.innerHTML=t?t:'';}
|
||||
this.make_head=function(){var me=this;this.appframe=new wn.views.AppFrame(this.wrapper);this.appframe.$titlebar.find('.close').unbind('click').click(function(){if(me.oncancel)me.oncancel();me.hide();});this.set_title(this.opts.title);}
|
||||
this.set_title=function(t){this.appframe.$titlebar.find('.appframe-title').html(t||'');}
|
||||
this.set_postion=function(){var d=get_screen_dims();this.wrapper.style.left=((d.w-cint(this.wrapper.style.width))/2)+'px';this.wrapper.style.top=(get_scroll_top()+60)+'px';top_index++;$y(this.wrapper,{zIndex:top_index});}
|
||||
this.show=function(){if(this.display)return;this.set_postion()
|
||||
$ds(this.wrapper);freeze();this.display=true;cur_dialog=this;if(this.onshow)this.onshow();}
|
||||
this.hide=function(){if(this.onhide)this.onhide();unfreeze();$dh(this.wrapper);this.display=false;cur_dialog=null;}
|
||||
this.no_cancel=function(){$dh(this.cancel_img);}
|
||||
this.no_cancel=function(){this.appframe.$titlebar.find('.close').toggle(false);}
|
||||
if(opts)this.make();}
|
||||
wn.widgets.Dialog.prototype=new wn.widgets.FieldGroup();$(document).bind('keydown',function(e){if(cur_dialog&&!cur_dialog.no_cancel_flag&&e.which==27){cur_dialog.hide();}});
|
||||
/*
|
||||
|
@ -1 +1 @@
|
||||
1644
|
||||
1659
|
Loading…
x
Reference in New Issue
Block a user