Permalink
Browse files

fixed a design bug where disabled filters would reappear when clickin…

…g on a pagination/sorting link in index page
  • Loading branch information...
1 parent 645d678 commit 81d766a19f0b54f3274c4c142a2b3feb0f71761a @bbenezech bbenezech committed Nov 16, 2011
@@ -71,7 +71,7 @@
var content = '<div class="row filter clearfix">' +
'<span class="span3">' +
- '<span data-original-title="Click to remove this filter" rel="twipsy" class="btn info delete" data-disabler-name="f[' + field_name + '][' + index + '][disabled]">' + field_label + '</span>' +
+ '<span class="btn info delete">' + field_label + '</span>' +
'</span>' +
'<span class="span3">'+
control +
@@ -93,12 +93,12 @@
$(this).data('field-multiple_values'),
$.now().toString().slice(7,11)
);
- $("[rel=twipsy]").twipsy();
});
$('#filters_box .delete').live('click', function() {
- $(this).parents('.filter').hide('slow');
- $(this).append('<input type="hidden" name="' + $(this).data('disabler-name') + '" value="true" />')
+ form = $(this).parents('form');
+ $(this).parents('.filter').remove();
+ form.submit();
});
$('#filters_box .switch-select').live('dblclick', function() {
@@ -7,8 +7,6 @@
sort = params[:sort]
params.delete(:sort) if params[:sort] == @model_config.list.sort_by.to_s
-
-
properties = @model_config.list.with(:view => self, :object => @abstract_model.model.new).visible_fields
# columns paginate
@filterable_fields = @model_config.list.fields.select(&:filterable?)
@@ -179,7 +179,7 @@ def get_conditions_hash(model_config, query, filters)
unless query_statements.empty?
conditions[0] += " AND " unless conditions == [""]
- conditions[0] += "(#{query_statements.join(" OR ")})" # any column field will do
+ conditions[0] += "(#{query_statements.join(" OR ")})"
end
if filters.present?
@@ -188,13 +188,11 @@ def get_conditions_hash(model_config, query, filters)
filters_dump.each do |filter_index, filter_dump|
field_statements = []
@filterable_fields[field_name.to_sym].each do |field_infos|
- unless filter_dump[:disabled]
- statement, value1, value2 = build_statement(field_infos[:column], field_infos[:type], filter_dump[:v], (filter_dump[:o] || 'default'))
- if statement
- field_statements << statement
- values << value1 unless value1.nil?
- values << value2 unless value2.nil?
- end
+ statement, value1, value2 = build_statement(field_infos[:column], field_infos[:type], filter_dump[:v], (filter_dump[:o] || 'default'))
+ if statement
+ field_statements << statement
+ values << value1 unless value1.nil?
+ values << value2 unless value2.nil?
end
end
filters_statements << "(#{field_statements.join(' OR ')})" unless field_statements.empty?

0 comments on commit 81d766a

Please sign in to comment.