add basic profile settings

This commit is contained in:
Alex Turchyn
2023-06-07 01:36:47 +03:00
parent 368e364823
commit 219ad2b4a7
15 changed files with 186 additions and 25 deletions
+36
View File
@@ -0,0 +1,36 @@
<menu-active>
<ul class="menu menu-vertical menu-md w-full md:menu-horizontal bg-base-200 rounded-box justify-center font-semibold">
<li>
<%= link_to contact_settings_profile_index_path do %>
<svg xmlns="http://www.w3.org/2000/svg" class="w-5 h-5" width="44" height="44" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round">
<path stroke="none" d="M0 0h24v24H0z" fill="none"/>
<path d="M8 7a4 4 0 1 0 8 0a4 4 0 0 0 -8 0" />
<path d="M6 21v-2a4 4 0 0 1 4 -4h3.5" />
<path d="M18.42 15.61a2.1 2.1 0 0 1 2.97 2.97l-3.39 3.42h-3v-3l3.42 -3.39z" />
</svg>
<span >Edit Contact</span>
<% end %>
</li>
<li>
<%= link_to password_settings_profile_index_path do %>
<svg xmlns="http://www.w3.org/2000/svg" class="w-5 h-5" width="44" height="44" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round">
<path stroke="none" d="M0 0h24v24H0z" fill="none"/>
<path d="M12 3a12 12 0 0 0 8.5 3a12 12 0 0 1 -8.5 15a12 12 0 0 1 -8.5 -15a12 12 0 0 0 8.5 -3" />
<path d="M12 11m-1 0a1 1 0 1 0 2 0a1 1 0 1 0 -2 0" />
<path d="M12 12l0 2.5" />
</svg>
<span>Change Password</span>
<% end %>
</li>
<li>
<%= link_to email_settings_profile_index_path do %>
<svg xmlns="http://www.w3.org/2000/svg" class="w-5 h-5" width="44" height="44" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round">
<path stroke="none" d="M0 0h24v24H0z" fill="none"/>
<path d="M12 12m-4 0a4 4 0 1 0 8 0a4 4 0 1 0 -8 0" />
<path d="M16 12v1.5a2.5 2.5 0 0 0 5 0v-1.5a9 9 0 1 0 -5.5 8.28" />
</svg>
<span>Change Email</span>
<% end %>
</li>
</ul>
</menu-active>
@@ -2,7 +2,8 @@
<%= render 'shared/settings_nav' %>
<div class="flex-grow max-w-xl mx-auto">
<h1 class="text-4xl font-bold mb-4">Profile</h1>
<%= form_for @user, html: { autocomplete: 'off', class: 'space-y-4' } do |f| %>
<%= render 'navigation' %>
<%= form_for current_user, url: update_contact_settings_profile_index_path, method: :patch, html: { autocomplete: 'off', class: 'space-y-4' } do |f| %>
<div class="grid md:grid-cols-2 gap-4">
<div class="form-control">
<%= f.label :first_name, class: 'label' %>
@@ -13,6 +14,12 @@
<%= f.text_field :last_name, required: true, class: 'base-input' %>
</div>
</div>
<%= f.fields_for :account do |ff| %>
<div class="form-control">
<%= ff.label :name, 'Company Name', class: 'label' %>
<%= ff.text_field :name, required: true, class: 'base-input' %>
</div>
<% end %>
<div class="form-control mt-8">
<%= f.button button_title, class: 'base-button' %>
</div>
+30
View File
@@ -0,0 +1,30 @@
<div class="flex flex-wrap space-y-4 md:flex-nowrap md:space-y-0">
<%= render 'shared/settings_nav' %>
<div class="flex-grow max-w-xl mx-auto">
<h1 class="text-4xl font-bold mb-4">Profile</h1>
<%= render 'navigation' %>
<%= form_for current_user, url: update_email_settings_profile_index_path, method: :patch, html: { autocomplete: 'off', class: 'space-y-4' } do |f| %>
<% if current_user.pending_reconfirmation? %>
<div class="alert">
<svg xmlns="http://www.w3.org/2000/svg" class="stroke-current shrink-0 h-6 w-6" fill="none" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M12 9v2m0 4h.01m-6.938 4h13.856c1.54 0 2.502-1.667 1.732-3L13.732 4c-.77-1.333-2.694-1.333-3.464 0L3.34 16c-.77 1.333.192 3 1.732 3z" /></svg>
<div>
<h3 class="font-bold">Currently waiting confirmation</h3>
<div class="text-md">Unconfirmed email: <i><%= current_user.unconfirmed_email %></i></div>
</div>
</div>
<% end %>
<div class="form-control">
<%= f.label :email, 'New email', class: 'label' %>
<%= f.email_field :email, autocomplete: 'off', class: 'base-input' %>
</div>
<div class="form-control">
<%= f.label :current_password, 'Current password', class: 'label' %>
<%= f.password_field :current_password, autocomplete: 'off', class: 'base-input' %>
</div>
<div class="form-control mt-8">
<%= f.button button_title, class: 'base-button' %>
</div>
<% end %>
</div>
<div class="w-0 md:w-52"></div>
</div>
+25
View File
@@ -0,0 +1,25 @@
<div class="flex flex-wrap space-y-4 md:flex-nowrap md:space-y-0">
<%= render 'shared/settings_nav' %>
<div class="flex-grow max-w-xl mx-auto">
<h1 class="text-4xl font-bold mb-4">Profile</h1>
<%= render 'navigation' %>
<%= form_for current_user, url: update_password_settings_profile_index_path, method: :patch, html: { autocomplete: 'off', class: 'space-y-4' } do |f| %>
<div class="form-control">
<%= f.label :current_password, 'Current password', class: 'label' %>
<%= f.password_field :current_password, autocomplete: 'off', class: 'base-input' %>
</div>
<div class="form-control">
<%= f.label :password, 'New password', class: 'label' %>
<%= f.password_field :password, autocomplete: 'off', class: 'base-input' %>
</div>
<div class="form-control">
<%= f.label :password_confirmation, 'Confirm new password', class: 'label' %>
<%= f.password_field :password_confirmation, autocomplete: 'off', class: 'base-input' %>
</div>
<div class="form-control mt-8">
<%= f.button button_title, class: 'base-button' %>
</div>
<% end %>
</div>
<div class="w-0 md:w-52"></div>
</div>