slash_admin 1.0 → 1.0.1

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
  SHA256:
3
- metadata.gz: 0c90c097781b6d4de18232be80a73c746c0a635306f09583518dc579fc080f7c
4
- data.tar.gz: 3b557ba04b67537b1bff365b4ac7021b09952be5ba659f6f4172da94e70ab309
3
+ metadata.gz: 1972b380ac6782c7921b54ef60b515ebf3ccbc33499721d871c657f01a6b1060
4
+ data.tar.gz: ece587720d629fc7e1960b2ff5b4f6d4f6d4414fc0c041cad48b9f361a99008d
5
5
  SHA512:
6
- metadata.gz: cdf0e1651f829df415e7d0c176645df9556472198817eb1c2de67f423eae9b57bba1fde9674e0da1ea0fff930d615865811327fc03209959a84963b93af81e6d
7
- data.tar.gz: 9239fa0a4b215c8b65bad862601d5e305a480851c3dd6223557c0c2c80fc5a4ffc5a80f985b154e3bd3ff788b8bdc0a9bf13ff9b551ac784d15caf0ace9ee3fd
6
+ metadata.gz: bf2af28c8509da877de6786dad8890143a9d3697d6eae4c3732cc6f6d6644d32244851d3e46e34254455f6ea0fc625012e1014cfd9f1c9871f63400a2d25d808
7
+ data.tar.gz: cb011eaabf99b171edfb7b9761d72b266e73432861bfa4f71c8d26ae1ca39f801412bf68a0b8dff6cf0abca0a79befb3bb7a4d1ac5c17e6b5e8b6336a70a3c4e
@@ -449,12 +449,10 @@ i {
449
449
 
450
450
  .dropdown {
451
451
  .dropdown-menu {
452
- width: 195px;
453
452
  padding: 0;
454
453
  border-radius: 0;
455
454
  box-shadow: 5px 5px rgba(102, 102, 102, 0.1);
456
455
  border: 1px solid #eee;
457
- right: 0;
458
456
  margin-top: -6px;
459
457
  left: initial;
460
458
 
@@ -215,10 +215,13 @@ module SlashAdmin
215
215
  if @model_class.respond_to?(:translated_attribute_names) && @model_class.translated_attribute_names.include?(attr.to_sym)
216
216
  attr = "#{@model_class.name.singularize.underscore}_translations.#{attr}"
217
217
  end
218
+ attr_prefixed = model.table_name + '.' + attr
218
219
  case attr_type
220
+ # TODO : Should be rewritten
219
221
  when 'belongs_to'
220
222
  search = search.eager_load(attr.to_s)
221
223
  search = search.where(attr.to_s + '_id IN (' + query.join(',') + ')')
224
+ # TODO : Should be rewritten
222
225
  when 'has_one'
223
226
  search = search.eager_load(attr.to_s)
224
227
  search = search.where(attr.to_s.pluralize + '.id IN (' + query.join(',') + ')')
@@ -229,33 +232,33 @@ module SlashAdmin
229
232
  virtual_fields << attr.to_s
230
233
  else
231
234
  begin
232
- search = search.where("unaccent(lower(#{attr})) LIKE unaccent(lower(:query))", query: "%#{query}%")
235
+ search = search.where("unaccent(lower(#{attr_prefixed})) LIKE unaccent(lower(:query))", query: "%#{query}%")
233
236
  rescue
234
- search = search.where("lower(#{attr}) LIKE lower(:query)", query: "%#{query}%")
237
+ search = search.where("lower(#{attr_prefixed}) LIKE lower(:query)", query: "%#{query}%")
235
238
  end
236
239
  end
237
240
  when 'date', 'datetime'
238
241
  if query.is_a?(String)
239
- search = search.where("#{attr} = :query", query: query)
242
+ search = search.where("#{attr_prefixed} = :query", query: query)
240
243
  else
241
244
  if query['from'].present? || query['to'].present?
242
245
  if query['from'].to_date != query['to'].to_date
243
246
  if query['from'].present?
244
- search = search.where("#{attr} >= :query", query: query['from'].to_date)
247
+ search = search.where("#{attr_prefixed} >= :query", query: query['from'].to_date)
245
248
  end
246
249
  if query['to'].present?
247
- search = search.where("#{attr} <= :query", query: query['to'].to_date)
250
+ search = search.where("#{attr_prefixed} <= :query", query: query['to'].to_date)
248
251
  end
249
252
  else
250
- search = search.where("#{attr} = :query", query: query['from'].to_date)
253
+ search = search.where("#{attr_prefixed} = :query", query: query['from'].to_date)
251
254
  end
252
255
  end
253
256
  end
254
257
  when 'decimal', 'number', 'integer'
255
258
  if query.instance_of?(ActionController::Parameters)
256
259
  if query['from'].present? || query['to'].present?
257
- search = search.where("#{attr} >= :query", query: query['from']) if query['from'].present?
258
- search = search.where("#{attr} <= :query", query: query['to']) if query['to'].present?
260
+ search = search.where("#{attr_prefixed} >= :query", query: query['from']) if query['from'].present?
261
+ search = search.where("#{attr_prefixed} <= :query", query: query['to']) if query['to'].present?
259
262
  end
260
263
  else
261
264
  if attr_type == 'decimal' || attr_type == 'number'
@@ -263,10 +266,10 @@ module SlashAdmin
263
266
  elsif attr_type == 'integer'
264
267
  query = query.to_i
265
268
  end
266
- search = search.where("#{attr} = :query", query: query)
269
+ search = search.where("#{attr_prefixed} = :query", query: query)
267
270
  end
268
271
  when 'boolean'
269
- search = search.where("#{attr} = :query", query: to_boolean(query))
272
+ search = search.where("#{attr_prefixed} = :query", query: to_boolean(query))
270
273
  else
271
274
  raise Exception.new("Unable to query for attribute_type : #{attr_type}")
272
275
  end
@@ -1,3 +1,3 @@
1
1
  module SlashAdmin
2
- VERSION = '1.0'
2
+ VERSION = '1.0.1'
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: slash_admin
3
3
  version: !ruby/object:Gem::Version
4
- version: '1.0'
4
+ version: 1.0.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - KOVACS Nicolas
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-10-04 00:00:00.000000000 Z
11
+ date: 2019-10-28 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails