[query report] fixed toolbar, now add_field in appframe

This commit is contained in:
Rushabh Mehta 2013-05-31 12:14:47 +05:30
parent f9ac64e28e
commit 9a4eaea365
7 changed files with 32 additions and 1899 deletions

View file

@ -83,7 +83,8 @@ def get_html(doc, doclist):
from jinja2 import Environment
from core.doctype.print_format.print_format import get_print_format
template = Environment().from_string(get_print_format(doc.doctype, webnotes.form_dict.format))
template = Environment().from_string(get_print_format(doc.doctype,
webnotes.form_dict.format))
doctype = webnotes.get_doctype(doc.doctype)
args = {

View file

@ -1579,7 +1579,7 @@ select:focus:invalid:focus {
}
.input-group-addon {
padding: 6px 8px;
padding: 8px 12px;
font-size: 14px;
font-weight: normal;
line-height: 1.428571429;
@ -1985,16 +1985,6 @@ input[type="button"].btn-block {
opacity: 1;
}
/*.collapse {
position: relative;
height: 0;
overflow: hidden;
.transition(height .35s ease);
&.in {
height: auto;
}
}*/
.collapse {
position: relative;
height: 0;

View file

@ -196,7 +196,7 @@ a {
margin: 0;
padding: 0;
width: 100%;
height: 100%;
min-height: 20px;
-moz-box-sizing: border-box;
box-sizing: border-box;
}

File diff suppressed because one or more lines are too long

View file

@ -246,6 +246,26 @@ wn.ui.AppFrame = Class.extend({
.appendTo(this.toolbar)
.find("input");
},
add_field: function(df) {
this.show_toolbar();
var f = wn.ui.form.make_control({
df: df,
parent: this.toolbar,
only_input: true,
})
f.refresh();
$(f.wrapper)
.addClass('col-lg-2')
.css({
"display": "inline-block",
"margin-top": "0px",
"margin-bottom": "-17px",
"margin-left": "4px"
})
.attr("title", df.label).tooltip();
return f;
},
add_ripped_paper_effect: function(wrapper) {
if(!wrapper) var wrapper = wn.container.page;
var layout_main = $(wrapper).find('.layout-main');

View file

@ -22,8 +22,6 @@
wn.ui.FilterList = Class.extend({
init: function(opts) {
if(!window.make_field)
wn.require('js/fields.js');
$.extend(this, opts);
this.filters = [];
this.$w = this.$parent;

View file

@ -113,26 +113,9 @@ wn.views.QueryReport = Class.extend({
},
setup_filters: function() {
this.clear_filters();
var $filter_wrapper = $("<div class='filters' style='display:inline-block;'>\
</div>")
.appendTo(this.appframe.$w.find('.appframe-toolbar'));
var me = this;
$.each(wn.query_reports[this.report_name].filters || [], function(i, df) {
var f = make_field(df, null, $filter_wrapper.get(0), null, 0, 1);
f.df.single_select = 1;
f.df.placeholder = df.label;
f.not_in_form = 1;
f.with_label = 0;
f.in_filter = 1;
f.refresh();
$(f.wrapper)
.css({
"display": "inline-block",
"margin-left": "5px",
"margin-bottom": "4px",
"margin-top": "4px"
})
.attr("title", df.label).tooltip();
var f = me.appframe.add_field(df);
me.filters.push(f);
if(df["default"]) {
f.set_input(df["default"]);
@ -140,8 +123,6 @@ wn.views.QueryReport = Class.extend({
if(f.df.fieldtype == "Link")
$(f.wrapper).find("input, button").css({"margin-top":"-4px"});
else if(f.df.fieldtype == "Date")
$(f.wrapper).css({"margin-right":"-15px"});
if(df.get_query) f.get_query = df.get_query;
});
@ -165,7 +146,7 @@ wn.views.QueryReport = Class.extend({
"Loading Report...");
var filters = {};
$.each(this.filters || [], function(i, f) {
filters[f.df.fieldname] = f.get_value();
filters[f.df.fieldname] = f.get_parsed_value();
})
wn.call({
method: "webnotes.widgets.query_report.run",