link empty value and kb fix

This commit is contained in:
Rushabh Mehta 2012-03-23 15:54:55 +05:30
parent d8e21ecaca
commit dbaa2990ec
5 changed files with 16 additions and 10 deletions

View file

@ -192,7 +192,6 @@ div.std-footer-item {
box-shadow: 0px 0px 6px rgba(0,0,0,0.3);
background-color: #fff;
padding: 15px;
margin-bottom: 30px;
}
.layout-wrapper-background {

2
js/core.min.js vendored
View file

@ -295,7 +295,7 @@ if(data.docstatus==0||data.docstatus==null){data.docstatus_icon='icon-pencil';da
*/
wn.provide('wn.views.pageview');wn.views.pageview={pages:{},with_page:function(name,callback){if(!locals.Page[name]){wn.call({method:'webnotes.widgets.page.getpage',args:{'name':name},callback:callback});}else{callback();}},show:function(name){wn.views.pageview.with_page(name,function(){if(!wn.pages[name]){wn.views.pageview.pages[name]=new wn.views.Page(name);}
wn.container.change_to(name);});}}
wn.views.Page=Class.extend({init:function(name){this.name=name;var me=this;this.pagedoc=locals.Page[this.name];this.wrapper=wn.container.add_page(this.name);this.wrapper.label=this.pagedoc.title||this.pagedoc.name;this.wrapper.innerHTML=this.pagedoc.content;wn.dom.eval(this.pagedoc.__script||this.pagedoc.script||'');wn.dom.set_style(this.pagedoc.style);this.trigger('onload');$(this.wrapper).bind('show',function(){cur_frm=null;me.trigger('onshow');});},trigger:function(eventname){var me=this;try{if(pscript[eventname+'_'+this.name]){pscript[eventname+'_'+this.name](me.wrapper);}else if(me.wrapper[eventname]){me.wrapper[eventname](me.wrapper);}}catch(e){console.log(e);}}})
wn.views.Page=Class.extend({init:function(name){this.name=name;var me=this;this.pagedoc=locals.Page[this.name];this.wrapper=wn.container.add_page(this.name);this.wrapper.label=this.pagedoc.title||this.pagedoc.name;this.wrapper.innerHTML=this.pagedoc.content;wn.dom.eval(this.pagedoc.__script||this.pagedoc.script||'');wn.dom.set_style(this.pagedoc.style);this.trigger('onload');$(this.wrapper).bind('show',function(){cur_frm=null;me.trigger('onshow');me.trigger('refresh');});},trigger:function(eventname){var me=this;try{if(pscript[eventname+'_'+this.name]){pscript[eventname+'_'+this.name](me.wrapper);}else if(me.wrapper[eventname]){me.wrapper[eventname](me.wrapper);}}catch(e){console.log(e);}}})
/*
* lib/js/wn/views/formview.js
*/

View file

@ -454,10 +454,6 @@ DataField.prototype.make_input = function() {
response(r.results);
}
});
},
select: function(event, ui) {
me.set_input_value(ui.item.value);
return false;
}
});
}
@ -631,8 +627,7 @@ LinkField.prototype.make_input = function() {
});
},
select: function(event, ui) {
me.set_input_value(ui.item.value);
return false;
me.set_input_value(ui.item.value);
}
}).data('autocomplete')._renderItem = function(ul, item) {
return $('<li></li>')
@ -640,6 +635,11 @@ LinkField.prototype.make_input = function() {
.append(repl('<a>%(label)s<br><span style="font-size:10px">%(info)s</span></a>', item))
.appendTo(ul);
};
$(this.txt).change(function() {
if(!$(this).val())
me.set_input_value('');
})
}
LinkField.prototype.get_custom_query = function() {
@ -691,7 +691,9 @@ LinkField.prototype.setup_buttons = function() {
}
LinkField.prototype.set_input_value = function(val) {
var me = this;
// refresh mandatory style
me.refresh_label_icon();

View file

@ -265,16 +265,20 @@ $(document).bind('click', function(e) {
}
var is_target_input = function() {
// select opened
if(e.target.tagName.toLowerCase()=='option') return true;
// autosuggest openend
//if(wn._autosugg_open) return true;
return $(e.target).parents().get().indexOf(_f.cur_grid_cell)!=-1;
}
if(_f.cur_grid_cell && !is_target_input() && !is_target_toolbar()) {
if(!(text_dialog && text_dialog.display)
&& !datepicker_active && !(selector && selector.display)) {
_f.cur_grid_cell.grid.cell_deselect();
return false;
setTimeout('_f.cur_grid_cell.grid.cell_deselect()', 500);
return false;
}
}
});

View file

@ -42,6 +42,7 @@ wn.views.Page = Class.extend({
$(this.wrapper).bind('show', function() {
cur_frm = null;
me.trigger('onshow');
me.trigger('refresh');
});
},
trigger: function(eventname) {