admin_suite 0.2.4 → 0.2.6

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: ac7ab643c69ac46cf31a6b48734cd58cae60233e8284a738147b419e4982fde3
4
- data.tar.gz: b37617cd8e1f00fef844f95ddb81800f12990d48940c1a7d14cf47de1fd7e64e
3
+ metadata.gz: 4a19232543e5f8aa66155c67a802f471e6263987ab9931ba5cc3b09d4594c8c1
4
+ data.tar.gz: f84997e801a5de253a888d7b43e6b18f9d147befa72c31b3b42b1037c28d002c
5
5
  SHA512:
6
- metadata.gz: d845685a1eabba91a371b975f3599bdf282a3940af720a9feb545751e044544a0aa8818611e742ebb37728fe86c5af41bb511462a211e9fcdc8e286649a67a05
7
- data.tar.gz: dcc33dd1079fe5da4357445b939742d7cada340f858deabc45bdc3531dad59fe46a7c77c9ba33d9df5b0bc3ffe9f9c7b163a46b4484c3c99c5825e38f947acf9
6
+ metadata.gz: '00488cc60abfd97e0dee09e8a6958a39488a190ab7e60667f554a06b316a1209ee1a720c7af888d6c43d045786d99f528fbc7c5c66ec9546370f8d15337e7a09'
7
+ data.tar.gz: 866b3dabd47b50f4fbe6f2f6ee8cfdb894906cbd9e7a1217f7b3f47a693ddcfcabf6fb1802b516ee68b768a9d341012ba1ba7eb6eba2dabc1bcaf7e3f2e1a284
data/CHANGELOG.md CHANGED
@@ -7,6 +7,13 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
7
7
 
8
8
  ## [Unreleased]
9
9
 
10
+ ## [0.2.6] - 2026-02-21
11
+
12
+ ### Added
13
+
14
+ - Automated GitHub Release creation in the publish workflow, with release notes extracted from `CHANGELOG.md`.
15
+ - When no `CHANGELOG.md` entry exists for the current version, release notes are now primarily auto-generated from commits since the previous tag, with the plain "Release vX.Y.Z" string used only as a final fallback when no commit-generated notes are available.
16
+
10
17
  ## [0.1.0] - 2026-02-04
11
18
 
12
19
  ### Added
@@ -64,9 +64,10 @@ module AdminSuite
64
64
 
65
65
  executor = Admin::Base::ActionExecutor.new(resource_config, action, admin_suite_actor)
66
66
  result = executor.execute_member(@resource, params.to_unsafe_h)
67
+ redirect_target = result.redirect_url.presence || resource_url(@resource)
67
68
 
68
69
  if result.success?
69
- redirect_to resource_url(@resource), notice: result.message
70
+ redirect_to redirect_target, notice: result.message
70
71
  else
71
72
  redirect_to resource_url(@resource), alert: result.message
72
73
  end
@@ -211,8 +212,18 @@ module AdminSuite
211
212
  end
212
213
  end
213
214
 
214
- key = resource_class.model_name.param_key
215
- params.require(key).permit(permitted_fields + array_fields)
215
+ candidate_keys = []
216
+ candidate_keys << @resource.class.model_name.param_key if defined?(@resource) && @resource.present?
217
+ candidate_keys << resource_class.model_name.param_key
218
+ candidate_keys.uniq!
219
+
220
+ candidate_keys.each do |key|
221
+ if params.key?(key) || params.key?(key.to_sym)
222
+ return params.require(key).permit(permitted_fields + array_fields)
223
+ end
224
+ end
225
+
226
+ params.require(resource_class.model_name.param_key).permit(permitted_fields + array_fields)
216
227
  end
217
228
 
218
229
  def toggleable_fields
data/docs/releasing.md CHANGED
@@ -20,6 +20,7 @@ The gem is automatically published to RubyGems when changes are merged to `main`
20
20
  - Check if the version already exists on RubyGems
21
21
  - Build and publish the gem (if it's a new version)
22
22
  - Create a Git tag for the release (if it doesn't already exist)
23
+ - Create a GitHub Release with notes extracted from `CHANGELOG.md`, or auto-generated from commits since the previous tag if no CHANGELOG entry exists
23
24
 
24
25
  ### Requirements
25
26
 
@@ -59,7 +60,8 @@ gem push "admin_suite-X.Y.Z.gem"
59
60
  ## Notes
60
61
 
61
62
  - RubyGems commonly requires MFA/OTP for pushes (this gem is configured with `rubygems_mfa_required`)
62
- - The automated workflow uses a GitHub Actions bot to push tags
63
+ - The automated workflow uses a GitHub Actions bot to push tags and create GitHub Releases
63
64
  - The publish workflow only runs after the CI workflow completes successfully
65
+ - GitHub Release notes are sourced from the matching version section in `CHANGELOG.md`; if no entry exists, they are auto-generated from commits since the previous tag; a plain "Release vX.Y.Z" string is used only as a final fallback when no previous tag or commit-generated notes are available
64
66
  - You can manually trigger the publish workflow from the GitHub Actions tab if needed
65
67
 
@@ -109,14 +109,33 @@ module Admin
109
109
 
110
110
  def execute_model_method(record, action, bang: false)
111
111
  method_name = bang ? "#{action.name}!" : action.name
112
- record.public_send(method_name)
113
- success_result("#{action.label} completed successfully")
112
+ action_result = record.public_send(method_name)
113
+ return action_result if action_result.is_a?(Result)
114
+
115
+ success_result(
116
+ "#{action.label} completed successfully",
117
+ redirect_url: redirect_url_for_action(action, action_result)
118
+ )
114
119
  rescue ActiveRecord::RecordInvalid => e
115
120
  failure_result("Validation failed: #{e.record.errors.full_messages.join(', ')}")
116
121
  rescue AASM::InvalidTransition => e
117
122
  failure_result("Invalid state transition: #{e.message}")
118
123
  end
119
124
 
125
+ def redirect_url_for_action(action, action_result)
126
+ return nil unless action.name.to_sym == :duplicate
127
+ return nil unless action_result.respond_to?(:persisted?) && action_result.persisted?
128
+ return nil unless resource_class.respond_to?(:portal_name) && resource_class.respond_to?(:resource_name_plural)
129
+
130
+ AdminSuite::Engine.routes.url_helpers.resource_path(
131
+ portal: resource_class.portal_name,
132
+ resource_name: resource_class.resource_name_plural,
133
+ id: action_result.to_param
134
+ )
135
+ rescue StandardError
136
+ nil
137
+ end
138
+
120
139
  def find_handler_class(action)
121
140
  if defined?(AdminSuite) && AdminSuite.config.resolve_action_handler.present?
122
141
  resolved = AdminSuite.config.resolve_action_handler.call(resource_class, action.name)
@@ -2,7 +2,7 @@
2
2
 
3
3
  module AdminSuite
4
4
  module Version
5
- VERSION = "0.2.4"
5
+ VERSION = "0.2.6"
6
6
  end
7
7
 
8
8
  # Backward-compatible constant.
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: admin_suite
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.4
4
+ version: 0.2.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - TechWright Labs
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2026-02-18 00:00:00.000000000 Z
11
+ date: 2026-02-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails