diff --git a/app/controllers/cost_reports_controller.rb b/app/controllers/cost_reports_controller.rb index 5219ebcf45..833438b2fd 100644 --- a/app/controllers/cost_reports_controller.rb +++ b/app/controllers/cost_reports_controller.rb @@ -42,7 +42,7 @@ class CostReportsController < ApplicationController ## # Extract active filters from the http params def http_filter_parameters - (params[:fields] || []).inject({:operators => {}, :values => {}}) do |hash, field| + (params[:fields].reject { |f| f.empty? } || []).inject({:operators => {}, :values => {}}) do |hash, field| hash[:operators][field.to_sym] = params[:operators][field] hash[:values][field.to_sym] = params[:values][field] hash diff --git a/app/views/cost_reports/filters/_activate_filter.rhtml b/app/views/cost_reports/filters/_activate_filter.rhtml index 7f67bb69f1..9d43953c2f 100644 --- a/app/views/cost_reports/filters/_activate_filter.rhtml +++ b/app/views/cost_reports/filters/_activate_filter.rhtml @@ -8,7 +8,7 @@ %> - - + + \ No newline at end of file diff --git a/assets/images/filter_del.png b/assets/images/filter_rem.png similarity index 100% rename from assets/images/filter_del.png rename to assets/images/filter_rem.png diff --git a/assets/javascripts/reporting.js b/assets/javascripts/reporting.js index 97a13f9a0c..9c87dc75ef 100644 --- a/assets/javascripts/reporting.js +++ b/assets/javascripts/reporting.js @@ -1,11 +1,10 @@ /*global $, selectAllOptions, moveOptions */ function toggle_filter(field) { - var check_box, to_toggle; - check_box = $('cb_' + field); - to_toggle = check_box.up().siblings(); - - if (check_box.checked) { + var remove, to_toggle; + remove = $('rm_' + field); + to_toggle = remove.up().siblings(); + if (remove.visible()) { to_toggle.invoke('show'); } else { @@ -62,23 +61,21 @@ function display_category(tr_field) { } function show_filter(field) { - var field_el = $('tr_' + field), check_box = null; + var field_el = $('tr_' + field); if (field_el !== null) { field_el.show(); - check_box = $('cb_' + field); - check_box.checked = true; toggle_filter(field); + $('rm_' + field).value = field; operator_changed(field, $("operators_" + field)); display_category(field_el); } } function hide_filter(field) { - var field_el = $('tr_' + field), check_box = null; + var field_el = $('tr_' + field); if (field_el !== null) { + $('rm_' + field).value = ""; field_el.hide(); - check_box = $('cb_' + field); - check_box.checked = false; toggle_filter(field); operator_changed(field, $("operators_" + field)); } @@ -110,6 +107,11 @@ function add_filter(select) { disable_select_option(select, field); } +function remove_filter(field) { + hide_filter(field); + enable_select_option($("add_filter_select"), field); +} + function show_group_by(group_by, target) { var source, group_option, i; source = $("group_by_container"); diff --git a/assets/stylesheets/reporting.css b/assets/stylesheets/reporting.css index c803885d0e..31ce44a70b 100644 --- a/assets/stylesheets/reporting.css +++ b/assets/stylesheets/reporting.css @@ -9,7 +9,7 @@ .report { text-align: center; - border-collapse: collapse; + border-collapse: collapse; border: solid 1px #ccc !important; width: auto !important; } @@ -135,7 +135,7 @@ .moveLeft { margin-left: 0px; - margin-right: 0px; + margin-right: 0px; background-image: url(../images/arrow_D_left.gif); } @@ -157,3 +157,17 @@ background-image: url(../images/arrow_B_down.gif); } +.filter_rem { + overflow: hidden; + font-size: 0 !important; + line-height: 0 !important; + cursor: pointer; + background-image: url(../images/filter_rem.png); + background-repeat: no-repeat; + background-color: transparent; + background-position: 50%; + height: 16px; + width: 16px; + border-style: none; +} +