commit
c390dad29e
5 changed files with 34 additions and 10 deletions
|
|
@ -16,7 +16,7 @@ function make_field(docfield, doctype, parent, frm, in_grid, hide_label) { // Fa
|
|||
df: docfield,
|
||||
doctype: doctype,
|
||||
parent: parent,
|
||||
hide_label: hide_label,
|
||||
only_input: hide_label,
|
||||
frm: frm
|
||||
});
|
||||
}
|
||||
|
|
|
|||
|
|
@ -33,7 +33,8 @@ frappe.call = function(opts) {
|
|||
freeze: opts.freeze,
|
||||
show_spinner: !opts.no_spinner,
|
||||
progress_bar: opts.progress_bar,
|
||||
async: opts.async
|
||||
async: opts.async,
|
||||
url: opts.url || frappe.request.url,
|
||||
});
|
||||
}
|
||||
|
||||
|
|
@ -160,7 +161,7 @@ frappe.request.prepare = function(opts) {
|
|||
}
|
||||
|
||||
// no cmd?
|
||||
if(!opts.args.cmd) {
|
||||
if(!opts.args.cmd && !opts.url) {
|
||||
console.log(opts)
|
||||
throw "Incomplete Request";
|
||||
}
|
||||
|
|
|
|||
|
|
@ -337,16 +337,19 @@ frappe.ui.make_app_page = function(opts) {
|
|||
<div class="appframe-footer hide"></div>').appendTo($wrapper);
|
||||
|
||||
if(opts.single_column) {
|
||||
$('<div class="layout-main"></div>').appendTo($wrapper.find(".appframe"));
|
||||
opts.parent.body = $('<div class="layout-main"></div>').appendTo($wrapper.find(".appframe"));
|
||||
} else {
|
||||
$('<div class="row">\
|
||||
opts.parent.layout = $('<div class="row">\
|
||||
<div class="layout-main-section col-sm-9"></div>\
|
||||
<div class="layout-side-section col-sm-3"></div>\
|
||||
</div>').appendTo($wrapper.find(".appframe"));
|
||||
|
||||
opts.parent.body = opts.parent.layout.find(".layout-main-section");
|
||||
}
|
||||
opts.parent.appframe = new frappe.ui.AppFrame($wrapper);
|
||||
if(opts.set_document_title!==undefined)
|
||||
opts.parent.appframe.set_document_title = opts.set_document_title;
|
||||
if(opts.title) opts.parent.appframe.set_title(opts.title);
|
||||
if(opts.icon) opts.parent.appframe.get_main_icon(opts.icon);
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -30,18 +30,36 @@ frappe.ui.FilterList = Class.extend({
|
|||
},
|
||||
|
||||
add_filter: function(tablename, fieldname, condition, value) {
|
||||
this.push_new_filter(tablename, fieldname, condition, value);
|
||||
this.$w.find('.show_filters').toggle(true);
|
||||
return this.push_new_filter(tablename, fieldname, condition, value);
|
||||
},
|
||||
|
||||
push_new_filter: function(tablename, fieldname, condition, value) {
|
||||
this.filters.push(new frappe.ui.Filter({
|
||||
if(this.filter_exists(tablename, fieldname, condition, value)) return;
|
||||
|
||||
var filter = new frappe.ui.Filter({
|
||||
flist: this,
|
||||
tablename: tablename,
|
||||
fieldname: fieldname,
|
||||
condition: condition,
|
||||
value: value
|
||||
}));
|
||||
});
|
||||
|
||||
this.filters.push(filter);
|
||||
|
||||
return filter;
|
||||
},
|
||||
|
||||
filter_exists: function(tablename, fieldname, condition, value) {
|
||||
for(var i in this.filters) {
|
||||
if(this.filters[i].field) {
|
||||
var f = this.filters[i].get_value();
|
||||
if(f[0]==tablename && f[1]==fieldname && f[2]==condition
|
||||
&& f[3]==value) return true;
|
||||
|
||||
}
|
||||
}
|
||||
return false;
|
||||
},
|
||||
|
||||
get_filters: function() {
|
||||
|
|
|
|||
|
|
@ -121,6 +121,7 @@ frappe.views.DocListView = frappe.ui.Listing.extend({
|
|||
var me = this;
|
||||
this.$page.on("click", ".filterable", function(e) {
|
||||
var filters = $(this).attr("data-filter").split("|");
|
||||
var added = false;
|
||||
$.each(filters, function(i, f) {
|
||||
f = f.split(",");
|
||||
if(f[2]==="Today") {
|
||||
|
|
@ -128,9 +129,10 @@ frappe.views.DocListView = frappe.ui.Listing.extend({
|
|||
} else if(f[2]=="User") {
|
||||
f[2] = user;
|
||||
}
|
||||
me.filter_list.add_filter(me.doctype, f[0], f[1], f.slice(2).join(","));
|
||||
added = added || me.filter_list.add_filter(me.doctype,
|
||||
f[0], f[1], f.slice(2).join(","));
|
||||
});
|
||||
me.run();
|
||||
added && me.run();
|
||||
})
|
||||
},
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue