datagrid 1.5.8 → 1.5.9

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
- SHA1:
3
- metadata.gz: aa302439fb009cb596541a3cd2c6d5d584dc973c
4
- data.tar.gz: 53a5b714ec1ecc3279c7cd0fb278c7c4c150785d
2
+ SHA256:
3
+ metadata.gz: 94a9a3ff232cd83f323e280e35a805ebd4ec725b74b531c18328c4de27952f2f
4
+ data.tar.gz: c91f39764fa86f0d8b016de33eeabfd37b47d16411f3f52ec796f2bf1d14d534
5
5
  SHA512:
6
- metadata.gz: 72b9bb255878dafebf1a932ee8908fedeba902e306480ebe3a1792267c63f19ff61959336be9d7c48f4df9b8f922f24ba21c781e9c000708a632d1b45577f1ac
7
- data.tar.gz: ec7577b30d0579b9ba106e220d4c89c2d2fb70bb83f33d31fce3feb4396a7bb28850ef81664187567696b585b26c2ef0873f2165859f36fe9d6233e3e092409d
6
+ metadata.gz: b999afc64d7094dfd47a2e4f393824df58edf15769c445a9d16712dc6f531f3b30f872046cd657bc9323df6a460b4d1a74334fc4b498de141a9998d3aa6c34bc
7
+ data.tar.gz: 89d0e83bd75e28ee33dc890d2f5f82de6391a9d32b0723e77afa8dfc0856d126c1fe0ee4c8ab5b0b2f5491e5908b45e14de0bd18669c2786764faeac8c6fc0c2
@@ -4,6 +4,7 @@ rvm:
4
4
  - 2.2.2
5
5
  - 2.3.0
6
6
  - 2.4.1
7
+ - 2.5.1
7
8
  #- jruby
8
9
  #- jruby-head
9
10
  #env: JRUBY_OPTS="--server -J-Xms512m -J-Xmx1024m"
data/Gemfile CHANGED
@@ -6,17 +6,17 @@ group :development do
6
6
 
7
7
  gem "bundler"
8
8
  if RUBY_VERSION >= "2.3"
9
- gem "jeweler", ">= 2.1.2", platform: [:ruby_23, :ruby_24]
9
+ gem "jeweler", ">= 2.1.2", platform: [:ruby_23, :ruby_24, :ruby_25]
10
10
  end
11
11
 
12
12
 
13
13
  #gem "json", ">= 1.9"
14
- gem "pry-byebug", :platform => [:ruby_20, :ruby_21, :ruby_22, :ruby_23] & Bundler::Dsl::VALID_PLATFORMS
14
+ gem "pry-byebug", :platform => [:ruby_24, :ruby_25, :ruby_22, :ruby_23] & Bundler::Dsl::VALID_PLATFORMS
15
15
 
16
16
  gem "rspec", ">= 3"
17
17
  gem "nokogiri" # used to test html output
18
18
 
19
- gem "sqlite3"
19
+ gem "sqlite3", "~> 1.3.6"
20
20
  gem "sequel"
21
21
 
22
22
  group :mongo do
data/VERSION CHANGED
@@ -1 +1 @@
1
- 1.5.8
1
+ 1.5.9
@@ -2,16 +2,16 @@
2
2
  # DO NOT EDIT THIS FILE DIRECTLY
3
3
  # Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
4
4
  # -*- encoding: utf-8 -*-
5
- # stub: datagrid 1.5.8 ruby lib
5
+ # stub: datagrid 1.5.9 ruby lib
6
6
 
7
7
  Gem::Specification.new do |s|
8
8
  s.name = "datagrid".freeze
9
- s.version = "1.5.8"
9
+ s.version = "1.5.9"
10
10
 
11
11
  s.required_rubygems_version = Gem::Requirement.new(">= 0".freeze) if s.respond_to? :required_rubygems_version=
12
12
  s.require_paths = ["lib".freeze]
13
13
  s.authors = ["Bogdan Gusiev".freeze]
14
- s.date = "2017-12-12"
14
+ s.date = "2019-05-10"
15
15
  s.description = "This allows you to easily build datagrid aka data tables with sortable columns and filters".freeze
16
16
  s.email = "agresso@gmail.com".freeze
