wice_grid 3.4.12 → 3.4.13

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 413aebde3b5db88a0344afa85967a8cc20bf8b93
4
- data.tar.gz: e5fb12b067ae1ab6f2b300be40c28ad5dc7b9b8e
3
+ metadata.gz: e2cb97f9ecd5d8d7b625783f98c7755abcd5e3ae
4
+ data.tar.gz: 959ae3433ce1f6fdee41048342a130a3ae7ac398
5
5
  SHA512:
6
- metadata.gz: 583884d003c2c0f4c37337431576de5c0864aca77ee4599032aaf1906c5a863d58279ef9b9158650790ae6728eee65a08a494edf19bcc68ccdc3dfbeb559c4f9
7
- data.tar.gz: 29520324979eadf2d8d3fa91a4ad3467630a4975e62ed17f498ae775e747956e49086d3ca7e9def66bb06d73f7b3a34d917ccc0eabeb02b488e260c02ceca09a
6
+ metadata.gz: 6cfd78fcff2570b2a46e023cf05d648da897dc75425120cdef085bee4d070e73afe90c077e2fbee6575e53204c90d6f5ba7a77a5c147c5a0b321d7d82c53a2a8
7
+ data.tar.gz: 03e6a2ca0f3eb761ba4ac6ab008b21b6f92cdc409da7058b58dcde26049bfad87991bf541cc3ce6f0e74c942f7b179369b71aa6ca325e5a0fe16b6366b801674
@@ -92,13 +92,18 @@ if defined?(Wice::Defaults)
92
92
  # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
93
93
  # Showing All Queries #
94
94
 
95
- # Enable or disable showing all queries (non-paginated table)
95
+ # Enable or disable showing all records (non-paginated table)
96
96
  Wice::Defaults::ALLOW_SHOWING_ALL_QUERIES = true
97
97
 
98
98
  # If number of all queries is more than this value, the user will be given a warning message
99
99
  Wice::Defaults::START_SHOWING_WARNING_FROM = 100
100
100
 
101
101
 
102
+ # Hide the "show all" link if the number of all records is more than...
103
+ # set to nil to shows it always
104
+ Wice::Defaults::HIDE_ALL_LINK_FROM = 500
105
+
106
+
102
107
  # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
103
108
  # Saving Queries #
104
109
 
@@ -700,12 +700,18 @@ module Wice
700
700
  else
701
701
  parameters << ["#{grid.name}[pp]", collection_total_entries]
702
702
 
703
+ show_all_records_link = allow_showing_all_records && collection_total_entries > collection.length
704
+
705
+ if show_all_records_link && limit = Wice::ConfigurationProvider.value_for(:HIDE_ALL_LINK_FROM, strict: false)
706
+ show_all_records_link = limit > collection_total_entries
707
+ end
708
+
703
709
  "#{first}-#{last} / #{collection_total_entries} " +
704
- if (! allow_showing_all_records) || collection_total_entries <= collection.length
705
- ''
706
- else
710
+ if show_all_records_link
707
711
  res, js = show_all_link(collection_total_entries, parameters, grid.name)
708
712
  res
713
+ else
714
+ ''
709
715
  end
710
716
  end +
711
717
  if grid.all_record_mode?
@@ -95,14 +95,16 @@ module Wice
95
95
  module ConfigurationProvider #:nodoc:
96
96
  class << self
97
97
 
98
- def value_for(key) #:nodoc:
98
+ def value_for(key, strict: true) #:nodoc:
99
99
  if Wice::Defaults.const_defined?(key)
100
100
  Wice::Defaults.const_get(key)
101
101
  else
102
- raise WiceGridMissingConfigurationConstantException.new("Could not find constant #{key} in the configuration file!" +
103
- " It is possible that the version of WiceGrid you are using is newer than the installed configuration file in config/initializers. " +
104
- "Constant Wice::Defaults::#{key} is missing and you need to add it manually to wice_grid_config.rb or run the generator task=:\n" +
105
- " rails g wice_grid:install")
102
+ if strict
103
+ raise WiceGridMissingConfigurationConstantException.new("Could not find constant #{key} in the configuration file!" +
104
+ " It is possible that the version of WiceGrid you are using is newer than the installed configuration file in config/initializers. " +
105
+ "Constant Wice::Defaults::#{key} is missing and you need to add it manually to wice_grid_config.rb or run the generator task=:\n" +
106
+ " rails g wice_grid:install")
107
+ end # else nil
106
108
  end
107
109
  end
108
110
 
data/lib/wice_grid.rb CHANGED
@@ -304,13 +304,15 @@ module Wice
304
304
  form_ar_options
305
305
  @klass.unscoped do
306
306
  @resultset = if self.output_csv? || all_record_mode?
307
- @relation.
307
+ relation = @relation.
308
308
  includes(@ar_options[:include]).
309
309
  joins( @ar_options[:joins]).
310
310
  order( @ar_options[:order]).
311
311
  group( @ar_options[:group]).
312
312
  where( @ar_options[:conditions])
313
-
313
+ relation = add_references relation
314
+
315
+ relation
314
316
  else
315
317
  # p @ar_options
316
318
  relation = @relation.
data/wice_grid.gemspec CHANGED
@@ -1,8 +1,8 @@
1
1
  Gem::Specification.new do |s|
2
2
  s.name = 'wice_grid'
3
- s.version = '3.4.12'
3
+ s.version = '3.4.13'
4
4
  s.homepage = 'https://github.com/leikind/wice_grid'
5
- s.date = '2014-12-31'
5
+ s.date = '2015-03-01'
6
6
  s.summary = 'A Rails grid plugin to create grids with sorting, pagination, and (automatically generated) filters.'
7
7
  s.description = 'A Rails grid plugin to create grids with sorting, pagination, and (automatically generated) filters.' +
8
8
  'One of the goals of this plugin was to allow the programmer to define the contents of the cell by himself, ' +
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: wice_grid
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.4.12
4
+ version: 3.4.13
5
5
  platform: ruby
6
6
  authors:
7
7
  - Yuri Leikind
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-12-31 00:00:00.000000000 Z
11
+ date: 2015-03-01 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: kaminari