From cba76e718f612532ed37732cb1475cb4e24e0f35 Mon Sep 17 00:00:00 2001 From: songtianlun Date: Tue, 11 Feb 2025 15:28:42 +0800 Subject: [PATCH] feat: enhance user registration UI and navigation - Improve the user registration form layout with card styling. - Add input classes for better design consistency. - Introduce a new navbar partial for better component management. - Removed the old navbar code to streamline application layout. These changes provide a more modern and user-friendly experience during user registration and improve the overall site's navigation structure. --- app/views/devise/registrations/new.html.erb | 74 +++++++++++++-------- app/views/layouts/_navbar.html.erb | 13 ++++ app/views/layouts/application.html.erb | 17 +---- 3 files changed, 64 insertions(+), 40 deletions(-) create mode 100644 app/views/layouts/_navbar.html.erb diff --git a/app/views/devise/registrations/new.html.erb b/app/views/devise/registrations/new.html.erb index d655b66..55b3917 100644 --- a/app/views/devise/registrations/new.html.erb +++ b/app/views/devise/registrations/new.html.erb @@ -1,29 +1,51 @@ -

Sign up

+
+
+
+

Sign up

-<%= form_for(resource, as: resource_name, url: registration_path(resource_name)) do |f| %> - <%= render "devise/shared/error_messages", resource: resource %> + <%= form_for(resource, as: resource_name, url: registration_path(resource_name), html: { class: "space-y-4" }) do |f| %> + <%= render "devise/shared/error_messages", resource: resource %> -
- <%= f.label :email %>
- <%= f.email_field :email, autofocus: true, autocomplete: "email" %> +
+ <%= f.label :email, class: "label" %> + <%= f.email_field :email, + autofocus: true, + autocomplete: "email", + class: "input input-bordered w-full", + placeholder: "your@email.com" %> +
+ +
+ <%= f.label :password, class: "label" do %> + Password + <% if @minimum_password_length %> + (<%= @minimum_password_length %> characters minimum) + <% end %> + <% end %> + <%= f.password_field :password, + autocomplete: "new-password", + class: "input input-bordered w-full", + placeholder: "••••••••" %> +
+ +
+ <%= f.label :password_confirmation, class: "label" %> + <%= f.password_field :password_confirmation, + autocomplete: "new-password", + class: "input input-bordered w-full", + placeholder: "••••••••" %> +
+ +
+ <%= f.submit "Sign up", class: "btn btn-primary w-full" %> +
+ <% end %> + +
OR
+ +
+ <%= render "devise/shared/links" %> +
+
- -
- <%= f.label :password %> - <% if @minimum_password_length %> - (<%= @minimum_password_length %> characters minimum) - <% end %>
- <%= f.password_field :password, autocomplete: "new-password" %> -
- -
- <%= f.label :password_confirmation %>
- <%= f.password_field :password_confirmation, autocomplete: "new-password" %> -
- -
- <%= f.submit "Sign up" %> -
-<% end %> - -<%= render "devise/shared/links" %> +
\ No newline at end of file diff --git a/app/views/layouts/_navbar.html.erb b/app/views/layouts/_navbar.html.erb new file mode 100644 index 0000000..552aae4 --- /dev/null +++ b/app/views/layouts/_navbar.html.erb @@ -0,0 +1,13 @@ + \ No newline at end of file diff --git a/app/views/layouts/application.html.erb b/app/views/layouts/application.html.erb index 83a7950..4471968 100644 --- a/app/views/layouts/application.html.erb +++ b/app/views/layouts/application.html.erb @@ -54,23 +54,12 @@ - + <%= render 'layouts/navbar' %> +
-
+
<% if notice %>