17
17
  s.extra_rdoc_files = [
@@ -130,7 +130,7 @@ Gem::Specification.new do |s|
130
130
  s.homepage = "http://github.com/bogdan/datagrid".freeze
131
131
  s.licenses = ["MIT".freeze]
132
132
  s.required_ruby_version = Gem::Requirement.new(">= 2.0".freeze)
133
- s.rubygems_version = "2.6.14".freeze
133
+ s.rubygems_version = "2.7.8".freeze
134
134
  s.summary = "Ruby gem to create datagrids".freeze
135
135
 
136
136
  if s.respond_to? :specification_version then
@@ -143,7 +143,7 @@ Gem::Specification.new do |s|
143
143
  s.add_development_dependency(%q<pry-byebug>.freeze, [">= 0"])
144
144
  s.add_development_dependency(%q<rspec>.freeze, [">= 3"])
145
145
  s.add_development_dependency(%q<nokogiri>.freeze, [">= 0"])
146
- s.add_development_dependency(%q<sqlite3>.freeze, [">= 0"])
146
+ s.add_development_dependency(%q<sqlite3>.freeze, ["~> 1.3.6"])
147
147
  s.add_development_dependency(%q<sequel>.freeze, [">= 0"])
148
148
  s.add_development_dependency(%q<mongoid>.freeze, [">= 0"])
149
149
  s.add_development_dependency(%q<bson>.freeze, [">= 0"])
@@ -155,7 +155,7 @@ Gem::Specification.new do |s|
155
155
  s.add_dependency(%q<pry-byebug>.freeze, [">= 0"])
156
156
  s.add_dependency(%q<rspec>.freeze, [">= 3"])
157
157
  s.add_dependency(%q<nokogiri>.freeze, [">= 0"])
158
- s.add_dependency(%q<sqlite3>.freeze, [">= 0"])
158
+ s.add_dependency(%q<sqlite3>.freeze, ["~> 1.3.6"])
159
159
  s.add_dependency(%q<sequel>.freeze, [">= 0"])
160
160
  s.add_dependency(%q<mongoid>.freeze, [">= 0"])
161
161
  s.add_dependency(%q<bson>.freeze, [">= 0"])
@@ -168,7 +168,7 @@ Gem::Specification.new do |s|
168
168
  s.add_dependency(%q<pry-byebug>.freeze, [">= 0"])
169
169
  s.add_dependency(%q<rspec>.freeze, [">= 3"])
170
170
  s.add_dependency(%q<nokogiri>.freeze, [">= 0"])
171
- s.add_dependency(%q<sqlite3>.freeze, [">= 0"])
171
+ s.add_dependency(%q<sqlite3>.freeze, ["~> 1.3.6"])
172
172
  s.add_dependency(%q<sequel>.freeze, [">= 0"])
173
173
  s.add_dependency(%q<mongoid>.freeze, [">= 0"])
174
174
  s.add_dependency(%q<bson>.freeze, [">= 0"])
@@ -123,11 +123,6 @@ class Datagrid::Columns::Column
123
123
  end
124
124
 
125
125
 
126
- def block
127
- Datagrid::Utils.warn_once("Datagrid::Columns::Column#block is deprecated. Use #html_block or #data_block instead")
128
- data_block
129
- end
130
-
131
126
  def generic_value(model, grid)
132
127
  grid.generic_value(self, model)
133
128
  end
@@ -53,7 +53,7 @@ module Datagrid
53
53
  def filter_by_name(attribute)
54
54
  return attribute if attribute.is_a?(Datagrid::Filters::BaseFilter)
55
55
  self.filters.find do |filter|
56
- filter.name.to_sym == attribute.to_sym
56
+ filter.name == attribute.to_sym
57
57
  end
58
58
  end
59
59
 
@@ -7,7 +7,7 @@ class Datagrid::Filters::BaseFilter #:nodoc:
7
7
 
8
8
  def initialize(grid_class, name, options = {}, &block)
9
9
  self.grid_class = grid_class
10
- self.name = name
10
+ self.name = name.to_sym
11
11
  self.options = options
12
12
  self.block = block || default_filter_block
13
13
  end
@@ -61,18 +61,10 @@ class Datagrid::Filters::BaseFilter #:nodoc:
61
61
  end
62
62
  end
63
63
 
64
- def default(object = nil)
65
- unless object
66
- Datagrid::Utils.warn_once("#{self.class.name}#default without argument is deprecated")
67
- end
64
+ def default(object)
68
65
  default = self.options[:default]
69
66
  if default.is_a?(Symbol)
70
- if object.respond_to?(default)
71
- object.send(default)
72
- else
73
- Datagrid::Utils.warn_once(":default as a Symbol is now treated as a method name. Use String instead or -> { default } if you really want default value to be a Symbol but not a String.")
74
- default
75
- end
67
+ object.send(default)
76
68
  elsif default.respond_to?(:call)
77
69
  Datagrid::Utils.apply_args(object, &default)
78
70
  else
@@ -80,11 +72,6 @@ class Datagrid::Filters::BaseFilter #:nodoc:
80
72
  end
81
73
  end
82
74
 
83
- def multiple
84
- Datagrid::Utils.warn_once("Filter#multiple method is deprecated. Use Filter#multiple? instead")
85
- multiple?
86
- end
87
-
88
75
  def multiple?
89
76
  self.options[:multiple]
90
77
  end
@@ -4,12 +4,22 @@ class Datagrid::Filters::DynamicFilter < Datagrid::Filters::BaseFilter
4
4
 
5
5
  include Datagrid::Filters::SelectOptions
6
6
 
7
+ EQUAL_OPERATION = '='
8
+ LIKE_OPERATION = '=~'
9
+ MORE_EQUAL_OPERATION = '>='
10
+ LESS_EQUAL_OPERATION = '<='
11
+ DEFAULT_OPERATIONS = [
12
+ EQUAL_OPERATION,
13
+ LIKE_OPERATION,
14
+ MORE_EQUAL_OPERATION,
15
+ LESS_EQUAL_OPERATION,
16
+ ]
7
17
  AVAILABLE_OPERATIONS = %w(= =~ >= <=)
8
18
 
9
19
  def initialize(*)
10
20
  super
11
21
  options[:select] ||= default_select
12
- options[:operations] ||= AVAILABLE_OPERATIONS
22
+ options[:operations] ||= DEFAULT_OPERATIONS
13
23
  unless options.has_key?(:include_blank)
14
24
  options[:include_blank] = false
15
25
  end
@@ -35,12 +45,12 @@ class Datagrid::Filters::DynamicFilter < Datagrid::Filters::BaseFilter
35
45
  raise Datagrid::FilteringError, "Unknown operation: #{operation.inspect}. Available operations: #{operations.join(' ')}"
36
46
  end
37
47
  case operation
38
- when '='
48
+ when EQUAL_OPERATION
39
49
  if date_conversion
40
50
  value = Datagrid::Utils.format_date_as_timestamp(value)
41
51
  end
42
52
  driver.where(scope, field, value)
43
- when '=~'
53
+ when LIKE_OPERATION
44
54
  if column_type(field) == :string
45
55
  driver.contains(scope, field, value)
46
56
  else
@@ -49,12 +59,12 @@ class Datagrid::Filters::DynamicFilter < Datagrid::Filters::BaseFilter
49
59
  end
50
60
  driver.where(scope, field, value)
51
61
  end
52
- when '>='
62
+ when MORE_EQUAL_OPERATION
53
63
  if date_conversion
54
64
  value = value.beginning_of_day
55
65
  end
56
66
  driver.greater_equal(scope, field, value)
57
- when '<='
67
+ when LESS_EQUAL_OPERATION
58
68
  if date_conversion
59
69
  value = value.end_of_day
60
70
  end
@@ -1,9 +1,6 @@
1
1
  module Datagrid::Filters::SelectOptions
2
2
 
3
- def select(object = nil)
4
- unless object
5
- Datagrid::Utils.warn_once("#{self.class.name}#select without argument is deprecated")
6
- end
3
+ def select(object)
7
4
  select = self.options[:select]
8
5
  if select.is_a?(Symbol)
9
6
  object.send(select)
@@ -140,43 +140,16 @@ module Datagrid
140
140
  if filter.range?
141
141
  partial = partial_path('range_filter')
142
142
  options = options.merge(:multiple => true)
143
-
144
-
145
143
  from_options = datagrid_range_filter_options(object, filter, :from, options)
146
144
  to_options = datagrid_range_filter_options(object, filter, :to, options)
147
- from_input = text_field(filter.name, from_options)
148
- to_input = text_field(filter.name, to_options)
149
-
150
- format_key = "datagrid.filters.#{type}.range_format"
151
- separator_key = "datagrid.filters.#{type}.range_separator"
152
- # 2 inputs: "from date" and "to date" to specify a range
153
- if I18n.exists?(separator_key)
154
- # Support deprecated translation option: range_separator
155
- warn_deprecated_range_localization(separator_key)
156
- separator = I18n.t(separator_key, default: '').presence
157
- [from_input, separator, to_input].join.html_safe
158
- elsif I18n.exists?(format_key)
159
- # Support deprecated translation option: range_format
160
- warn_deprecated_range_localization(format_key)
161
- I18n.t(format_key, :from_input => from_input, :to_input => to_input).html_safe
162
- else
163
- # More flexible way to render via partial
164
- @template.render :partial => partial, :locals => {
165
- :from_options => from_options, :to_options => to_options, :filter => filter, :form => self
166
- }
167
- end
145
+ @template.render :partial => partial, :locals => {
146
+ :from_options => from_options, :to_options => to_options, :filter => filter, :form => self
147
+ }
168
148
  else
169
149
  datagrid_default_filter(filter, options)
170
150
  end
171
151
  end
172
152
 
173
- def warn_deprecated_range_localization(key)
174
- Datagrid::Utils.warn_once(
175
- "#{key} localization key is deprectated. " +
176
- "Customize formatting by rake datagrid:copy_partials and editing app/views/datagrid/range_filter partial."
177
- )
178
- end
179
-
180
153
  def datagrid_range_filter_options(object, filter, type, options)
181
154
  type_method_map = {:from => :first, :to => :last}
182
155
  options = add_html_classes(options, type)
@@ -1,11 +1,11 @@
1
1
  en:
2
2
  datagrid:
3
3
  no_results:
4
- "&mdash;&mdash;"
4
+ "――"
5
5
  table:
6
6
  order:
7
- asc: "&uarr;"
8
- desc: "&darr;"
7
+ asc: ""
8
+ desc: ""
9
9
  no_columns: "No columns selected"
10
10
  form:
11
11
  search: "Search"
@@ -17,7 +17,7 @@ en:
17
17
 
18
18
  dynamic:
19
19
  operations:
20
- ">=": "&ge;"
21
- "<=": "&le;"
20
+ ">=": ""
21
+ "<=": ""
22
22
  "=": "="
23
- "=~": "&asymp;"
23
+ "=~": ""
@@ -154,34 +154,8 @@ describe Datagrid::FormBuilder do
154
154
  ) }
