activeadmin 4.0.0.beta13 → 4.0.0.beta14

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: cf25042e7687e53298da8f7f62c8acc1993b9f9d486f3f29cd84b00fa5553b48
4
- data.tar.gz: 5f19b05d63d760714c6da4c61a05a551cf552b28ca90d590d61bcba989e6bd0b
3
+ metadata.gz: fd8e96446cfbff31209b99d16e1c73068cce5f8be2d617d8f78e6086b3cc84aa
4
+ data.tar.gz: 3e6a6f7eba472c1cc31b2b00c3ec966a0b6f3ac680db8ec43948254ac132f641
5
5
  SHA512:
6
- metadata.gz: d4c1e6b0d83d48a8eef65140777b6360f66114a41deafe994157a9800edb9d681b62e5133cd0eeb325fcd91b2bc5b7f913ef3454fa986eede6ae0a2cbcd52663
7
- data.tar.gz: 2e2158db77f77aac993d7540c0246379ce14b22143763ce05601fde1bec1554433e92648def2e9086f4747a312d07842789793896741fe83f73fd747a588825f
6
+ metadata.gz: c834a24095dfeb67cd11fe683af72215109fa8ed2c41135ffb69e3759fcca7adca5982a8e7f987d216797d478055730af4f4d290ce07a43440a83f4ddbc53664
7
+ data.tar.gz: 5f8658312c48a29fba3c90ecad7f6a5dd8ccb9318e73500524fa1b98d8d3862130d710d950d8af96fc70bfa4020ed87e1b45403f537461f70177eed256a08640
data/UPGRADING.md CHANGED
@@ -8,14 +8,14 @@ ActiveAdmin v4 uses TailwindCSS. It has **mobile web, dark mode and RTL support*
8
8
 
9
9
  These instructions assume the `cssbundling-rails` and `importmap-rails` gems are already installed and you have run their install commands in your app. If you haven't done so, please do before continuing.
10
10
 
11
- Update your `Gemfile` with `gem "activeadmin", "4.0.0.beta12"` and then run `gem install activeadmin --pre`.
11
+ Update your `Gemfile` with `gem "activeadmin", "4.0.0.beta14"` and then run `gem install activeadmin --pre`.
12
12
 
13
13
  Now, run `rails generate active_admin:assets` to replace the old assets with the new files.
14
14
 
15
15
  Then add the npm package and update the `build:css` script.
16
16
 
17
17
  ```
18
- yarn add @activeadmin/activeadmin@4.0.0-beta12
18
+ yarn add @activeadmin/activeadmin@4.0.0-beta14
19
19
  npm pkg set scripts.build:css="tailwindcss -i ./app/assets/stylesheets/active_admin.css -o ./app/assets/builds/active_admin.css --minify -c tailwind-active_admin.config.js"
20
20
  ```
21
21
 
@@ -168,11 +168,16 @@ module ActiveAdmin
168
168
  #
169
169
  # @return [void]
170
170
  def update_resource(object, attributes)
171
- object = assign_attributes(object, attributes)
171
+ status = nil
172
+ ActiveRecord::Base.transaction do
173
+ object = assign_attributes(object, attributes)
172
174
 
173
- run_update_callbacks object do
174
- save_resource(object)
175
+ run_update_callbacks object do
176
+ status = save_resource(object)
177
+ raise ActiveRecord::Rollback unless status
178
+ end
175
179
  end
180
+ status
176
181
  end
177
182
 
178
183
  # Destroys an object from the database and calls appropriate callbacks.
@@ -24,7 +24,7 @@ module ActiveAdmin
24
24
  def display_name(resource)
25
25
  unless resource.nil?
26
26
  result = render_in_context(resource, display_name_method_for(resource))
27
- if result.to_s&.strip&.present?
27
+ if result.to_s.strip.present?
28
28
  ERB::Util.html_escape(result)
29
29
  else
30
30
  ERB::Util.html_escape(render_in_context(resource, DISPLAY_NAME_FALLBACK))
@@ -22,7 +22,7 @@ module ActiveAdmin
22
22
 
23
23
  def action_items_for_action
24
24
  @action_items_for_action ||= begin
25
- if active_admin_config && active_admin_config.action_items?
25
+ if active_admin_config&.action_items?
26
26
  active_admin_config.action_items_for(params[:action], self)
27
27
  else
28
28
  []
@@ -32,7 +32,7 @@ module ActiveAdmin
32
32
 
33
33
  def sidebar_sections_for_action
34
34
  @sidebar_sections_for_action ||= begin
