disable filters by clicking a remove button instead of unchecking them. removed filters will be 'put back' into the add filter select box

git-svn-id: https://dev.finn.de/svn/cockpit/branches/reporting_merge@1741 7926756e-e54e-46e6-9721-ed318f58905e
pull/6827/head
j.wollert 14 years ago
parent 2c50e4dd21
commit 4a6a07a967
  1. 19
      app/views/cost_reports/filters/_activate_filter.rhtml
  2. 29
      assets/javascripts/reporting.js
  3. 8
      assets/stylesheets/reporting.css

@ -1,14 +1,13 @@
<%#
This partial requires the following locals:
element a Hash containing the following keys:
- :name => :activate_filter
- :filter_name => String: The name of a filter (e.g. activity_id)
- :label => String: A text which is shown to the user as a label for this filter
- :width => Integer (optional): The width this partial may consume. If not given, a standard width will be applied
<%=
#This partial requires the following locals:
# element a Hash containing the following keys:
# - :name => :activate_filter
# - :filter_name => String: The name of a filter (e.g. activity_id)
# - :label => String: A text which is shown to the user as a label for this filter
# - :width => Integer (optional): The width this partial may consume. If not given, a standard width will be applied
%>
<td width="<%= element[:width] || 200 %>">
<input id="cb_<%= element[:filter_name] %>" name="fields[]" onclick="toggle_filter('<%= element[:filter_name] %>');"
type="checkbox" value="<%= element[:filter_name] %>" />
<label for="cb_<%= element[:filter_name] %>"><%= element[:label] %></label>
<a href="#" id="rm_<%= element[:filter_name] %>" onclick="removed_filter('<%= element[:filter_name]%>'); return false;" class="icon icon-filterdel"></a>
<label><%= element[:label] %></label>
</td>

@ -1,15 +1,15 @@
/*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) {
to_toggle.invoke('show');
var remove, to_toggle;
remove = $('rm_' + field);
to_toggle = remove.up().siblings();
if (remove.display) {
to_toggle.invoke('hide');
}
else {
to_toggle.invoke('hide');
to_toggle.invoke('show');
}
}
@ -62,11 +62,9 @@ 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);
operator_changed(field, $("operators_" + field));
display_category(field_el);
@ -74,11 +72,9 @@ function show_filter(field) {
}
function hide_filter(field) {
var field_el = $('tr_' + field), check_box = null;
var field_el = $('tr_' + field)
if (field_el !== null) {
field_el.hide();
check_box = $('cb_' + field);
check_box.checked = false;
toggle_filter(field);
operator_changed(field, $("operators_" + field));
}
@ -110,6 +106,13 @@ function add_filter(select) {
disable_select_option(select, field);
}
function removed_filter(field) {
var select, field;
select = $("add_filter_select");
hide_filter(field);
enable_select_option(select, field)
}
function show_group_by(group_by, target) {
var source, group_option, i;
source = $("group_by_container");

@ -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,7 @@
background-image: url(../images/arrow_B_down.gif);
}
.icon-filterdel {
background-image: url(../images/filter_del.png);
}

Loading…
Cancel
Save