Merge branch 'feature/widgets' into feature/dependent

pull/6827/head
Philipp Tessenow 14 years ago
commit 3f95b2f454
  1. 12
      assets/javascripts/reporting/filters.js
  2. 16
      lib/report/controller.rb

@ -142,6 +142,10 @@ Reporting.Filters = {
Reporting.Filters.visible_filters().each(function (filter) {
Reporting.Filters.remove_filter(filter);
});
},
narrow_values: function (dependent_name) {
console.log("Narrowing values not implemented");
}
};
@ -172,4 +176,12 @@ Reporting.onload(function () {
}).size();
s.multiple = (selected_size > 1);
});
$$('.filters-select[data-dependent]').each(function (dependency) {
dependency.observe("change", function () {
var dependent_name = this.getAttribute("data-dependent");
$("add_filter_select").select("option[value='" + dependent_name + "']").first().selected = true;
Reporting.Filters.add_filter($("add_filter_select"));
Reporting.Filters.narrow_values(dependent_name);
});
});
});

@ -100,6 +100,22 @@ module Report::Controller
end
end
##
# Determine the available values for the specified filter and return them as
# json
def values
dependency = params[:dependency].to_sym
dependent = params[:dependent]
query = CostQuery.new
query.filter(dependency,
:operator => params[:operators][dependency],
:values => params[:values][dependency])
query.column(dependent)
values = query.result.collect {|r| r.fields[dependent] }
render :text => values.to_json
end
##
# Determine the requested engine by constantizing from the :engine parameter
# Sets @report_engine and @title based on that, and makes the engine available

Loading…
Cancel
Save