From 0f4fadf1baa2be7fd55d40d1ec2188c5c7de02d7 Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Fri, 6 Dec 2013 16:37:22 +0530 Subject: [PATCH] [minor] set filter in query report for checkbox --- public/js/wn/ui/appframe.js | 13 ++++++++++++- public/js/wn/views/query_report.js | 18 +++++++++++------- 2 files changed, 23 insertions(+), 8 deletions(-) diff --git a/public/js/wn/ui/appframe.js b/public/js/wn/ui/appframe.js index 694f34ccb9..7bb0e83c9d 100644 --- a/public/js/wn/ui/appframe.js +++ b/public/js/wn/ui/appframe.js @@ -275,12 +275,17 @@ wn.ui.AppFrame = Class.extend({ .appendTo(this.parent.find(".appframe-form .container")) .find("input"); }, + add_break: function() { + // add further fields in the next line + this.parent.find(".appframe-form .container") + .append(''); + }, add_field: function(df) { this.show_form(); var f = wn.ui.form.make_control({ df: df, parent: this.parent.find(".appframe-form .container"), - only_input: true, + only_input: df.fieldtype=="Check" ? false : true, }) f.refresh(); $(f.wrapper) @@ -292,6 +297,12 @@ wn.ui.AppFrame = Class.extend({ }) .attr("title", wn._(df.label)).tooltip(); f.$input.attr("placeholder", wn._(df.label)); + + if(df.fieldtype==="Check") { + $(f.wrapper).find(":first-child") + .removeClass("col-md-offset-4 col-md-8"); + } + if(df["default"]) f.set_input(df["default"]) this.fields_dict[df.fieldname || df.label] = f; diff --git a/public/js/wn/views/query_report.js b/public/js/wn/views/query_report.js index 9a27c186b9..d85c98f7b9 100644 --- a/public/js/wn/views/query_report.js +++ b/public/js/wn/views/query_report.js @@ -111,14 +111,18 @@ wn.views.QueryReport = Class.extend({ this.clear_filters(); var me = this; $.each(wn.query_reports[this.report_name].filters || [], function(i, df) { - var f = me.appframe.add_field(df); - $(f.wrapper).addClass("filters pull-left"); - me.filters.push(f); - if(df["default"]) { - f.set_input(df["default"]); - } + if(df.fieldtype==="Break") { + me.appframe.add_break(); + } else { + var f = me.appframe.add_field(df); + $(f.wrapper).addClass("filters pull-left"); + me.filters.push(f); + if(df["default"]) { + f.set_input(df["default"]); + } - if(df.get_query) f.get_query = df.get_query; + if(df.get_query) f.get_query = df.get_query; + } }); this.set_filters_by_name(); },