removed not working clear-button and added reset-buton that resets the form.

git-svn-id: https://dev.finn.de/svn/cockpit/branches/reporting_merge@1480 7926756e-e54e-46e6-9721-ed318f58905e
pull/6827/head
p.tessenow 14 years ago
parent dd36130442
commit a87fb9ca44
  1. 2
      app/views/cost_reports/_restore_query.rhtml
  2. 6
      app/views/cost_reports/index.rhtml
  3. 39
      assets/javascripts/reporting.js

@ -1,6 +1,8 @@
<script type="text/javascript">
//<![CDATA[
restore_query_inputs =function() {
disable_all_filters();
disable_all_group_bys();
set_filters();
set_group_bys();
}

@ -33,11 +33,7 @@
:eval_scripts => true
}, :class => 'icon icon-checked' %>
<%= link_to_remote l(:button_clear),
{ :url => { :set_filter => 1 },
:update => "content",
:eval_scripts => true
}, :class => 'icon icon-reload' %>
<%= link_to_function l(:button_reset), "restore_query_inputs();", :class => 'icon icon-reload' %>
<% if User.current.allowed_to?(:save_queries, @project, :global => true) %>
<%
#link_to l(:button_save), {}, :onclick => "$('query_form').submit(); return false;", :class => 'icon icon-save'

@ -39,8 +39,18 @@ function show_filter(field) {
check_box = $('cb_' + field);
check_box.checked = true;
toggle_filter(field);
operator_changed(field, $("operators_" + field))
display_category(field_el)
operator_changed(field, $("operators_" + field));
display_category(field_el);
}
}
function hide_filter(field) {
if ((field_el = $('tr_' + field)) != null) {
field_el.hide();
check_box = $('cb_' + field);
check_box.checked = false;
toggle_filter(field);
operator_changed(field, $("operators_" + field));
}
}
@ -58,6 +68,15 @@ function disable_select_option(select, field) {
}
}
function enable_select_option(select, field) {
for (i=0; i<select.options.length; i++) {
if (select.options[i].value == field) {
select.options[i].disabled = false;
break;
}
}
}
function add_filter(select) {
field = select.value;
show_filter(field);
@ -143,3 +162,19 @@ function show_group_by_column(group_by) {
function show_group_by_row(group_by) {
show_group_by(group_by, $('group_by_rows'));
}
function disable_all_filters() {
$('filter_table').down().childElements().each(function(e){
e.hide();
if (e.readAttribute('class')=='filter')
hide_filter(e.id.gsub('tr_', ''));
});
}
function disable_all_group_bys() {
destination = $('group_by_container');
[$('group_by_columns'), $('group_by_rows')].each(function(origin) {
selectAllOptions(origin);
moveOptions(origin, destination);
});
}

Loading…
Cancel
Save