35
- if active_admin_config && active_admin_config.sidebar_sections?
35
+ if active_admin_config&.sidebar_sections?
36
36
  active_admin_config.sidebar_sections_for(params[:action], self)
37
37
  else
38
38
  []
@@ -31,6 +31,10 @@ ja:
31
31
  "yes": "はい"
32
32
  "no": "いいえ"
33
33
  "unset": "いいえ"
34
+ toggle_dark_mode: "ダークモードを切り替える"
35
+ toggle_main_navigation_menu: "メインナビゲーションメニューを切り替える"
36
+ toggle_section: "セクションを切り替える"
37
+ toggle_user_menu: "ユーザーメニューを切り替える"
34
38
  logout: "ログアウト"
35
39
  powered_by: "Powered by %{active_admin} %{version}"
36
40
  sidebars:
@@ -49,6 +49,8 @@ pl:
49
49
  scopes:
50
50
  all: "Wszystko"
51
51
  search_status:
52
+ title: "Wyszukiwanie"
53
+ title_with_scope: "Wyszukiwanie %{name}"
52
54
  no_current_filters: "Brak"
53
55
  status_tag:
54
56
  "yes": "Tak"
@@ -52,6 +52,10 @@
52
52
  "yes": "是"
53
53
  "no": "否"
54
54
  "unset": "否"
55
+ toggle_dark_mode: "切换深色模式"
56
+ toggle_main_navigation_menu: "切换主导航"
57
+ toggle_section: "切换区块"
58
+ toggle_user_menu: "切换用户菜单"
55
59
  logout: "退出"
56
60
  powered_by: "构建程序为 %{active_admin} %{version}"
57
61
  sidebars:
@@ -52,6 +52,10 @@
52
52
  "yes": "是"
53
53
  "no": "否"
54
54
  "unset": "未知"
55
+ toggle_dark_mode: "切換暗黑模式"
56
+ toggle_main_navigation_menu: "切換主要導覽"
57
+ toggle_section: "切換區塊"
58
+ toggle_user_menu: "切換使用者選單"
55
59
  logout: "登出"
56
60
  powered_by: "由 %{active_admin} %{version} 提供"
57
61
  sidebars:
@@ -95,7 +95,7 @@ module ActiveAdmin
95
95
  contents = without_wrapper { inputs(options, &form_block) }
96
96
  contents ||= "".html_safe
97
97
 
98
- js = new_record ? js_for_has_many(options[:class], &form_block) : ""
98
+ js = new_record ? js_for_has_many(&form_block) : ""
99
99
  contents << js
100
100
  end
101
101
 
@@ -159,14 +159,13 @@ module ActiveAdmin
159
159
  end
160
160
 
161
161
  # Capture the ADD JS
162
- def js_for_has_many(class_string, &form_block)
162
+ def js_for_has_many(&form_block)
163
163
  assoc_name = assoc_klass.model_name
164
164
  placeholder = "NEW_#{assoc_name.to_s.underscore.upcase.tr('/', '_')}_RECORD"
165
- opts = {
165
+ opts = options.merge(
166
166
  for: [assoc, assoc_klass.new],
167
- class: class_string,
168
167
  for_options: { child_index: placeholder }
169
- }
168
+ )
170
169
  html = template.capture { __getobj__.send(:inputs_for_nested_attributes, opts, &form_block) }
171
170
  text = new_record.is_a?(String) ? new_record : I18n.t("active_admin.has_many_new", model: assoc_name.human)
172
171
 
@@ -23,7 +23,7 @@ module ActiveAdmin
23
23
  # which means there is no way how to scope other actions
24
24
  Pundit.policy_scope!(user, namespace(collection))
25
25
  rescue Pundit::NotDefinedError => e
26
- if default_policy_class && default_policy_class.const_defined?(:Scope)
26
+ if default_policy_class&.const_defined?(:Scope)
27
27
  default_policy_class::Scope.new(user, collection).resolve
28
28
  else
29
29
  raise e
@@ -95,7 +95,7 @@ module ActiveAdmin
95
95
  end
96
96
 
97
97
  def default_policy_class
98
- ActiveAdmin.application.pundit_default_policy && ActiveAdmin.application.pundit_default_policy.constantize
98
+ ActiveAdmin.application.pundit_default_policy&.constantize
99
99
  end
100
100
 
101
101
  def default_policy(subject)
@@ -1,4 +1,4 @@
1
1
  # frozen_string_literal: true
2
2
  module ActiveAdmin
3
- VERSION = "4.0.0.beta13"
3
+ VERSION = "4.0.0.beta14"
4
4
  end
@@ -132,23 +132,11 @@ module ActiveAdmin
132
132
  legend = args.shift if args.first.is_a?(::String)
133
133
  legend = html_options.delete(:name) if html_options.key?(:name)
134
134
  legend_tag = legend ? helpers.tag.legend(legend, class: "fieldset-title") : ""
135
- fieldset_attrs = tag_attributes html_options
135
+ fieldset_attrs = helpers.tag.attributes html_options
136
136
  @opening_tag = "<fieldset #{fieldset_attrs}>#{legend_tag}<ol>"
137
137
  @closing_tag = "</ol></fieldset>"
138
138
  super(*(args << html_options), &block)
139
139
  end
140
-
141
- private
142
-
143
- def tag_attributes(html_options)
144
- if Rails::VERSION::MAJOR <= 6
145
- # Reimplement tag.attributes to backport support for Rails 6.1.
146
- # TODO: this can be removed when support for Rails 6.x is dropped
147
- helpers.tag.tag_options(html_options.to_h).to_s.strip.html_safe
148
- else
149
- helpers.tag.attributes html_options
150
- end
151
- end
152
140
  end
153
141
 
154
142
  class SemanticActionsProxy < FormtasticProxy
data/plugin.js CHANGED
@@ -1,6 +1,6 @@
1
- const plugin = require('tailwindcss/plugin')
2
- const defaultTheme = require('tailwindcss/defaultTheme');
3
- const colors = require('tailwindcss/colors');
1
+ import plugin from 'tailwindcss/plugin';
2
+ import defaultTheme from 'tailwindcss/defaultTheme';
3
+ import colors from 'tailwindcss/colors';
4
4
  const { spacing, borderWidth, borderRadius } = defaultTheme;
5
5
 
6
6
  // https://github.com/tailwindlabs/tailwindcss/discussions/9336
@@ -28,7 +28,7 @@ const svgToTinyDataUri = (() => {
28
28
  return svgToTinyDataUri;
29
29
  })();
30
30
 
31
- module.exports = plugin(
31
+ export default plugin(
32
32
  function({ addBase, addComponents, theme }) {
33
33
  addBase({
34
34
  [[
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: activeadmin
3
3
  version: !ruby/object:Gem::Version
4
- version: 4.0.0.beta13
4
+ version: 4.0.0.beta14
5
5
  platform: ruby
6
6
  authors:
7
7
  - Charles Maresh
@@ -15,7 +15,7 @@ authors:
15
15
  autorequire:
16
16
  bindir: bin
17
17
  cert_chain: []
18
- date: 2024-09-24 00:00:00.000000000 Z
18
+ date: 2024-11-25 00:00:00.000000000 Z
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency
21
21
  name: arbre
@@ -107,14 +107,14 @@ dependencies:
107
107
  requirements:
108
108
  - - ">="
109
109
  - !ruby/object:Gem::Version
110
- version: '6.1'
110
+ version: '7.0'
111
111
  type: :runtime
112
112
  prerelease: false
113
113
  version_requirements: !ruby/object:Gem::Requirement
114
114
  requirements:
115
115
  - - ">="
116
116
  - !ruby/object:Gem::Version
117
- version: '6.1'
117
+ version: '7.0'
118
118
  - !ruby/object:Gem::Dependency
119
119
  name: ransack
120
120
  requirement: !ruby/object:Gem::Requirement
@@ -377,7 +377,6 @@ files:
377
377
  - lib/generators/active_admin/resource/templates/resource.rb.erb
378
378
  - lib/generators/active_admin/views_generator.rb
379
379
  - plugin.js
380
- - vendor/bundle/offense.rb
381
380
  - vendor/javascript/flowbite.js
382
381
  - vendor/javascript/rails_ujs_esm.js
383
382
  homepage: https://activeadmin.info
@@ -400,14 +399,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
400
399
  requirements:
401
400
  - - ">="
402
401
  - !ruby/object:Gem::Version
403
- version: '3.0'
402
+ version: '3.1'
404
403
  required_rubygems_version: !ruby/object:Gem::Requirement
405
404
  requirements:
406
405
  - - ">="
407
406
  - !ruby/object:Gem::Version
408
407
  version: '0'
409
408
  requirements: []
410
- rubygems_version: 3.5.18
409
+ rubygems_version: 3.5.15
411
410
  signing_key:
412
411
  specification_version: 4
413
412
  summary: Active Admin is a Ruby on Rails plugin for generating administration style
@@ -1 +0,0 @@
1
- puts "Ciao"