Merge branch 'master' of github.com:webnotes/wnframework into unicode

This commit is contained in:
Anand Doshi 2012-08-31 13:40:08 +05:30
commit ae400eeb55
6 changed files with 9 additions and 8 deletions

2
js/core.min.js vendored
View file

@ -183,7 +183,7 @@ if(this.show_filters){this.make_filters();}},add_button:function(label,click,ico
if(icon){$('<i>').addClass(icon).appendTo($button);}
$button.html(label).click(click);return $button}},show_view:function($btn,$div,$btn_unsel,$div_unsel){$btn_unsel.removeClass('btn-info');$btn_unsel.find('i').removeClass('icon-white');$div_unsel.toggle(false);$btn.addClass('btn-info');$btn.find('i').addClass('icon-white');$div.toggle(true);},set_events:function(){var me=this;this.$w.find('.btn-more').click(function(){me.run({append:true});});if(this.title){this.$w.find('h3').html(this.title).toggle(true);}
if(!(this.hide_refresh||this.no_refresh)){this.add_button('Refresh',function(){me.run();},'icon-refresh');}
if(this.new_doctype){this.add_button('New '+this.new_doctype,function(){me.make_new_doc(me.new_doctype);},'icon-plus');}
if(this.new_doctype){this.add_button('New '+this.new_doctype,function(){(me.custom_new_doc||me.make_new_doc)(me.new_doctype);},'icon-plus');}
if(me.show_filters){this.add_button('Show Filters',function(){me.filter_list.show_filters();},'icon-search').addClass('btn-filter');}
if(me.no_toolbar||me.hide_toolbar){me.$w.find('.list-toolbar-wrapper').toggle(false);}},make_new_doc:function(new_doctype){new_doc(new_doctype);},make_filters:function(){this.filter_list=new wn.ui.FilterList({listobj:this,$parent:this.$w.find('.list-filters').toggle(true),doctype:this.doctype,filter_fields:this.filter_fields});},clear:function(){this.data=[];this.$w.find('.result-list').empty();this.$w.find('.result').toggle(true);this.$w.find('.no-result').toggle(false);this.start=0;},run:function(){var me=this;var a0=arguments[0];var a1=arguments[1];if(a0&&typeof a0=='function')
this.onrun=a0;if(a0&&a0.callback)

View file

@ -39,10 +39,10 @@ function loaddoc(doctype, name, onload) {
}
var load_doc = loaddoc;
function new_doc(doctype, onload, in_dialog, on_save_callback, cdt, cdn, cnic) {
function new_doc(doctype, in_form) {
doctype = get_label_doctype(doctype);
wn.model.with_doctype(doctype, function() {
if(locals.DocType[doctype].in_dialog) {
if(!in_form && locals.DocType[doctype].in_dialog) {
var new_name = LocalDB.create(doctype);
_f.edit_record(doctype, new_name);
} else {

View file

@ -684,7 +684,7 @@ LinkField.prototype.setup_buttons = function() {
}
}
_f.calling_doc_stack.push([me.doctype, me.docname]);
new_doc(me.df.options, me.on_new, 1, on_save_callback, me.doctype, me.docname, me.frm.not_in_container);
new_doc(me.df.options);
}
} else {
$dh(me.btn2); $y($td(me.tab,0,2), {width:'0px'});

View file

@ -127,7 +127,7 @@ _f.edit_record = function(dt, dn) {
$(f.page_layout.wrapper).removeClass('layout-wrapper')
.removeClass('layout-wrapper-background').toggle(true);
d.dialog.show();
d.dialog.show();
})
})
}

View file

@ -173,7 +173,7 @@ wn.ui.Listing = Class.extend({
// new
if(this.new_doctype) {
this.add_button('New ' + this.new_doctype, function() {
me.make_new_doc(me.new_doctype);
(me.custom_new_doc || me.make_new_doc)(me.new_doctype);
}, 'icon-plus');
}

View file

@ -144,13 +144,14 @@ wn.views.DocListView = wn.ui.Listing.extend({
new_doctype: this.doctype,
allow_delete: this.allow_delete,
no_result_message: this.make_no_result(),
columns: this.listview.fields
columns: this.listview.fields,
custom_new_doc: me.listview.make_new_doc || undefined,
});
// make_new_doc can be overridden so that default values can be prefilled
// for example - communication list in customer
$(this.wrapper).find('button[list_view_doc="'+me.doctype+'"]').click(function(){
me.make_new_doc(me.doctype);
(me.listview.make_new_doc || me.make_new_doc)(me.doctype);
});
if((auto_run !== false) && (auto_run !== 0)) this.run();