155
155
 
156
156
  end
157
-
158
- context "when deprecated format translation specified" do
159
- let(:_range) { nil }
160
- around(:each) do |example|
161
- store_translations(:en, datagrid: {filters: {integer: {range_format: "from %{from_input} to %{to_input}"}}}) do
162
- silence_warnings do
163
- example.run
164
- end
165
- end
166
- end
167
- it { should equal_to_dom(
168
- 'from <input class="group_id integer_filter from" multiple type="text" name="report[group_id][]"> to <input class="group_id integer_filter to" multiple type="text" name="report[group_id][]">'
169
- )}
170
- end
171
- context "when deprecated separator is specified" do
172
- let(:_range) { nil }
173
- around(:each) do |example|
174
- store_translations(:en, datagrid: {filters: {integer: {range_separator: " | "}}}) do
175
- silence_warnings do
176
- example.run
177
- end
178
- end
179
- end
180
- it { should equal_to_dom(
181
- '<input class="group_id integer_filter from" multiple type="text" name="report[group_id][]"> | <input class="group_id integer_filter to" multiple type="text" name="report[group_id][]">'
182
- )}
183
- end
184
157
  end
158
+
185
159
  context "with float filter type and range option" do
186
160
  let(:_filter) { :rating }
187
161
  let(:_grid) {
@@ -198,7 +172,6 @@ describe Datagrid::FormBuilder do
198
172
  )}
