simple_search_filter 0.0.20 → 0.0.21
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/views/simple_search_filter/_buttons_apply_clear.html.haml +1 -1
- data/app/views/simple_search_filter/_form_horizontal.html.haml +1 -1
- data/app/views/simple_search_filter/_form_inline.html.haml +1 -1
- data/lib/simple_search_filter/controller.rb +6 -2
- data/lib/simple_search_filter/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 48a2fa4094143fd44065e2ba090e976dec067388
|
4
|
+
data.tar.gz: 2ebb34a295a9f91e17474c2d205a33f070bda6a2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5153c6ee6761984989517e542c77192bdf5de1a8d389872d8ca9d9952c45ccc6da3a73b0bda75e796040ed26e3484f3a5dabf9192089f7dbd41cab0e9af50e83
|
7
|
+
data.tar.gz: 294c6333c9409ad3060d4e14694da2f91d538b8ea9a99ff00445996718649be5d99827fb8a3268cf0c3b4f397ac6b5db218460de14f6da5ce8c8dfafd31347eb
|
@@ -1,2 +1,2 @@
|
|
1
1
|
<button type="submit" class="btn btn-primary btn-sm">Apply</button>
|
2
|
-
<button type="button" class="btn btn-default btn-sm" onclick="$('#formFilter input[id=
|
2
|
+
<button type="button" class="btn btn-default btn-sm" onclick="$('#formFilter input[id=filter_cmd]').val('clear'); document.getElementById('formFilter').reset(); document.getElementById('formFilter').submit(); return false;">Clear</button>
|
@@ -1,7 +1,7 @@
|
|
1
1
|
- url = send(filter_object.search_url)
|
2
2
|
|
3
3
|
= simple_form_for(:filter, {url: url, method: filter_object.form_method, html: {id: 'formFilter', class: 'form-horizontal', role: 'form'}, wrapper: :horizontal_filter_form, wrapper_mappings: {check_boxes: :horizontal_filter_radio_and_checkboxes, radio_buttons: :horizontal_filter_radio_and_checkboxes, boolean: :horizontal_filter_boolean} }) do |f|
|
4
|
-
= hidden_field_tag '
|
4
|
+
= hidden_field_tag 'filter_cmd', 'apply'
|
5
5
|
= render 'simple_search_filter/fields', filter: filter_object, f: f
|
6
6
|
= render 'simple_search_filter/buttons_apply_clear_inline', filter: filter_object, f: f
|
7
7
|
|
@@ -2,6 +2,6 @@
|
|
2
2
|
|
3
3
|
-#= simple_form_for(:filter, {url: url, html: {id: 'formFilter', class: 'form-inline', role: 'form'}, wrapper: :inline_filter_form, wrapper_mappings: {} }) do |f|
|
4
4
|
= simple_form_for :filter, {url: url, html: {id: 'formFilter', class: 'form-inline', role: 'form'}, wrapper: :inline_filter_form, wrapper_mappings: {} } do |f|
|
5
|
-
= hidden_field_tag '
|
5
|
+
= hidden_field_tag 'filter_cmd', 'apply'
|
6
6
|
= render 'simple_search_filter/fields', filter: filter_object, f: f
|
7
7
|
= render 'simple_search_filter/buttons_apply_clear_inline', filter: filter_object, f: f
|
@@ -11,7 +11,7 @@ module SimpleSearchFilter
|
|
11
11
|
def init_search_data(name)
|
12
12
|
# input
|
13
13
|
pg = params[@filter.page_param_name]
|
14
|
-
cmd = params[:
|
14
|
+
cmd = params[:filter_cmd] || ''
|
15
15
|
|
16
16
|
# page
|
17
17
|
unless pg.nil?
|
@@ -44,8 +44,12 @@ module SimpleSearchFilter
|
|
44
44
|
#(redirect_to url and return) if @filter.search_method_post_and_redirect?
|
45
45
|
else
|
46
46
|
# clean url => set page to 1
|
47
|
-
if request.get? && cmd=='' && pg.nil?
|
47
|
+
if @filter.search_method_post_and_redirect? && request.get? && cmd=='' && pg.nil?
|
48
48
|
@filter.page=1
|
49
|
+
elsif cmd=='back'
|
50
|
+
# do not touch filter - load it from session
|
51
|
+
|
52
|
+
|
49
53
|
end
|
50
54
|
|
51
55
|
end
|