smart_table 0.0.7 → 0.0.8

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
  SHA256:
3
- metadata.gz: 1db263f81ea99ecb98bdd3d489e5d26c78185de5a898580a9e7ef01df14094a0
4
- data.tar.gz: ad0f2d48342d05fdad85fef5e7439f397507b024dcd3c9253824d0bd1b8ad8e4
3
+ metadata.gz: 224c0be14daa5e13ef122e4aeea2066df005abd593bd452960ae8f36d6ed3f11
4
+ data.tar.gz: e3cb3b5ff817ddf96700c39cdc036f06b1f89ed94bcbf8e50903e5d2887f0b55
5
5
  SHA512:
6
- metadata.gz: 7ccf44e9d7d0c7f409d27987917386e2facaa4f5d599ab41c5016e2be818f975105e11315c9d62d8420baa2c625f13adaf08bc29d590ba486d6625d3bd84fdeb
7
- data.tar.gz: 68d32cd3588d43aaba371a40184cd5af7cf438160175ac03b3035eccf02091ceb7526a37ff80b183861da5fd4161925668d6994d1f75d3f46436ccaa17af4472
6
+ metadata.gz: e1d77e21f232f87f2e26f7f95e42c7b2aaa44c047bb5062f09ea2ea3625b21b8fbf6223f30fcce367c85cc0749c9a1949ef865e551a1e62a45ab361d0b71d99b
7
+ data.tar.gz: 928f648e82098247902534638b3c812a75c990d38e82cae55df9223d4a0e8e048690e71209c48fb038437bc549a74dba8ad48bc03d33b7e7f8ec1ba3da977609
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- smart_table (0.0.2)
4
+ smart_table (0.0.8)
5
5
  font-awesome-rails (> 4.0.0, < 5)
6
6
  kaminari (> 0.16, < 2)
7
7
  rails (> 4.2.0, < 5.3.0)
@@ -25,7 +25,7 @@ module SmartTable
25
25
  paginatable_array = Kaminari.
26
26
  paginate_array(records.to_a, total_count: total_records_count).
27
27
  page(get_cached_smart_table_params.page_number).
28
- per(get_cached_smart_table_params.page_size)
28
+ per(get_cached_smart_table_params.page_size || 99999999) # kaminari needs a page size. If you pass nil it will use the default. So we use a very big number to represent no limit
29
29
 
30
30
  html_elements = []
31
31
 
@@ -112,20 +112,21 @@ module SmartTable
112
112
  page_sizes.uniq!
113
113
  page_sizes.sort!
114
114
 
115
- if page_sizes.last >= total_records_count || get_cached_smart_table_params.page_size.nil?
115
+ if page_sizes.last >= total_records_count
116
116
  page_sizes.reject! {|size| size > total_records_count}
117
- page_sizes << SHOW_ALL
118
117
  end
118
+
119
+ page_sizes << SHOW_ALL
119
120
 
120
121
  content_tag(:div, class: 'text-center') do
121
122
  (
122
123
  record_model_name.pluralize + ' ' +
123
124
  I18n.t('smart_table.per_page') + ': ' +
124
125
  page_sizes.map do |page_size|
125
- if page_size == get_cached_smart_table_params.page_size
126
- page_size.to_s
126
+ human_page_size = (page_size == SHOW_ALL ? I18n.t('smart_table.show_all') : page_size.to_s)
127
+ if page_size == get_cached_smart_table_params.page_size || page_size == SHOW_ALL && get_cached_smart_table_params.page_size.nil?
128
+ human_page_size
127
129
  else
128
- human_page_size = (page_size == SHOW_ALL ? I18n.t('smart_table.show_all') : page_size.to_s)
129
130
  link_to human_page_size, current_request_url_with_merged_query_params(PAGE_SIZE_PARAM => page_size, PAGE_PARAM => 1)
130
131
  end
131
132
  end.join(' ')
@@ -1,3 +1,3 @@
1
1
  module SmartTable
2
- VERSION = "0.0.7"
2
+ VERSION = "0.0.8"
3
3
  end
Binary file
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: smart_table
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.7
4
+ version: 0.0.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - Henrique Gubert
@@ -186,6 +186,7 @@ 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.7.gem"
189
190
  - "./smart_table.gemspec"
190
191
  - "./spec/dummy_app/Rakefile"
191
192
  - "./spec/dummy_app/app/assets/config/manifest.js"