fix clear and filter restore JS via className since the class name has changed

pull/6827/head
Tim Felgentreff 14 years ago
parent f72e0743c7
commit 2137a99a96
  1. 2
      assets/javascripts/reporting/filters.js
  2. 4
      assets/javascripts/reporting/restore_query.js
  3. 4
      lib/widget/filters.rb
  4. 3
      lib/widget/filters/remove_button.rb

@ -134,7 +134,7 @@ Reporting.Filters = {
return $("filter_table").childElements().first().select('tr').select(function (tr) {
return tr.visible() === true;
}).collect(function (filter) {
return filter.className;
return filter.getAttribute("data-filter-name");
});
},

@ -66,7 +66,9 @@ Reporting.RestoreQuery = {
// FIXME: rm_xxx values for filters have to be set after re-displaying them
$$("tr[data-selected=true]").each(function (e) {
var rm_box = e.select("input[id^=rm]").first();
rm_box.value = rm_box.getAttribute("data-filter-name");
var filter_name = e.getAttribute("data-filter-name");
rm_box.value = filter_name;
Reporting.Filters.select_option_enabled($("add_filter_select"), filter_name, false);
});
}
};

@ -34,7 +34,9 @@ class Widget::Filters < Widget::Base
def render_filters
active_filters = @query.filters.select { |f| f.class.display? }
engine::Filter.all.collect do |filter|
opts = {:id => "tr_#{filter.underscore_name}", :class => "#{filter.underscore_name} filter"}
opts = {:id => "tr_#{filter.underscore_name}",
:class => "#{filter.underscore_name} filter",
:"data-filter-name" => filter.underscore_name }
active_instance = active_filters.detect { |f| f.class == filter }
if active_instance
opts[:"data-selected"] = true

@ -3,8 +3,7 @@ class Widget::Filters::RemoveButton < Widget::Filters::Base
content_tag :td, :width => "25px" do
tag :input, :id => "rm_#{filter_class.underscore_name}",
:name => "fields[]", :type => "button", :value => "",
:class => "icon filter_rem icon-filter-rem",
:"data-filter-name" => filter_class.underscore_name
:class => "icon filter_rem icon-filter-rem"
end
end
end

Loading…
Cancel
Save