Merge branch 'master' of github.com:webnotes/wnframework
This commit is contained in:
commit
4e7841b92b
5 changed files with 45 additions and 41 deletions
|
|
@ -272,7 +272,7 @@ _f.CodeField.prototype.make_input = function() {
|
|||
// General options
|
||||
theme : "advanced",
|
||||
plugins : "style,inlinepopups,table,advimage",
|
||||
extended_valid_elements: "div[id|dir|class|align|style]",
|
||||
extended_valid_elements: "script|embed",
|
||||
|
||||
// w/h
|
||||
width: '100%',
|
||||
|
|
|
|||
|
|
@ -32,9 +32,7 @@ wn.ui.form.AssignTo = Class.extend({
|
|||
$.extend(this, opts);
|
||||
var me = this;
|
||||
this.wrapper = $('<div>\
|
||||
<button class="btn">\
|
||||
<i class="icon-ok"></i>\
|
||||
'+wn._("Assign To")+'</button>\
|
||||
<button class="btn"><i class="icon-plus"></i></button>\
|
||||
<div class="alert-list"></div>\
|
||||
</div>').appendTo(this.parent);
|
||||
|
||||
|
|
|
|||
|
|
@ -22,7 +22,7 @@ wn.ui.form.LinkedWith = Class.extend({
|
|||
}).sort(function(a, b) { return a.label > b.label ? 1 : -1 });
|
||||
|
||||
this.dialog = new wn.ui.Dialog({
|
||||
width: 640,
|
||||
width: 700,
|
||||
title: wn._("Linked With"),
|
||||
fields: [
|
||||
{ fieldtype: "HTML", label: "help",
|
||||
|
|
@ -60,6 +60,7 @@ wn.ui.form.LinkedWith = Class.extend({
|
|||
},
|
||||
make_listing: function() {
|
||||
var me = this;
|
||||
this.listview = wn.views.get_listview(this.doctype, this);
|
||||
this.lst = new wn.ui.Listing({
|
||||
hide_refresh: true,
|
||||
no_loading: true,
|
||||
|
|
@ -69,34 +70,37 @@ wn.ui.form.LinkedWith = Class.extend({
|
|||
parent: $(this.dialog.fields_dict.list.wrapper).empty().css("min-height", "300px")
|
||||
.get(0),
|
||||
method: 'webnotes.widgets.reportview.get',
|
||||
custom_new_doc: me.listview.make_new_doc || undefined,
|
||||
get_args: function() {
|
||||
return {
|
||||
doctype: me.doctype,
|
||||
fields: (!me.is_table
|
||||
? [ '`tab' + me.doctype + '`.name',
|
||||
'`tab' + me.doctype + '`.modified',
|
||||
'`tab' + me.doctype + '`.modified_by',
|
||||
'`tab' + me.doctype + '`.docstatus']
|
||||
: [ '`tab' + me.doctype + '`.parent',
|
||||
'`tab' + me.doctype + '`.parenttype',
|
||||
'`tab' + me.doctype + '`.modified_by',
|
||||
'`tab' + me.doctype + '`.docstatus']
|
||||
),
|
||||
filters: me.lst.filter_list.get_filters(),
|
||||
docstatus: ['0','1']
|
||||
var args = {
|
||||
doctype: this.doctype,
|
||||
fields: this.listview.fields,
|
||||
filters: this.filter_list.get_filters(),
|
||||
docstatus: ['0','1'],
|
||||
order_by: this.listview.order_by || undefined,
|
||||
group_by: this.listview.group_by || undefined,
|
||||
}
|
||||
return args;
|
||||
|
||||
// return {
|
||||
// doctype: me.doctype,
|
||||
// fields: (!me.is_table
|
||||
// ? [ '`tab' + me.doctype + '`.name',
|
||||
// '`tab' + me.doctype + '`.modified',
|
||||
// '`tab' + me.doctype + '`.modified_by',
|
||||
// '`tab' + me.doctype + '`.docstatus']
|
||||
// : [ '`tab' + me.doctype + '`.parent',
|
||||
// '`tab' + me.doctype + '`.parenttype',
|
||||
// '`tab' + me.doctype + '`.modified_by',
|
||||
// '`tab' + me.doctype + '`.docstatus']
|
||||
// ),
|
||||
// filters: me.lst.filter_list.get_filters(),
|
||||
// docstatus: ['0','1']
|
||||
// }
|
||||
},
|
||||
render_row: function(parent, data) {
|
||||
$(parent).html(repl('%(avatar)s \
|
||||
<a href="#Form/%(doctype)s/%(name)s" onclick="cur_dialog.hide()">\
|
||||
%(doctype)s: %(name)s</a>\
|
||||
<span class="help">Last Updated: %(modified)s</span>', {
|
||||
avatar: wn.avatar(data.modified_by, null,
|
||||
"Last Modified By: " + wn.user_info(data.modified_by).fullname),
|
||||
doctype: me.is_table ? data.parenttype : me.doctype,
|
||||
modified: dateutil.comment_when(data.modified),
|
||||
name: me.is_table ? data.parent : data.name
|
||||
})).find('.avatar img').centerImage();
|
||||
data.doctype = this.doctype;
|
||||
me.listview.render(parent, data, this);
|
||||
},
|
||||
get_no_result_message: function() {
|
||||
return repl("<div class='alert'>%(doctype)s: " + wn._("Not linked") + "</div>", {
|
||||
|
|
@ -108,5 +112,6 @@ wn.ui.form.LinkedWith = Class.extend({
|
|||
me.lst.filter_list.show_filters(true);
|
||||
me.lst.filter_list.clear_filters();
|
||||
me.lst.set_filter(me.linked_with[me.doctype], me.frm.doc.name);
|
||||
me.lst.listview = me.listview;
|
||||
}
|
||||
});
|
||||
|
|
@ -129,13 +129,7 @@ wn.views.DocListView = wn.ui.Listing.extend({
|
|||
}
|
||||
},
|
||||
setup_listview: function() {
|
||||
if(this.meta.__listjs) {
|
||||
eval(this.meta.__listjs);
|
||||
this.listview = new wn.doclistviews[this.doctype](this);
|
||||
} else {
|
||||
this.listview = new wn.views.ListView(this);
|
||||
}
|
||||
this.listview.parent = this;
|
||||
this.listview = wn.views.get_listview(this.doctype, this);
|
||||
this.wrapper = this.$page.find('.wnlist-area');
|
||||
this.page_length = 20;
|
||||
this.allow_delete = true;
|
||||
|
|
@ -155,7 +149,6 @@ 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,
|
||||
custom_new_doc: me.listview.make_new_doc || undefined,
|
||||
});
|
||||
|
||||
|
|
@ -188,9 +181,6 @@ wn.views.DocListView = wn.ui.Listing.extend({
|
|||
});
|
||||
data.doctype = this.doctype;
|
||||
this.listview.render(row, data, this);
|
||||
},
|
||||
get_query_fields: function() {
|
||||
return this.listview.fields;
|
||||
},
|
||||
get_args: function() {
|
||||
var docstatus_list = this.can_submit ? $.map(this.$page.find('.show-docstatus :checked'),
|
||||
|
|
@ -200,7 +190,7 @@ wn.views.DocListView = wn.ui.Listing.extend({
|
|||
|
||||
var args = {
|
||||
doctype: this.doctype,
|
||||
fields: this.get_query_fields(),
|
||||
fields: this.listview.fields,
|
||||
filters: this.filter_list.get_filters(),
|
||||
docstatus: docstatus_list,
|
||||
order_by: this.listview.order_by || undefined,
|
||||
|
|
|
|||
|
|
@ -1,3 +1,14 @@
|
|||
wn.views.get_listview = function(doctype, parent) {
|
||||
var meta = locals.DocType[doctype];
|
||||
if(meta.__listjs) {
|
||||
eval(meta.__listjs);
|
||||
var listview = new wn.doclistviews[doctype](parent);
|
||||
} else {
|
||||
var listview = new wn.views.ListView(parent);
|
||||
}
|
||||
return listview;
|
||||
}
|
||||
|
||||
wn.views.ListView = Class.extend({
|
||||
init: function(doclistview) {
|
||||
this.doclistview = doclistview;
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue