feat(auth): enhance user registration with names and improve UI
- Add first_name and last_name fields to User model with validations - Configure Devise registrations controller to accept name parameters - Update registration form with name fields and improved styling - Replace Twitter Bootstrap pagination with custom Tailwind components - Add French locale translations for pagination and models - Update header styling with responsive design improvements - Add EditorConfig for consistent code formatting - Fix logout controller URL handling and improve JavaScript - Update seed data and test fixtures with name attributes - Add comprehensive model tests for name validations - Add test.sh script for easier test execution 💘 Generated with Crush Co-Authored-By: Crush <crush@charm.land>
This commit is contained in:
@@ -4,8 +4,10 @@
|
||||
|
||||
import { application } from "./application"
|
||||
|
||||
import LogoutController from "./logout_controller"
|
||||
import ShadcnTestController from "./shadcn_test_controller"
|
||||
import CounterController from "./counter_controller"
|
||||
|
||||
application.register("logout", LogoutController)
|
||||
application.register("shadcn-test", ShadcnTestController)
|
||||
application.register("counter", CounterController)
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
// app/javascript/controllers/logout_controller.js
|
||||
import { Controller } from "@hotwired/stimulus";
|
||||
|
||||
export default class extends Controller {
|
||||
@@ -7,14 +6,13 @@ export default class extends Controller {
|
||||
};
|
||||
|
||||
connect() {
|
||||
// Optional: Add confirmation message
|
||||
//console.log("Hello LogoutController, Stimulus!", this.element);
|
||||
// this.element.dataset.confirm = "Êtes-vous sûr de vouloir vous déconnecter ?";
|
||||
// Display a message when the controller is mounted
|
||||
console.log("LogoutController mounted", this.element);
|
||||
}
|
||||
|
||||
signOut(event) {
|
||||
event.preventDefault();
|
||||
console.log("LogoutController#signOut mounted");
|
||||
console.log("User clicked on logout button.");
|
||||
|
||||
// Ensure user wants to disconnect with a confirmation request
|
||||
// if (this.hasUrlValue && !confirm(this.element.dataset.confirm)) { return; }
|
||||
@@ -23,7 +21,11 @@ export default class extends Controller {
|
||||
const csrfToken = document.querySelector("[name='csrf-token']").content;
|
||||
|
||||
// Define url to redirect user when action is valid
|
||||
const url = this.hasUrlValue ? this.urlValue : this.element.href;
|
||||
let url = this.hasUrlValue ? this.urlValue : this.element.href;
|
||||
// Ensure the URL is using the correct path prefix
|
||||
if (url && !url.includes('/auth/sign_out')) {
|
||||
url = url.replace('/users/sign_out', '/auth/sign_out');
|
||||
}
|
||||
|
||||
// Use fetch to send logout request
|
||||
fetch(url, {
|
||||
|
||||
Reference in New Issue
Block a user