Skip to content

Conversation

@RJV333
Copy link
Contributor

@RJV333 RJV333 commented Jan 23, 2026

What is the goal of this PR and why is this important?

Address #721 . Uses a different design. Adds a green or red icon to the top of the page showing if the User is currently locked or unlocked. There's a corresponding button at the bottom of the page to "toggle" the locked_at state of the User. Adds a request spec for this new endpoint.

Screenshot 2026-01-22 at 10 29 32 PM Screenshot 2026-01-22 at 10 29 27 PM

<% if @user.persisted? && current_user.super_user? %>
<button type="button"
class="btn <%= @user.locked_at.present? ? 'bg-green-600 hover:bg-green-700 text-white border-green-600' : 'bg-orange-600 hover:bg-orange-700 text-white border-orange-600' %> border font-medium"
onclick="event.preventDefault(); event.stopPropagation(); const form = document.createElement('form'); form.method = 'POST'; form.action = '<%= toggle_lock_status_user_path(@user) %>'; const token = document.querySelector('meta[name=csrf-token]'); if (token) { const input = document.createElement('input'); input.type = 'hidden'; input.name = 'authenticity_token'; input.value = token.content; form.appendChild(input); } document.body.appendChild(form); form.submit();">
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Any thoughts on a Stimulus controller for this?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants