smart_table 0.0.6 → 0.0.7
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +9 -0
- data/app/assets/stylesheets/smart_table.scss +1 -1
- data/app/controllers/concerns/smart_table/smart_table_concern.rb +6 -1
- data/app/helpers/smart_table/smart_table_helper.rb +2 -2
- data/lib/smart_table/version.rb +1 -1
- metadata +2 -7
- data/smart_table-0.0.1.gem +0 -0
- data/smart_table-0.0.2.gem +0 -0
- data/smart_table-0.0.3.gem +0 -0
- data/smart_table-0.0.4.gem +0 -0
- data/smart_table-0.0.5.gem +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1db263f81ea99ecb98bdd3d489e5d26c78185de5a898580a9e7ef01df14094a0
|
4
|
+
data.tar.gz: ad0f2d48342d05fdad85fef5e7439f397507b024dcd3c9253824d0bd1b8ad8e4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7ccf44e9d7d0c7f409d27987917386e2facaa4f5d599ab41c5016e2be818f975105e11315c9d62d8420baa2c625f13adaf08bc29d590ba486d6625d3bd84fdeb
|
7
|
+
data.tar.gz: 68d32cd3588d43aaba371a40184cd5af7cf438160175ac03b3035eccf02091ceb7526a37ff80b183861da5fd4161925668d6994d1f75d3f46436ccaa17af4472
|
data/README.md
CHANGED
@@ -133,3 +133,12 @@ The following snippet shows how to use different input types to make custom filt
|
|
133
133
|
<%= radio_button_tag("category", "java", params["category"] == 'java') %>
|
134
134
|
<% end %>
|
135
135
|
```
|
136
|
+
|
137
|
+
### Setting Up Defaults
|
138
|
+
```ruby
|
139
|
+
smart_table_params = smart_table_params(
|
140
|
+
initial_page_size: 20,
|
141
|
+
initial_sort_attribute: :name,
|
142
|
+
initial_sort_order: :desc
|
143
|
+
)
|
144
|
+
```
|
@@ -26,11 +26,16 @@ module SmartTable
|
|
26
26
|
end
|
27
27
|
end
|
28
28
|
|
29
|
-
def smart_table_params(initial_page_size: 25)
|
29
|
+
def smart_table_params(initial_page_size: 25, initial_sort_attribute: nil, initial_sort_order: :asc)
|
30
30
|
return @st_params if @st_params
|
31
31
|
|
32
32
|
@st_params = Params.new
|
33
|
+
|
33
34
|
@st_params.sort = params[SORT_PARAM]
|
35
|
+
if @st_params.sort.nil? && initial_sort_attribute
|
36
|
+
@st_params.sort = "#{initial_sort_attribute} #{initial_sort_order}"
|
37
|
+
end
|
38
|
+
|
34
39
|
@st_params.search = params[SEARCH_PARAM]
|
35
40
|
@st_params.page_size = params[PAGE_SIZE_PARAM] || initial_page_size
|
36
41
|
if @st_params.page_size == SHOW_ALL
|
@@ -23,7 +23,7 @@ module SmartTable
|
|
23
23
|
raise 'smart_table_params must be called on the controller, before using smart_table_paginate helper' unless get_cached_smart_table_params
|
24
24
|
|
25
25
|
paginatable_array = Kaminari.
|
26
|
-
paginate_array(records, total_count: total_records_count).
|
26
|
+
paginate_array(records.to_a, total_count: total_records_count).
|
27
27
|
page(get_cached_smart_table_params.page_number).
|
28
28
|
per(get_cached_smart_table_params.page_size)
|
29
29
|
|
@@ -126,7 +126,7 @@ module SmartTable
|
|
126
126
|
page_size.to_s
|
127
127
|
else
|
128
128
|
human_page_size = (page_size == SHOW_ALL ? I18n.t('smart_table.show_all') : page_size.to_s)
|
129
|
-
link_to human_page_size, current_request_url_with_merged_query_params(PAGE_SIZE_PARAM => page_size)
|
129
|
+
link_to human_page_size, current_request_url_with_merged_query_params(PAGE_SIZE_PARAM => page_size, PAGE_PARAM => 1)
|
130
130
|
end
|
131
131
|
end.join(' ')
|
132
132
|
).html_safe
|
data/lib/smart_table/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: smart_table
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.7
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Henrique Gubert
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-07-
|
11
|
+
date: 2018-07-18 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
@@ -186,11 +186,6 @@ files:
|
|
186
186
|
- "./lib/smart_table/config.rb"
|
187
187
|
- "./lib/smart_table/engine.rb"
|
188
188
|
- "./lib/smart_table/version.rb"
|
189
|
-
- "./smart_table-0.0.1.gem"
|
190
|
-
- "./smart_table-0.0.2.gem"
|
191
|
-
- "./smart_table-0.0.3.gem"
|
192
|
-
- "./smart_table-0.0.4.gem"
|
193
|
-
- "./smart_table-0.0.5.gem"
|
194
189
|
- "./smart_table.gemspec"
|
195
190
|
- "./spec/dummy_app/Rakefile"
|
196
191
|
- "./spec/dummy_app/app/assets/config/manifest.js"
|
data/smart_table-0.0.1.gem
DELETED
Binary file
|
data/smart_table-0.0.2.gem
DELETED
Binary file
|
data/smart_table-0.0.3.gem
DELETED
Binary file
|
data/smart_table-0.0.4.gem
DELETED
Binary file
|
data/smart_table-0.0.5.gem
DELETED
Binary file
|