rails_admin 1.1.1 → 1.2.0

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of rails_admin might be problematic. Click here for more details.

checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: d80a5575faa7784d6f5d17ddebb05038a5416969
4
- data.tar.gz: c30c5b1ffb5839b5b387b7935e7ed201966efdbb
3
+ metadata.gz: c69e517eca7e9a2fd7b5f93c966f86f9eadd57d5
4
+ data.tar.gz: c2df6d3bcda5e4ccd0cadef10ddc46a4e8f6c283
5
5
  SHA512:
6
- metadata.gz: ee5a0326bd91f3b04e1b7711cddb648772bbc29f47f76784a69508fcfa3bf590528321b86faddace87c3bd1d6334100e0fea04cf18dbd04ecf6bd3e3ed2c85e9
7
- data.tar.gz: 4565950fa8e26c5c5b7a0d79cb522e91d1256575287e7b637165c2c03b82053461aa3e6317479c5ca2340439b5a9d8e4e5768efe52939b7d32b1bb1cfd443919
6
+ metadata.gz: e6fc0cb49d89c389de0afffdc0e17215d6e9d6a702ef8c263106058ed1f4a5bdd13e0d57ce9d39cc691a88de83669bfaeaaeb21c9657aaa096f2e387091b125e
7
+ data.tar.gz: fafcc0bb5ada22245b595107ee6c65c2b816de55d48d969e9ca4c225e428118ba4d4b8e5af6a4a2138e4c5b52a100fb1673970e31b0e087cc73d15d5da97d030
data/Gemfile CHANGED
@@ -1,18 +1,11 @@
1
1
  source 'https://rubygems.org'
2
2
 
3
3
  gem 'appraisal', '>= 2.0'
4
+ gem 'rails', '~> 5.0.0'
5
+ gem 'haml'
4
6
  gem 'devise'
5
7
 
6
8
  group :active_record do
7
- platforms :jruby do
8
- gem 'activerecord-jdbcmysql-adapter', '>= 1.2'
9
- gem 'jdbc-mysql', '>= 5.1'
10
- gem 'activerecord-jdbcpostgresql-adapter', '>= 1.2'
11
- gem 'jdbc-postgres', '>= 9.2'
12
- gem 'activerecord-jdbcsqlite3-adapter', '>= 1.3.0.beta1'
13
- gem 'jdbc-sqlite3', '>= 3.7'
14
- end
15
-
16
9
  platforms :ruby, :mswin, :mingw do
17
10
  gem 'mysql2', '~> 0.3.14'
18
11
  gem 'pg', '>= 0.14'
data/README.md CHANGED
@@ -42,7 +42,7 @@ This problem was reported by SourceClear, Inc.
42
42
 
43
43
  ## Installation
44
44
 
45
- 1. On your gemfile: `gem 'rails_admin', '~> 1.0'`
45
+ 1. On your gemfile: `gem 'rails_admin', '~> 1.2'`
46
46
  2. Run `bundle install`
47
47
  3. Run `rails g rails_admin:install`
48
48
  4. Provide a namespace for the routes when asked
@@ -40,7 +40,7 @@
40
40
  // When using the browser back and forward buttons, it is possible that
41
41
  // the autocomplete field will be cached which causes duplicate fields
42
42
  // to be generated.
43
- if (filtering_select.size() > 0) {
43
+ if (filtering_select.length > 0) {
44
44
  this.input = filtering_select.children('input');
45
45
  this.button = filtering_select.children('.input-group-btn');
46
46
  } else {
@@ -8,10 +8,11 @@
8
8
  = csrf_meta_tag
9
9
  = stylesheet_link_tag "rails_admin/rails_admin.css", media: :all
10
10
  = javascript_include_tag "rails_admin/rails_admin.js"
11
+ %body.rails_admin
12
+ #admin-js{:'data-i18n-options' => I18n.t("admin.js").to_json}
11
13
  -# Initialize JS simple i18n
12
14
  :javascript
13
- RailsAdmin.I18n.init('#{I18n.locale}', JSON.parse("#{j I18n.t("admin.js").to_json}"))
14
- %body.rails_admin
15
+ RailsAdmin.I18n.init('#{I18n.locale}', document.getElementById("admin-js").dataset.i18nOptions);
15
16
  #loading.label.label-warning{style: 'display:none; position:fixed; right:20px; bottom:20px; z-index:100000'}= t('admin.loading')
16
17
  %nav.navbar.navbar-default.navbar-fixed-top
17
18
  = render "layouts/rails_admin/navigation"
@@ -90,7 +90,7 @@
90
90
  %th.last.shrink
91
91
  %tbody
92
92
  - @objects.each do |object|
93
- %tr{class: "#{@abstract_model.param_key}_row"}
93
+ %tr{class: "#{@abstract_model.param_key}_row #{@model_config.list.with(object: object).row_css_class}"}
94
94
  %td
95
95
  = check_box_tag "bulk_ids[]", object.id, false
96
96
  - if @other_left_link ||= other_left && index_path(params.except('set').merge(params[:set].to_i != 1 ? {set: (params[:set].to_i - 1)} : {}))
@@ -1,2 +1,5 @@
1
1
  require 'haml'
2
- Haml::Template.options[:ugly] = true
2
+ require 'haml/template'
3
+ if Haml::Options.buffer_option_keys.include?(:ugly)
4
+ Haml::Template.options[:ugly] = true
5
+ end
@@ -21,7 +21,7 @@ RailsAdmin.config do |config|
21
21
 
22
22
  ## == Gravatar integration ==
23
23
  ## To disable Gravatar integration in Navigation Bar set to false
24
- # config.show_gravatar true
24
+ # config.show_gravatar = true
25
25
 
26
26
  config.actions do
27
27
  dashboard # mandatory
@@ -204,6 +204,7 @@ module RailsAdmin
204
204
  when :string, :text then build_statement_for_string_or_text
205
205
  when :enum then build_statement_for_enum
206
206
  when :belongs_to_association then build_statement_for_belongs_to_association
207
+ when :uuid then build_statement_for_uuid
207
208
  end
208
209
  end
209
210
 
@@ -223,22 +224,27 @@ module RailsAdmin
223
224
 
224
225
  def build_statement_for_string_or_text
225
226
  return if @value.blank?
227
+
228
+ unless ['postgresql', 'postgis'].include? ar_adapter
229
+ @value = @value.mb_chars.downcase
230
+ end
231
+
226
232
  @value = begin
227
233
  case @operator
228
234
  when 'default', 'like'
229
- "%#{@value.downcase}%"
235
+ "%#{@value}%"
230
236
  when 'starts_with'
231
- "#{@value.downcase}%"
237
+ "#{@value}%"
232
238
  when 'ends_with'
233
- "%#{@value.downcase}"
239
+ "%#{@value}"
234
240
  when 'is', '='
235
- @value.downcase
241
+ @value
236
242
  else
237
243
  return
238
244
  end
239
245
  end
240
246
 
241
- if ar_adapter == 'postgresql'
247
+ if ['postgresql', 'postgis'].include? ar_adapter
242
248
  ["(#{@column} ILIKE ?)", @value]
243
249
  else
244
250
  ["(LOWER(#{@column}) LIKE ?)", @value]
@@ -250,6 +256,12 @@ module RailsAdmin
250
256
  ["(#{@column} IN (?))", Array.wrap(@value)]
251
257
  end
252
258
 
259
+ def build_statement_for_uuid
260
+ if @value.to_s =~ /\A[0-9a-f]{8}-([0-9a-f]{4}-){3}[0-9a-f]{12}\z/
261
+ column_for_value(@value)
262
+ end
263
+ end
264
+
253
265
  def ar_adapter
254
266
  ::ActiveRecord::Base.connection.adapter_name.downcase
255
267
  end
@@ -11,7 +11,9 @@ module RailsAdmin
11
11
  def rails_admin(&block)
12
12
  RailsAdmin.config(self, &block)
13
13
  end
14
- alias_method_chain :accepts_nested_attributes_for, :rails_admin
14
+
15
+ alias_method :accepts_nested_attributes_for_without_rails_admin, :accepts_nested_attributes_for
16
+ alias_method :accepts_nested_attributes_for, :accepts_nested_attributes_for_with_rails_admin
15
17
  end
16
18
  end
17
19
 
@@ -323,7 +323,7 @@ module RailsAdmin
323
323
  included_models.collect(&:to_s).presence || begin
324
324
  @@system_models ||= # memoization for tests
325
325
  ([Rails.application] + Rails::Engine.subclasses.collect(&:instance)).flat_map do |app|
326
- (app.paths['app/models'].to_a + app.config.autoload_paths).collect do |load_path|
326
+ (app.paths['app/models'].to_a + app.paths.eager_load).collect do |load_path|
327
327
  Dir.glob(app.root.join(load_path)).collect do |load_dir|
328
328
  Dir.glob(load_dir + '/**/*.rb').collect do |filename|
329
329
  # app/models/module/class.rb => module/class.rb => module/class => Module::Class
@@ -20,7 +20,7 @@ module RailsAdmin
20
20
  @authorization_adapter && @authorization_adapter.attributes_for(:new, @abstract_model).each do |name, value|
21
21
  @object.send("#{name}=", value)
22
22
  end
23
- if object_params = params[@abstract_model.to_param]
23
+ if object_params = params[@abstract_model.param_key]
24
24
  sanitize_params_for!(request.xhr? ? :modal : :create)
25
25
  @object.set_attributes(@object.attributes.merge(object_params.to_h))
26
26
  end
@@ -25,6 +25,10 @@ module RailsAdmin
25
25
  register_instance_option :scopes do
26
26
  []
27
27
  end
28
+
29
+ register_instance_option :row_css_class do
30
+ ''
31
+ end
28
32
  end
29
33
  end
30
34
  end
@@ -1,8 +1,8 @@
1
1
  module RailsAdmin
2
2
  class Version
3
3
  MAJOR = 1
4
- MINOR = 1
5
- PATCH = 1
4
+ MINOR = 2
5
+ PATCH = 0
6
6
  PRE = nil
7
7
 
8
8
  class << self
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rails_admin
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.1
4
+ version: 1.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Erik Michaels-Ober
@@ -12,7 +12,7 @@ authors:
12
12
  autorequire:
13
13
  bindir: bin
14
14
  cert_chain: []
15
- date: 2016-12-25 00:00:00.000000000 Z
15
+ date: 2017-05-31 00:00:00.000000000 Z
16
16
  dependencies:
17
17
  - !ruby/object:Gem::Dependency
18
18
  name: builder
@@ -66,16 +66,22 @@ dependencies:
66
66
  name: haml
67
67
  requirement: !ruby/object:Gem::Requirement
68
68
  requirements:
69
- - - "~>"
69
+ - - ">="
70
70
  - !ruby/object:Gem::Version
71
71
  version: '4.0'
72
+ - - "<"
73
+ - !ruby/object:Gem::Version
74
+ version: '6'
72
75
  type: :runtime
73
76
  prerelease: false
74
77
  version_requirements: !ruby/object:Gem::Requirement
75
78
  requirements:
76
- - - "~>"
79
+ - - ">="
77
80
  - !ruby/object:Gem::Version
78
81
  version: '4.0'
82
+ - - "<"
83
+ - !ruby/object:Gem::Version
84
+ version: '6'
79
85
  - !ruby/object:Gem::Dependency
80
86
  name: jquery-rails
81
87
  requirement: !ruby/object:Gem::Requirement
@@ -114,16 +120,22 @@ dependencies:
114
120
  name: kaminari
115
121
  requirement: !ruby/object:Gem::Requirement
116
122
  requirements:
117
- - - "~>"
123
+ - - ">="
118
124
  - !ruby/object:Gem::Version
119
125
  version: '0.14'
126
+ - - "<"
127
+ - !ruby/object:Gem::Version
128
+ version: '2.0'
120
129
  type: :runtime
121
130
  prerelease: false
122
131
  version_requirements: !ruby/object:Gem::Requirement
123
132
  requirements:
124
- - - "~>"
133
+ - - ">="
125
134
  - !ruby/object:Gem::Version
126
135
  version: '0.14'
136
+ - - "<"
137
+ - !ruby/object:Gem::Version
138
+ version: '2.0'
127
139
  - !ruby/object:Gem::Dependency
128
140
  name: nested_form
129
141
  requirement: !ruby/object:Gem::Requirement
@@ -592,7 +604,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
592
604
  version: 1.8.11
593
605
  requirements: []
594
606
  rubyforge_project:
595
- rubygems_version: 2.5.1
607
+ rubygems_version: 2.5.2
596
608
  signing_key:
597
609
  specification_version: 4
598
610
  summary: Admin for Rails