app/views/profile/edit.html.haml
%div(class="justify-center py-5 sm:px-6 lg:px-8")
%div(class="mt-3 sm:mx-auto sm:w-full sm:max-w-2xl")
%div(class="py-8 px-4 sm:px-10")
%h1.text-center.text-3xl.font-medium.mb-8.tracking-tight Edit Profile
= form_with model: @user, url: update_profile_path, data: {turbo: false} do |f|
- if @user.errors.any?
.alert.alert-error
.flex
.ml-1.flex-1
%p.text-sm.leading-5 Please correct the errors below to continue.
.mt-6(class="#{form_error_class(@user, :name)}")
%label(for='user_name') Name
.mt-1.rounded-md.shadow-sm
= f.text_field :name, autofocus: true, class: 'appearance-none block w-full px-3 py-2 border border-gray-300 rounded-md placeholder-gray-400 focus:outline-none focus:shadow-outline-blue focus:border-blue-300 transition duration-150 ease-in-out sm:leading-5'
= model_error_display(@user, :name)
.mt-6(class="#{form_error_class(@user, :email)}")
%label(for='user_email') Email
.mt-1.rounded-md.shadow-sm
= f.email_field :email, class: 'appearance-none block w-full px-3 py-2 border border-gray-300 rounded-md placeholder-gray-400 focus:outline-none focus:shadow-outline-blue focus:border-blue-300 transition duration-150 ease-in-out sm:leading-5'
= model_error_display(@user, :email)
.mt-6(class="#{form_error_class(@user, :password)}")
.flex.items-center.justify-between
%label(for='user_password') Password
%small.text-gray-500 Optional
.mt-1.rounded-md.shadow-sm
= f.password_field :password, class: 'appearance-none block w-full px-3 py-2 border border-gray-300 rounded-md placeholder-gray-400 focus:outline-none focus:shadow-outline-blue focus:border-blue-300 transition duration-150 ease-in-out sm:leading-5'
= model_error_display(@user, :password)
.mt-6(class="#{form_error_class(@user, :password_confirmation)}")
.flex.items-center.justify-between
%label(for='user_password_confirmation') Password Confirmation
%small.text-gray-500 Optional
.mt-1.rounded-md.shadow-sm
= f.password_field :password_confirmation, class: 'appearance-none block w-full px-3 py-2 border border-gray-300 rounded-md placeholder-gray-400 focus:outline-none focus:shadow-outline-blue focus:border-blue-300 transition duration-150 ease-in-out sm:leading-5'
= model_error_display(@user, :password_confirmation)
.mt-6
= f.submit 'Save', class: 'text-blue-500'