From 368a88d63a02395723c6aacf819b901c1c56412d Mon Sep 17 00:00:00 2001 From: Thomas von Deyen Date: Fri, 10 Apr 2026 19:15:39 +0200 Subject: [PATCH 1/3] feat: Add edit user link to user info Alchemy 8.2 has a new feature that allows to add a link to the user edit form from the user info panel. Signed-off-by: Thomas von Deyen --- app/views/alchemy/admin/users/edit.html.erb | 23 +++++++++++++++++++-- config/initializers/alchemy.rb | 1 + 2 files changed, 22 insertions(+), 2 deletions(-) diff --git a/app/views/alchemy/admin/users/edit.html.erb b/app/views/alchemy/admin/users/edit.html.erb index 2f45902b..5cc4bb4c 100644 --- a/app/views/alchemy/admin/users/edit.html.erb +++ b/app/views/alchemy/admin/users/edit.html.erb @@ -1,3 +1,22 @@ -<%= alchemy_form_for [:admin, @user] do |f| %> - <%= render 'fields', f: f %> +<% if request.xhr? || turbo_frame_request? %> + <%= alchemy_form_for [:admin, @user] do |f| %> + <%= render 'fields', f: f %> + <% end %> +<% else %> + <%= content_for :toolbar do %> + + <%= link_to request.referer || alchemy.admin_dashboard_path, class: "icon_button" do %> + + <% end %> + + <% end %> + +
+ + <%= Alchemy.t(:edit_user) %> + + <%= alchemy_form_for [:admin, @user] do |f| %> + <%= render 'fields', f: f %> + <% end %> +
<% end %> diff --git a/config/initializers/alchemy.rb b/config/initializers/alchemy.rb index 5fa82dcb..138beaf5 100644 --- a/config/initializers/alchemy.rb +++ b/config/initializers/alchemy.rb @@ -19,4 +19,5 @@ Alchemy.config.login_path = "/admin/login" Alchemy.config.logout_path = "/admin/logout" Alchemy.config.logout_method = Devise.sign_out_via.to_s + Alchemy.config.edit_user_path = "/admin/users/:id/edit" end From eee3e9834a88b7b465f9fac7cfba294e0ff63890 Mon Sep 17 00:00:00 2001 From: Thomas von Deyen Date: Fri, 10 Apr 2026 19:16:06 +0200 Subject: [PATCH 2/3] chore: Pass locals instead of ivars This fixes a Herb linter issue. Signed-off-by: Thomas von Deyen --- app/views/alchemy/admin/users/_fields.html.erb | 10 +++++----- app/views/alchemy/admin/users/edit.html.erb | 4 ++-- app/views/alchemy/admin/users/new.html.erb | 2 +- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/app/views/alchemy/admin/users/_fields.html.erb b/app/views/alchemy/admin/users/_fields.html.erb index c447c228..60ee16fe 100644 --- a/app/views/alchemy/admin/users/_fields.html.erb +++ b/app/views/alchemy/admin/users/_fields.html.erb @@ -1,7 +1,7 @@ <%= f.input :firstname, input_html: {autocomplete: "given-name"} %> <%= f.input :lastname, input_html: {autocomplete: "family-name"} %> -<%= f.input :login, autofocus: true, required: @user.login_required?, input_html: {autocomplete: "username"} %> -<%= f.input :email, required: @user.email_required?, input_html: {autocomplete: "email"} %> +<%= f.input :login, autofocus: true, required: f.object.login_required?, input_html: {autocomplete: "username"} %> +<%= f.input :email, required: f.object.email_required?, input_html: {autocomplete: "email"} %> <% if Alchemy::I18n.available_locales.many? %>
<%= f.label(:language) %> @@ -16,9 +16,9 @@ is: "alchemy-select", data: {allow_clear: true} } %> -<% if can_update_role? %> +<% if local_assigns[:user_roles] && can_update_role? %> <%= f.input :alchemy_roles, - collection: @user_roles, + collection: user_roles, input_html: { multiple: true, is: 'alchemy-select', @@ -32,7 +32,7 @@ <%= f.label :tag_list %> <%= render 'alchemy/admin/partials/autocomplete_tag_list', f: f, - object: @user %> + object: f.object %>
<% end %> <%= f.input :send_credentials, as: 'boolean' %> diff --git a/app/views/alchemy/admin/users/edit.html.erb b/app/views/alchemy/admin/users/edit.html.erb index 5cc4bb4c..75341dd2 100644 --- a/app/views/alchemy/admin/users/edit.html.erb +++ b/app/views/alchemy/admin/users/edit.html.erb @@ -1,6 +1,6 @@ <% if request.xhr? || turbo_frame_request? %> <%= alchemy_form_for [:admin, @user] do |f| %> - <%= render 'fields', f: f %> + <%= render "fields", f: f, user_roles: @user_roles %> <% end %> <% else %> <%= content_for :toolbar do %> @@ -16,7 +16,7 @@ <%= Alchemy.t(:edit_user) %> <%= alchemy_form_for [:admin, @user] do |f| %> - <%= render 'fields', f: f %> + <%= render "fields", f: f, user_roles: @user_roles %> <% end %> <% end %> diff --git a/app/views/alchemy/admin/users/new.html.erb b/app/views/alchemy/admin/users/new.html.erb index 2f45902b..6e97652e 100644 --- a/app/views/alchemy/admin/users/new.html.erb +++ b/app/views/alchemy/admin/users/new.html.erb @@ -1,3 +1,3 @@ <%= alchemy_form_for [:admin, @user] do |f| %> - <%= render 'fields', f: f %> + <%= render 'fields', f: f, user_roles: @user_roles %> <% end %> From 4ea5e14f65280cdafbeb5b55c119c5a31625e701 Mon Sep 17 00:00:00 2001 From: Thomas von Deyen Date: Fri, 10 Apr 2026 19:27:17 +0200 Subject: [PATCH 3/3] Drop Alchemy 8.1 support We use features only available by Alchemy 8.2 Signed-off-by: Thomas von Deyen --- .github/workflows/ci.yml | 4 ---- alchemy-devise.gemspec | 2 +- 2 files changed, 1 insertion(+), 5 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 51f80552..db979f63 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -13,7 +13,6 @@ jobs: fail-fast: false matrix: alchemy_branch: - - "8.1-stable" - "8.2-stable" ruby: - "3.3" @@ -27,9 +26,6 @@ jobs: - mysql - postgresql - sqlite - exclude: - - alchemy_branch: "8.0-stable" - rails: "8.1" env: DB: ${{ matrix.database }} diff --git a/alchemy-devise.gemspec b/alchemy-devise.gemspec index 1d64943c..6a06fb36 100644 --- a/alchemy-devise.gemspec +++ b/alchemy-devise.gemspec @@ -15,7 +15,7 @@ Gem::Specification.new do |s| s.files = Dir["{app,config,db,lib}/**/*", "LICENSE", "CHANGELOG.md", "README.md"] - s.add_dependency "alchemy_cms", [">= 8.1.0.a", "< 9.0"] + s.add_dependency "alchemy_cms", [">= 8.2.0", "< 9.0"] s.add_dependency "devise", ">= 4.9", "< 6.0" s.add_dependency "flickwerk", ["~> 0.3.6"]