motor-admin 0.1.64 → 0.1.70

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -29,7 +29,7 @@ module Motor
29
29
  updated_model = model.merge(configs.slice(*RESOURCE_ATTRS))
30
30
 
31
31
  merge_actions!(updated_model, configs)
32
- merge_assiciations!(updated_model, configs)
32
+ merge_associations!(updated_model, configs)
33
33
  merge_columns!(updated_model, configs)
34
34
  merge_tabs!(updated_model, configs)
35
35
  merge_scopes!(updated_model, configs)
@@ -40,7 +40,7 @@ module Motor
40
40
  # @param model [HashWithIndifferentAccess]
41
41
  # @param configs [HashWithIndifferentAccess]
42
42
  # @return [HashWithIndifferentAccess]
43
- def merge_assiciations!(model, configs)
43
+ def merge_associations!(model, configs)
44
44
  model[:associations] = merge_by_name(
45
45
  model[:associations],
46
46
  configs[:associations],
@@ -4,12 +4,12 @@ module Motor
4
4
  module BuildSchema
5
5
  module Utils
6
6
  ABBREVIATIONS = {
7
- 'id' => 'ID',
8
- 'url' => 'URL',
9
- 'iso' => 'ISO',
7
+ 'Id' => 'ID',
8
+ 'Url' => 'URL',
9
+ 'Iso' => 'ISO',
10
10
  'vip' => 'VIP',
11
- 'ip' => 'IP',
12
- 'zip' => 'ZIP'
11
+ 'Ip' => 'IP',
12
+ 'Zip' => 'ZIP'
13
13
  }.freeze
14
14
 
15
15
  module_function
@@ -15,7 +15,7 @@ module Motor
15
15
  def call(current_user = nil, current_ability = nil)
16
16
  cache_keys = LoadFromCache.load_cache_keys
17
17
 
18
- CACHE_STORE.fetch("#{cache_keys.hash}#{current_user&.id}") do
18
+ CACHE_STORE.fetch("#{I18n.locale}#{cache_keys.hash}#{current_user&.id}") do
19
19
  CACHE_STORE.clear
20
20
 
21
21
  data = build_data(cache_keys, current_user, current_ability)
@@ -29,6 +29,7 @@ module Motor
29
29
  current_user: current_user&.as_json(only: %i[id email]),
30
30
  current_rules: current_ability.serialized_rules,
31
31
  audits_count: Motor::Audit.count,
32
+ i18n: i18n_data,
32
33
  base_path: Motor::Admin.routes.url_helpers.motor_path,
33
34
  schema: Motor::BuildSchema.call(cache_keys, current_ability),
34
35
  header_links: header_links_data_hash(cache_keys[:configs]),
@@ -42,6 +43,10 @@ module Motor
42
43
  }
43
44
  end
44
45
 
46
+ def i18n_data
47
+ I18n.t('motor', default: I18n.t('motor', locale: :en))
48
+ end
49
+
45
50
  # @return [String]
46
51
  def build_cache_key(cache_keys, key, current_user, current_ability)
47
52
  "#{cache_keys[key].hash}#{current_user&.id}#{current_ability&.rules_hash}"
data/lib/motor/version.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Motor
4
- VERSION = '0.1.64'
4
+ VERSION = '0.1.70'
5
5
  end
@@ -2068,11 +2068,11 @@
2068
2068
  "mail-opened.svg": "icons/mail-opened.svg",
2069
2069
  "mail.svg": "icons/mail.svg",
2070
2070
  "mailbox.svg": "icons/mailbox.svg",
2071
- "main-6811aa12e49ba8c3cc7b.css.gz": "main-6811aa12e49ba8c3cc7b.css.gz",
2072
- "main-6811aa12e49ba8c3cc7b.js.LICENSE.txt": "main-6811aa12e49ba8c3cc7b.js.LICENSE.txt",
2073
- "main-6811aa12e49ba8c3cc7b.js.gz": "main-6811aa12e49ba8c3cc7b.js.gz",
2074
- "main.css": "main-6811aa12e49ba8c3cc7b.css",
2075
- "main.js": "main-6811aa12e49ba8c3cc7b.js",
2071
+ "main-abb83b21b8fb726b4db6.css.gz": "main-abb83b21b8fb726b4db6.css.gz",
2072
+ "main-abb83b21b8fb726b4db6.js.LICENSE.txt": "main-abb83b21b8fb726b4db6.js.LICENSE.txt",
2073
+ "main-abb83b21b8fb726b4db6.js.gz": "main-abb83b21b8fb726b4db6.js.gz",
2074
+ "main.css": "main-abb83b21b8fb726b4db6.css",
2075
+ "main.js": "main-abb83b21b8fb726b4db6.js",
2076
2076
  "man.svg": "icons/man.svg",
2077
2077
  "manual-gearbox.svg": "icons/manual-gearbox.svg",
2078
2078
  "map-2.svg": "icons/map-2.svg",
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: motor-admin
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.64
4
+ version: 0.1.70
5
5
  platform: ruby
6
6
  authors:
7
7
  - Pete Matsyburka
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-06-22 00:00:00.000000000 Z
11
+ date: 2021-06-26 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activerecord-filter
@@ -162,6 +162,8 @@ files:
162
162
  - app/views/layouts/motor/application.html.erb
163
163
  - app/views/motor/alerts_mailer/alert_email.html.erb
164
164
  - app/views/motor/ui/show.html.erb
165
+ - config/locales/en.yml
166
+ - config/locales/es.yml
165
167
  - config/routes.rb
166
168
  - lib/generators/motor/install_generator.rb
167
169
  - lib/generators/motor/migration.rb
@@ -169,6 +171,7 @@ files:
169
171
  - lib/motor-admin.rb
170
172
  - lib/motor.rb
171
173
  - lib/motor/active_record_utils.rb
174
+ - lib/motor/active_record_utils/action_text_attribute_patch.rb
172
175
  - lib/motor/active_record_utils/active_record_connection_column_patch.rb
173
176
  - lib/motor/active_record_utils/active_record_filter_patch.rb
174
177
  - lib/motor/active_record_utils/active_storage_blob_patch.rb
@@ -194,6 +197,7 @@ files:
194
197
  - lib/motor/build_schema/active_storage_attachment_schema.rb
195
198
  - lib/motor/build_schema/adjust_devise_model_schema.rb
196
199
  - lib/motor/build_schema/apply_permissions.rb
200
+ - lib/motor/build_schema/defaults.rb
197
201
  - lib/motor/build_schema/find_display_column.rb
198
202
  - lib/motor/build_schema/find_icon.rb
199
203
  - lib/motor/build_schema/load_from_rails.rb
@@ -1491,8 +1495,8 @@ files:
1491
1495
  - ui/dist/icons/zoom-money.svg.gz
1492
1496
  - ui/dist/icons/zoom-out.svg.gz
1493
1497
  - ui/dist/icons/zoom-question.svg.gz
1494
- - ui/dist/main-6811aa12e49ba8c3cc7b.css.gz
1495
- - ui/dist/main-6811aa12e49ba8c3cc7b.js.gz
1498
+ - ui/dist/main-abb83b21b8fb726b4db6.css.gz
1499
+ - ui/dist/main-abb83b21b8fb726b4db6.js.gz
1496
1500
  - ui/dist/manifest.json
1497
1501
  homepage:
1498
1502
  licenses: