From a42eb7d379772a4ec688fc663d4e0471632636f6 Mon Sep 17 00:00:00 2001 From: Jeremy Lecour Date: Sat, 22 Jan 2022 18:48:11 +0100 Subject: [PATCH] =?UTF-8?q?Am=C3=A9lioration=20de=20la=20pr=C3=A9sentation?= =?UTF-8?q?=20des=20utilisateurs?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/accounts_controller.rb | 4 +-- app/views/accounts/edit.html.erb | 10 ++++-- app/views/accounts/new.html.erb | 4 +++ app/views/users/index.html.erb | 42 +++++++++++++++----------- 4 files changed, 38 insertions(+), 22 deletions(-) diff --git a/app/controllers/accounts_controller.rb b/app/controllers/accounts_controller.rb index cfbd822..320ff2f 100644 --- a/app/controllers/accounts_controller.rb +++ b/app/controllers/accounts_controller.rb @@ -48,10 +48,10 @@ class AccountsController < ApplicationController private def create_user_params - params.require(:user).permit(:email, :password, :password_confirmation) + params.require(:user).permit(:email, :password, :password_confirmation, :name) end def update_user_params - params.require(:user).permit(:current_password, :password, :password_confirmation, :unconfirmed_email) + params.require(:user).permit(:current_password, :password, :password_confirmation, :unconfirmed_email, :name) end end diff --git a/app/views/accounts/edit.html.erb b/app/views/accounts/edit.html.erb index 8dbdf99..3609af8 100644 --- a/app/views/accounts/edit.html.erb +++ b/app/views/accounts/edit.html.erb @@ -8,18 +8,22 @@ <%= form.label :unconfirmed_email, "New Email" %> <%= form.text_field :unconfirmed_email %> +
+ <%= form.label :name %> + <%= form.text_field :name, autocomplete: "name" %> +
<%= form.label :password, "Password (leave blank if you don't want to change it)" %> - <%= form.password_field :password %> + <%= form.password_field :password, autocomplete: "new-password" %>
<%= form.label :password_confirmation %> - <%= form.password_field :password_confirmation %> + <%= form.password_field :password_confirmation, autocomplete: "new-password" %>

<%= form.label :current_password, "Current password (we need your current password to confirm your changes)" %> - <%= form.password_field :current_password, required: true %> + <%= form.password_field :current_password, required: true, autocomplete: "current-password" %>
<%= form.submit "Update Account" %> <% end %> \ No newline at end of file diff --git a/app/views/accounts/new.html.erb b/app/views/accounts/new.html.erb index 3e0c8b0..23c0a30 100644 --- a/app/views/accounts/new.html.erb +++ b/app/views/accounts/new.html.erb @@ -4,6 +4,10 @@ <%= form.label :email %> <%= form.text_field :email, required: true, autofocus: true, autocomplete: "email" %> +
+ <%= form.label :name %> + <%= form.text_field :name, autocomplete: "name" %> +
<%= form.label :password %> <%= form.password_field :password, required: true, autocomplete: "new-password" %> diff --git a/app/views/users/index.html.erb b/app/views/users/index.html.erb index caffa59..5d67122 100644 --- a/app/views/users/index.html.erb +++ b/app/views/users/index.html.erb @@ -13,20 +13,14 @@ - - "> - -
- Gravatar - - Email - Name - Created at + Created at
Updated at
- Updated at + Status Edit @@ -37,19 +31,33 @@ <% @users.each do |user| %>
- <%= user_gravatar current_user, class: "h-10 w-10 rounded-full", size: 80 %> - - <%= user.email %> - - <%= user.name %> +
+
+ <%= user_gravatar current_user, class: "h-10 w-10 rounded-full", size: 80 %> +
+
+
+ <%= user.name.presence || "Anonymous".html_safe %> +
+
+ <%= user.email %> +
+
+
- <%= user.created_at %> + <%= user.created_at %>
<%= user.updated_at %>
- <%= user.updated_at %> + <% if user.confirmed? %> + + Confirmed + + <% else %> + + Unconfirmed + + <% end %> <%= link_to "Show", user, class: "text-indigo-600 hover:text-indigo-900" %>