199
173
  end
200
174
 
201
-
202
175
  context "with date filter type and range option" do
203
176
  let(:_filter) { :created_at }
204
177
  let(:_grid) {
@@ -44,7 +44,7 @@ describe Datagrid::Helper do
44
44
  expect(datagrid_table).to match_css_pattern(
45
45
  "table.datagrid tr td.noresults" => 1
46
46
  )
47
- expect(datagrid_table).to include("&mdash;&mdash;")
47
+ expect(datagrid_table).to include(I18n.t("datagrid.no_results"))
48
48
  end
49
49
  end
50
50
 
@@ -1,3 +1,4 @@
1
+ require "sqlite3"
1
2
 
2
3
  ActiveRecord::Base.establish_connection(:adapter => "sqlite3", :database => ":memory:")
3
4
  #ActiveRecord::Base.configurations = true
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: datagrid
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.5.8
4
+ version: 1.5.9
5
5
  platform: ruby
6
6
  authors:
7
7
  - Bogdan Gusiev
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-12-12 00:00:00.000000000 Z
11
+ date: 2019-05-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -98,16 +98,16 @@ dependencies:
98
98
  name: sqlite3
99
99
  requirement: !ruby/object:Gem::Requirement
100
100
  requirements:
101
- - - ">="
101
+ - - "~>"
102
102
  - !ruby/object:Gem::Version
103
- version: '0'
103
+ version: 1.3.6
104
104
  type: :development
105
105
  prerelease: false
106
106
  version_requirements: !ruby/object:Gem::Requirement
107
107
  requirements:
108
- - - ">="
108
+ - - "~>"
109
109
  - !ruby/object:Gem::Version
110
- version: '0'
110
+ version: 1.3.6
111
111
  - !ruby/object:Gem::Dependency
112
112
  name: sequel
113
113
  requirement: !ruby/object:Gem::Requirement
@@ -300,7 +300,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
300
300
  version: '0'
301
301
  requirements: []
302
302
  rubyforge_project:
303
- rubygems_version: 2.6.14
303
+ rubygems_version: 2.7.8
304
304
  signing_key:
305
305
  specification_version: 4
306
306
  summary: Ruby gem to create datagrids