wice_grid 3.6.0 → 3.6.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.rubocop.yml +8 -3
- data/Gemfile +0 -1
- data/Rakefile +1 -11
- data/config/locales/uk.yml +29 -29
- data/lib/generators/wice_grid/add_migration_for_serialized_queries_generator.rb +0 -1
- data/lib/generators/wice_grid/install_generator.rb +0 -1
- data/lib/generators/wice_grid/templates/create_wice_grid_serialized_queries.rb +0 -1
- data/lib/generators/wice_grid/templates/wice_grid_config.rb +3 -4
- data/lib/wice/active_record_column_wrapper.rb +1 -2
- data/lib/wice/columns.rb +9 -10
- data/lib/wice/columns/column_action.rb +0 -1
- data/lib/wice/columns/column_boolean.rb +0 -1
- data/lib/wice/columns/column_bootstrap_datepicker.rb +0 -1
- data/lib/wice/columns/column_custom_dropdown.rb +0 -1
- data/lib/wice/columns/column_float.rb +0 -1
- data/lib/wice/columns/column_html5_datepicker.rb +0 -1
- data/lib/wice/columns/column_integer.rb +0 -1
- data/lib/wice/columns/column_jquery_datepicker.rb +0 -1
- data/lib/wice/columns/column_processor_index.rb +0 -1
- data/lib/wice/columns/column_rails_date_helper.rb +0 -1
- data/lib/wice/columns/column_rails_datetime_helper.rb +0 -1
- data/lib/wice/columns/column_range.rb +0 -1
- data/lib/wice/columns/column_string.rb +0 -1
- data/lib/wice/columns/common_date_datetime_mixin.rb +0 -1
- data/lib/wice/columns/common_js_date_datetime_conditions_generator_mixin.rb +0 -1
- data/lib/wice/columns/common_js_date_datetime_mixin.rb +0 -1
- data/lib/wice/columns/common_rails_date_datetime_conditions_generator_mixin.rb +0 -1
- data/lib/wice/columns/common_standard_helper_date_datetime_mixin.rb +0 -1
- data/lib/wice/grid_output_buffer.rb +3 -4
- data/lib/wice/grid_renderer.rb +11 -12
- data/lib/wice/helpers/bs_calendar_helpers.rb +2 -3
- data/lib/wice/helpers/js_calendar_helpers.rb +1 -2
- data/lib/wice/helpers/wice_grid_misc_view_helpers.rb +2 -3
- data/lib/wice/helpers/wice_grid_serialized_queries_view_helpers.rb +4 -5
- data/lib/wice/helpers/wice_grid_view_helpers.rb +12 -11
- data/lib/wice/kaminari_monkey_patching.rb +0 -2
- data/lib/wice/table_column_matrix.rb +1 -2
- data/lib/wice/wice_grid_controller.rb +4 -5
- data/lib/wice/wice_grid_core_ext.rb +0 -1
- data/lib/wice/wice_grid_misc.rb +4 -5
- data/lib/wice/wice_grid_serialized_queries_controller.rb +0 -1
- data/lib/wice/wice_grid_serialized_query.rb +0 -1
- data/lib/wice/wice_grid_spreadsheet.rb +0 -1
- data/lib/wice_grid.rb +16 -17
- data/spec/schema.rb +0 -1
- data/spec/spec_helper.rb +0 -1
- data/spec/support/active_record.rb +0 -1
- data/spec/support/wice_grid_test_config.rb +0 -2
- data/spec/wice/grid_output_buffer_spec.rb +0 -2
- data/spec/wice/table_column_matrix_spec.rb +0 -2
- data/spec/wice/wice_grid_misc_spec.rb +0 -2
- data/spec/wice/wice_grid_spreadsheet_spec.rb +0 -2
- data/wice_grid.gemspec +3 -5
- metadata +37 -51
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 777b992fc1ebf294ec398237e48bc9ce00af6901
|
4
|
+
data.tar.gz: dcef37136f0ef4ed89b46ec9d6fc70c13929453e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6eadc9a77111c3c9782f039d3dc5163383893d9ffd9efa17162e95d7f4d8afc07855ac282d64bce240b50d7547999db15dc247c8b67cdbe13bc5eb8edb65a4b7
|
7
|
+
data.tar.gz: 3849db33020c6675b2834e33db7abe1fb1387bb8403da00245eb2e8ed5798643b16949660aa11e7f2998c57ef50863c5352d17d90acd298f8785ec20ad82d916
|
data/.rubocop.yml
CHANGED
@@ -19,11 +19,16 @@ Style/SpaceAroundBlockParameters:
|
|
19
19
|
|
20
20
|
# Cop supports --auto-correct.
|
21
21
|
# Configuration parameters: EnforcedStyleForMultiline, SupportedStyles.
|
22
|
-
Style/
|
23
|
-
|
22
|
+
Style/TrailingCommaInArguments:
|
23
|
+
EnforcedStyleForMultiline: no_comma
|
24
|
+
|
25
|
+
# Cop supports --auto-correct.
|
26
|
+
# Configuration parameters: EnforcedStyleForMultiline, SupportedStyles.
|
27
|
+
Style/TrailingCommaInLiteral:
|
28
|
+
EnforcedStyleForMultiline: no_comma
|
24
29
|
|
25
30
|
# Cop supports --auto-correct.
|
26
|
-
Style/
|
31
|
+
Style/SpaceBeforeFirstArg:
|
27
32
|
Enabled: true
|
28
33
|
|
29
34
|
# Cop supports --auto-correct.
|
data/Gemfile
CHANGED
data/Rakefile
CHANGED
@@ -1,4 +1,3 @@
|
|
1
|
-
# encoding: utf-8
|
2
1
|
require 'rubygems'
|
3
2
|
require 'bundler'
|
4
3
|
require 'bundler/gem_tasks'
|
@@ -17,15 +16,6 @@ require 'rspec/core/rake_task'
|
|
17
16
|
|
18
17
|
RSpec::Core::RakeTask.new(:spec)
|
19
18
|
|
20
|
-
require 'rubocop/rake_task'
|
21
|
-
|
22
|
-
desc 'Run RuboCop on the lib directory'
|
23
|
-
RuboCop::RakeTask.new(:rubocop) do |task|
|
24
|
-
task.patterns = ['lib/**/*.rb']
|
25
|
-
# don't abort rake on failure
|
26
|
-
task.fail_on_error = false
|
27
|
-
end
|
28
|
-
|
29
19
|
desc 'Run RSpec with code coverage'
|
30
20
|
task :coverage do
|
31
21
|
ENV['COVERAGE'] = 'true'
|
@@ -56,4 +46,4 @@ Rake::RDocTask.new(:rdoc) do |rdoc|
|
|
56
46
|
rdoc.rdoc_files.include('lib/**/*.rb')
|
57
47
|
end
|
58
48
|
|
59
|
-
task default: [:
|
49
|
+
task default: [:spec, :yardoc]
|
data/config/locales/uk.yml
CHANGED
@@ -5,41 +5,41 @@ uk:
|
|
5
5
|
- :month
|
6
6
|
- :day
|
7
7
|
wice_grid:
|
8
|
-
show_filter_tooltip: Показати фільтр
|
9
|
-
hide_filter_tooltip: Сховати фільтр
|
10
|
-
csv_export_tooltip: Експорт в CSV
|
11
|
-
filter_tooltip: Фільтрувати
|
12
|
-
reset_filter_tooltip: Скинути фільтр
|
13
|
-
boolean_filter_true_label: так
|
14
|
-
boolean_filter_false_label: ні
|
15
|
-
previous_label: «
|
16
|
-
next_label: »
|
8
|
+
show_filter_tooltip: "Показати фільтр"
|
9
|
+
hide_filter_tooltip: "Сховати фільтр"
|
10
|
+
csv_export_tooltip: "Експорт в CSV"
|
11
|
+
filter_tooltip: "Фільтрувати"
|
12
|
+
reset_filter_tooltip: "Скинути фільтр"
|
13
|
+
boolean_filter_true_label: "так"
|
14
|
+
boolean_filter_false_label: "ні"
|
15
|
+
previous_label: "«"
|
16
|
+
next_label: "»"
|
17
17
|
# Title of the icon clicking on which will show the calendar to set the FROM date.
|
18
|
-
date_selector_tooltip_from: Від
|
18
|
+
date_selector_tooltip_from: "Від"
|
19
19
|
# Title of the icon clicking on which will show the calendar to set the TO date.
|
20
|
-
date_selector_tooltip_to: До
|
20
|
+
date_selector_tooltip_to: "До"
|
21
21
|
# The title of the checkox to turn on negation
|
22
|
-
negation_checkbox_title: За винятком
|
22
|
+
negation_checkbox_title: "За винятком"
|
23
23
|
# link to switch to show all records
|
24
|
-
show_all_records_label: показати всі
|
24
|
+
show_all_records_label: "показати всі"
|
25
25
|
# tooltip for the link to switch to show all records
|
26
|
-
show_all_records_tooltip: Показати всі записи
|
26
|
+
show_all_records_tooltip: "Показати всі записи"
|
27
27
|
# Warning message shown when the user wants to switch to all-records mode
|
28
|
-
all_queries_warning: Ви впевнені в тому, що хочете відобразити всі записи?
|
28
|
+
all_queries_warning: "Ви впевнені в тому, що хочете відобразити всі записи?"
|
29
29
|
# link to paginated view
|
30
|
-
switch_back_to_paginated_mode_label: Назад до посторінкового виводу
|
30
|
+
switch_back_to_paginated_mode_label: "Назад до посторінкового виводу"
|
31
31
|
# tooltip for the link to paginated view
|
32
|
-
switch_back_to_paginated_mode_tooltip: Назад до посторінкового виводу
|
32
|
+
switch_back_to_paginated_mode_tooltip: "Назад до посторінкового виводу"
|
33
33
|
# Title of the date string.
|
34
|
-
date_string_tooltip: Натисніть, щоб видалити дату
|
35
|
-
saved_query_panel_title: Збережені фільтри
|
36
|
-
save_query_button_label: Зберегти фільтр
|
37
|
-
saved_query_deletion_confirmation: Ви впевнені?
|
38
|
-
saved_query_deletion_link_title: Видалити збережуваний фільтр
|
39
|
-
saved_query_link_title: Завантажити збережуваний фільтр
|
40
|
-
validates_uniqueness_error: Збережуваний фільтр з такою назвою вже існує
|
41
|
-
validates_presence_error: Будь ласка, введіть назву Збережуваного фільтра
|
42
|
-
query_deleted_message: Збережуваний фільтр видалено.
|
43
|
-
query_saved_message: Збережуваний фільтр збережено.
|
44
|
-
select_all: Виділити все
|
45
|
-
deselect_all: Забрати виділення
|
34
|
+
date_string_tooltip: "Натисніть, щоб видалити дату"
|
35
|
+
saved_query_panel_title: "Збережені фільтри"
|
36
|
+
save_query_button_label: "Зберегти фільтр"
|
37
|
+
saved_query_deletion_confirmation: "Ви впевнені?"
|
38
|
+
saved_query_deletion_link_title: "Видалити збережуваний фільтр"
|
39
|
+
saved_query_link_title: "Завантажити збережуваний фільтр"
|
40
|
+
validates_uniqueness_error: "Збережуваний фільтр з такою назвою вже існує"
|
41
|
+
validates_presence_error: "Будь ласка, введіть назву Збережуваного фільтра"
|
42
|
+
query_deleted_message: "Збережуваний фільтр видалено."
|
43
|
+
query_saved_message: "Збережуваний фільтр збережено."
|
44
|
+
select_all: "Виділити все"
|
45
|
+
deselect_all: "Забрати виділення"
|
@@ -1,4 +1,3 @@
|
|
1
|
-
# encoding: utf-8
|
2
1
|
if defined?(Wice::Defaults)
|
3
2
|
|
4
3
|
# Default number of rows to show per page.
|
@@ -134,15 +133,15 @@ if defined?(Wice::Defaults)
|
|
134
133
|
|
135
134
|
# Format of the date displayed.
|
136
135
|
# If you change the format, make sure to check if +DATE_PARSER+ can still parse this string.
|
137
|
-
Wice::Defaults::DATE_FORMAT
|
136
|
+
Wice::Defaults::DATE_FORMAT = '%Y-%m-%d'
|
138
137
|
|
139
138
|
# Format of the date displayed in jQuery's Datepicker
|
140
139
|
# If you change the format, make sure to check if +DATE_PARSER+ can still parse this string.
|
141
|
-
Wice::Defaults::DATE_FORMAT_JQUERY
|
140
|
+
Wice::Defaults::DATE_FORMAT_JQUERY = 'yy-mm-dd'
|
142
141
|
|
143
142
|
# Format of the date displayed in Bootstrap's Datepicker
|
144
143
|
# If you change the format, make sure to check if +DATE_PARSER+ can still parse this string.
|
145
|
-
Wice::Defaults::DATE_FORMAT_BOOTSTRAP
|
144
|
+
Wice::Defaults::DATE_FORMAT_BOOTSTRAP = 'yyyy-mm-dd'
|
146
145
|
|
147
146
|
# With Calendar helpers enabled the parameter sent is the string displayed. This lambda will be given a date string in the
|
148
147
|
# format defined by +DATETIME_FORMAT+ and must generate a DateTime object.
|
@@ -1,4 +1,3 @@
|
|
1
|
-
# encoding: utf-8
|
2
1
|
module Wice
|
3
2
|
# to be mixed in into ActiveRecord::ConnectionAdapters::Column
|
4
3
|
module WiceGridExtentionToActiveRecordColumn #:nodoc:
|
@@ -31,7 +30,7 @@ module Wice
|
|
31
30
|
return if @all_filter_params.nil?
|
32
31
|
|
33
32
|
# if the parameter does not specify the table name we only allow columns in the default table to use these parameters
|
34
|
-
if @main_table && @request_params
|
33
|
+
if @main_table && @request_params = @all_filter_params[@column.name]
|
35
34
|
current_parameter_name = @column.name
|
36
35
|
elsif @request_params = @all_filter_params[alias_or_table_name(@table_alias) + '.' + @column.name]
|
37
36
|
current_parameter_name = alias_or_table_name(@table_alias) + '.' + @column.name
|
data/lib/wice/columns.rb
CHANGED
@@ -1,4 +1,3 @@
|
|
1
|
-
# encoding: utf-8
|
2
1
|
module Wice #:nodoc:
|
3
2
|
module Columns #:nodoc:
|
4
3
|
mattr_reader :handled_type_view, :handled_type_conditions_generator
|
@@ -16,20 +15,20 @@ module Wice #:nodoc:
|
|
16
15
|
|
17
16
|
Wice::Defaults::ADDITIONAL_COLUMN_PROCESSORS.each do |key, value|
|
18
17
|
unless key.is_a?(Symbol)
|
19
|
-
|
18
|
+
raise common_error_prefix + 'A key of Wice::Defaults::ADDITIONAL_COLUMN_PROCESSORS should be a Symbol!'
|
20
19
|
end
|
21
20
|
|
22
21
|
if @@handled_type_view.key?(key)
|
23
|
-
|
22
|
+
raise common_error_prefix +
|
24
23
|
"Column with key \"#{key}\" already exists in WiceGrid, overwriting existing columns is forbidden, please choose another key!"
|
25
24
|
end
|
26
25
|
|
27
26
|
if !value.is_a?(Array) || value.size != 2
|
28
|
-
|
27
|
+
ail common_error_prefix +
|
29
28
|
'A value of Wice::Defaults::ADDITIONAL_COLUMN_PROCESSORS should be a a 2-element array!'
|
30
29
|
end
|
31
30
|
|
32
|
-
view_processor, conditions_generator
|
31
|
+
view_processor, conditions_generator = value.map(&:to_s).map do |klass|
|
33
32
|
begin
|
34
33
|
eval(klass)
|
35
34
|
rescue NameError
|
@@ -38,12 +37,12 @@ module Wice #:nodoc:
|
|
38
37
|
end
|
39
38
|
|
40
39
|
unless view_processor.ancestors.include?(::Wice::Columns::ViewColumn)
|
41
|
-
|
40
|
+
raise common_error_prefix +
|
42
41
|
"#{view_processor} should be inherited from Wice::Columns::ViewColumn!"
|
43
42
|
end
|
44
43
|
|
45
44
|
unless conditions_generator.ancestors.include?(::Wice::Columns::ConditionsGeneratorColumn)
|
46
|
-
|
45
|
+
raise common_error_prefix +
|
47
46
|
"#{conditions_generator} should be inherited from Wice::Columns::ConditionsGeneratorColumn!"
|
48
47
|
end
|
49
48
|
|
@@ -59,7 +58,7 @@ module Wice #:nodoc:
|
|
59
58
|
|
60
59
|
def get_conditions_generator_column_processor(column_type) #:nodoc:
|
61
60
|
column_type = column_type.intern if column_type.is_a? String
|
62
|
-
@@handled_type_conditions_generator[column_type] ||
|
61
|
+
@@handled_type_conditions_generator[column_type] || raise("Could not find conditions generator processor for column_type #{column_type}")
|
63
62
|
end
|
64
63
|
|
65
64
|
private
|
@@ -73,7 +72,7 @@ module Wice #:nodoc:
|
|
73
72
|
processor_class_name = "#{prefix}_#{column_source_file}".classify
|
74
73
|
|
75
74
|
unless Wice::Columns.const_defined?(processor_class_name.intern)
|
76
|
-
|
75
|
+
raise "#{column_source_file}.rb is expected to define #{processor_class_name}!"
|
77
76
|
end
|
78
77
|
processor_class = eval("Wice::Columns::#{processor_class_name}")
|
79
78
|
|
@@ -268,7 +267,7 @@ module Wice #:nodoc:
|
|
268
267
|
end
|
269
268
|
|
270
269
|
def generate_conditions(_table_alias, _opts) #:nodoc:
|
271
|
-
|
270
|
+
raise('implement me')
|
272
271
|
end
|
273
272
|
|
274
273
|
end
|
@@ -1,4 +1,3 @@
|
|
1
|
-
# encoding: utf-8
|
2
1
|
module Wice
|
3
2
|
class GridOutputBuffer < String #:nodoc:
|
4
3
|
|
@@ -20,7 +19,7 @@ module Wice
|
|
20
19
|
|
21
20
|
# stores HTML code for a detached filter
|
22
21
|
def add_filter(detach_with_id, filter_code)
|
23
|
-
|
22
|
+
raise WiceGridException.new("Detached ID #{detach_with_id} is already used!") if @filters.key? detach_with_id
|
24
23
|
@filters[detach_with_id] = filter_code
|
25
24
|
end
|
26
25
|
|
@@ -30,12 +29,12 @@ module Wice
|
|
30
29
|
if @return_empty_strings_for_nonexistent_filters
|
31
30
|
return ''
|
32
31
|
else
|
33
|
-
|
32
|
+
raise WiceGridException.new("No filter with Detached ID '#{detach_with_id}'!")
|
34
33
|
end
|
35
34
|
end
|
36
35
|
|
37
36
|
unless @filters[detach_with_id]
|
38
|
-
|
37
|
+
raise WiceGridException.new("Filter with Detached ID '#{detach_with_id}' has already been requested once! There cannot be two instances of the same filter on one page")
|
39
38
|
end
|
40
39
|
|
41
40
|
res = @filters[detach_with_id]
|
data/lib/wice/grid_renderer.rb
CHANGED
@@ -1,4 +1,3 @@
|
|
1
|
-
# encoding: utf-8
|
2
1
|
module Wice
|
3
2
|
|
4
3
|
# Instance of `GridRenderer` is injected into the top level block of the `grid` helper.
|
@@ -158,7 +157,7 @@ module Wice
|
|
158
157
|
|
159
158
|
def action_column(opts = {}, &block)
|
160
159
|
if @action_column_present
|
161
|
-
|
160
|
+
raise Wice::WiceGridException.new('There can be only one action column in a WiceGrid')
|
162
161
|
end
|
163
162
|
|
164
163
|
options = {
|
@@ -323,7 +322,7 @@ module Wice
|
|
323
322
|
assocs = nil
|
324
323
|
|
325
324
|
if options[:model]
|
326
|
-
|
325
|
+
raise WiceGridArgumentError.new('Instead of specifying a model of a joined table please use assoc: :name_of_association')
|
327
326
|
end
|
328
327
|
|
329
328
|
unless options[:assoc].nil?
|
@@ -331,7 +330,7 @@ module Wice
|
|
331
330
|
unless options[:assoc].is_a?(Symbol) ||
|
332
331
|
(options[:assoc].is_a?(Array) && ! options[:assoc].empty? && options[:assoc].all?{ |assoc| assoc.is_a?(Symbol)})
|
333
332
|
|
334
|
-
|
333
|
+
raise WiceGridArgumentError.new('Option :assoc can only be a symbol or an array of symbols')
|
335
334
|
end
|
336
335
|
|
337
336
|
assocs = options[:assoc].is_a?(Symbol) ? [options[:assoc]] : options[:assoc]
|
@@ -340,11 +339,11 @@ module Wice
|
|
340
339
|
end
|
341
340
|
|
342
341
|
if options[:attribute].nil? && options[:model]
|
343
|
-
|
342
|
+
raise WiceGridArgumentError.new('Option :assoc is only used together with :attribute')
|
344
343
|
end
|
345
344
|
|
346
345
|
if options[:attribute] && options[:attribute].index('.')
|
347
|
-
|
346
|
+
raise WiceGridArgumentError.new("Invalid attribute name #{options[:attribute]}. An attribute name must not contain a table name!")
|
348
347
|
end
|
349
348
|
|
350
349
|
|
@@ -363,7 +362,7 @@ module Wice
|
|
363
362
|
block = ->(obj) { obj.deep_send(*messages) }
|
364
363
|
end
|
365
364
|
else
|
366
|
-
|
365
|
+
raise WiceGridArgumentError.new(
|
367
366
|
'Missing column block without attribute defined. You can only omit the block if attribute is present.')
|
368
367
|
end
|
369
368
|
end
|
@@ -408,7 +407,7 @@ module Wice
|
|
408
407
|
elsif Wice::WgEnumerable.all_items_are_of_class(options[:custom_filter], Array)
|
409
408
|
options[:custom_filter]
|
410
409
|
else
|
411
|
-
|
410
|
+
raise WiceGridArgumentError.new(
|
412
411
|
':custom_filter can equal :auto, an array of string and/or numbers (direct values for the dropdown), ' \
|
413
412
|
'a homogeneous array of symbols (a sequence of methods to send to AR objects in the result set to ' \
|
414
413
|
'retrieve unique values for the dropdown), a Symbol (a shortcut for a one member array of symbols), ' \
|
@@ -462,7 +461,7 @@ module Wice
|
|
462
461
|
next_model = reflection.klass
|
463
462
|
get_model_from_associations(next_model, tail)
|
464
463
|
else
|
465
|
-
|
464
|
+
raise WiceGridArgumentError.new("Association #{head} not found in #{model}")
|
466
465
|
end
|
467
466
|
end
|
468
467
|
end
|
@@ -511,7 +510,7 @@ module Wice
|
|
511
510
|
elsif opts.nil? && block
|
512
511
|
@blank_slate_handler = block
|
513
512
|
else
|
514
|
-
|
513
|
+
raise WiceGridArgumentError.new("blank_slate accepts only a string, a block, or template: 'path_to_template' ")
|
515
514
|
end
|
516
515
|
end
|
517
516
|
|
@@ -520,7 +519,7 @@ module Wice
|
|
520
519
|
row_attributes = @row_attributes_handler.call(ar_object)
|
521
520
|
row_attributes = {} if row_attributes.blank?
|
522
521
|
unless row_attributes.is_a?(Hash)
|
523
|
-
|
522
|
+
raise WiceGridArgumentError.new("row_attributes block must return a hash containing HTML attributes. The returned value is #{row_attributes.inspect}")
|
524
523
|
end
|
525
524
|
row_attributes
|
526
525
|
else
|
@@ -579,7 +578,7 @@ module Wice
|
|
579
578
|
ORDER_DIRECTION_PARAMETER_NAME => direction
|
580
579
|
} }
|
581
580
|
|
582
|
-
cleaned_params =
|
581
|
+
cleaned_params = Wice::WgHash.deep_clone params
|
583
582
|
cleaned_params.merge!(extra_parameters)
|
584
583
|
|
585
584
|
cleaned_params.delete(:controller)
|