index_for 0.3.1 → 0.3.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 181813155c5638c7fd110640f99c9d36bb75de90
|
4
|
+
data.tar.gz: 75092c0750b6d76c5738209bac2afced08432e46
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f880f014e3db919294bb2b5b6112f6fe4f14348e75a96948512d38c1de146180e240048b9522ff251e6bcaa0c13c29fb17e1d10ae79a6e5748ae2ab6cc0e789a
|
7
|
+
data.tar.gz: 0a7a161772673a5647ef3d3317262a148f3b112ca654f77b185eb4df1ebf34ce052f5ce439174c56a66097ab18facceeda6b0f4ba5c3b68ab505da8e2db48525
|
@@ -12,7 +12,7 @@
|
|
12
12
|
|
13
13
|
<div class="col-sm-6 text-right index_for_filter">
|
14
14
|
Search:
|
15
|
-
<input type="search" class="form-control input" placeholder="<%= params[:search] %>" data-href="<%= url_for(params.merge(search: nil)) %>">
|
15
|
+
<input type="search" class="form-control input" placeholder="<%= params[:search] %>" data-href="<%= url_for(params.merge(search: nil, page: 1)) %>">
|
16
16
|
</div>
|
17
17
|
</div>
|
18
18
|
|
@@ -32,34 +32,32 @@
|
|
32
32
|
</div>
|
33
33
|
|
34
34
|
<script type="text/javascript">
|
35
|
-
$(
|
36
|
-
$(
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
$
|
41
|
-
|
42
|
-
|
43
|
-
});
|
35
|
+
$(".wice_index_for").each(function() {
|
36
|
+
var $this = $(this);
|
37
|
+
if ($this.data("wice-index-for")) return;
|
38
|
+
$this.data("wice-index-for", true);
|
39
|
+
$this.find(".index_for_length select").change(function(event) {
|
40
|
+
var location = $(event.target).find("option:selected").data("href");
|
41
|
+
if (location) window.location = location;
|
42
|
+
});
|
44
43
|
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
44
|
+
$this.find(".index_for thead th").click(function(event) {
|
45
|
+
var location = $(event.target).data("href");
|
46
|
+
if (location) window.location = location;
|
47
|
+
});
|
49
48
|
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
}
|
49
|
+
$this.find(".index_for_filter input").keypress(function(event) {
|
50
|
+
if (event.which === 13 || event.keyCode === 13) {
|
51
|
+
var location = $(event.target).data("href"),
|
52
|
+
search = $(event.target).val();
|
53
|
+
if (location) {
|
54
|
+
if (location.indexOf("?") >= 0) {
|
55
|
+
window.location = location + "&search=" + search;
|
56
|
+
} else {
|
57
|
+
window.location = location + "?search=" + search;
|
60
58
|
}
|
61
59
|
}
|
62
|
-
}
|
60
|
+
}
|
63
61
|
})
|
64
62
|
});
|
65
63
|
</script>
|
@@ -4,12 +4,15 @@
|
|
4
4
|
Show
|
5
5
|
%select.form-control.input
|
6
6
|
- builder.per_pages do |per_page, url, active|
|
7
|
-
%option{
|
8
|
-
=
|
7
|
+
%option{"data-href" => ""}
|
8
|
+
= url
|
9
|
+
" #{selected if active}>#{per_page}
|
9
10
|
entries
|
10
11
|
.col-sm-6.text-right.index_for_filter
|
11
12
|
Search:
|
12
|
-
%input.form-control.input{
|
13
|
+
%input.form-control.input{:placeholder => "", :type => "search"}/
|
14
|
+
= params[:search]
|
15
|
+
" data-href="#{url_for(params.merge(search: nil, page: 1))}">
|
13
16
|
.row
|
14
17
|
.col-sm-12
|
15
18
|
- html_options[:head_builder] ||= IndexFor::WiceHeadColumnBuilder
|
@@ -18,3 +21,33 @@
|
|
18
21
|
.col-sm-5.index_for_info= page_entries_info objects
|
19
22
|
.col-sm-7.text-right.index_for_pagination
|
20
23
|
= paginate objects, window: 2
|
24
|
+
|
25
|
+
:javascript
|
26
|
+
$(".wice_index_for").each(function() {
|
27
|
+
var $this = $(this);
|
28
|
+
if ($this.data("wice-index-for")) return;
|
29
|
+
$this.data("wice-index-for", true);
|
30
|
+
$this.find(".index_for_length select").change(function(event) {
|
31
|
+
var location = $(event.target).find("option:selected").data("href");
|
32
|
+
if (location) window.location = location;
|
33
|
+
});
|
34
|
+
|
35
|
+
$this.find(".index_for thead th").click(function(event) {
|
36
|
+
var location = $(event.target).data("href");
|
37
|
+
if (location) window.location = location;
|
38
|
+
});
|
39
|
+
|
40
|
+
$this.find(".index_for_filter input").keypress(function(event) {
|
41
|
+
if (event.which === 13 || event.keyCode === 13) {
|
42
|
+
var location = $(event.target).data("href"),
|
43
|
+
search = $(event.target).val();
|
44
|
+
if (location) {
|
45
|
+
if (location.indexOf("?") >= 0) {
|
46
|
+
window.location = location + "&search=" + search;
|
47
|
+
} else {
|
48
|
+
window.location = location + "?search=" + search;
|
49
|
+
}
|
50
|
+
}
|
51
|
+
}
|
52
|
+
})
|
53
|
+
});
|
@@ -4,12 +4,15 @@
|
|
4
4
|
| Show
|
5
5
|
select.form-control.input
|
6
6
|
- builder.per_pages do |per_page, url, active|
|
7
|
-
option
|
8
|
-
=
|
7
|
+
option data-href=""
|
8
|
+
= url
|
9
|
+
| " #{selected if active}>#{per_page}
|
9
10
|
| entries
|
10
11
|
.col-sm-6.text-right.index_for_filter
|
11
12
|
| Search:
|
12
|
-
input.form-control.input
|
13
|
+
input.form-control.input placeholder="" type="search" /
|
14
|
+
= params[:search]
|
15
|
+
| " data-href="#{url_for(params.merge(search: nil, page: 1))}">
|
13
16
|
.row
|
14
17
|
.col-sm-12
|
15
18
|
- html_options[:head_builder] ||= IndexFor::WiceHeadColumnBuilder
|
@@ -18,3 +21,33 @@
|
|
18
21
|
.col-sm-5.index_for_info= page_entries_info objects
|
19
22
|
.col-sm-7.text-right.index_for_pagination
|
20
23
|
= paginate objects, window: 2
|
24
|
+
|
25
|
+
javascript:
|
26
|
+
$(".wice_index_for").each(function() {
|
27
|
+
var $this = $(this);
|
28
|
+
if ($this.data("wice-index-for")) return;
|
29
|
+
$this.data("wice-index-for", true);
|
30
|
+
$this.find(".index_for_length select").change(function(event) {
|
31
|
+
var location = $(event.target).find("option:selected").data("href");
|
32
|
+
if (location) window.location = location;
|
33
|
+
});
|
34
|
+
|
35
|
+
$this.find(".index_for thead th").click(function(event) {
|
36
|
+
var location = $(event.target).data("href");
|
37
|
+
if (location) window.location = location;
|
38
|
+
});
|
39
|
+
|
40
|
+
$this.find(".index_for_filter input").keypress(function(event) {
|
41
|
+
if (event.which === 13 || event.keyCode === 13) {
|
42
|
+
var location = $(event.target).data("href"),
|
43
|
+
search = $(event.target).val();
|
44
|
+
if (location) {
|
45
|
+
if (location.indexOf("?") >= 0) {
|
46
|
+
window.location = location + "&search=" + search;
|
47
|
+
} else {
|
48
|
+
window.location = location + "?search=" + search;
|
49
|
+
}
|
50
|
+
}
|
51
|
+
}
|
52
|
+
})
|
53
|
+
});
|
data/lib/index_for/version.rb
CHANGED