forked from fixin.me/fixin.me
Add user profile editing
This commit is contained in:
@@ -15,6 +15,8 @@
|
||||
<% if user_signed_in? %>
|
||||
<%= image_link_to t(:sign_out), "logout", destroy_user_session_path,
|
||||
data: { turbo: true, turbo_method: :delete } %>
|
||||
<%= image_link_to t(:profile), "account-wrench-outline", edit_user_registration_path,
|
||||
current: :hide %>
|
||||
<% else %>
|
||||
<%= image_link_to t(:register), "account-plus-outline", new_user_registration_path,
|
||||
current: :hide %>
|
||||
|
||||
@@ -1,27 +0,0 @@
|
||||
<%= form_with(model: user) do |form| %>
|
||||
<% if user.errors.any? %>
|
||||
<div style="color: red">
|
||||
<h2><%= pluralize(user.errors.count, "error") %> prohibited this user from being saved:</h2>
|
||||
|
||||
<ul>
|
||||
<% user.errors.each do |error| %>
|
||||
<li><%= error.full_message %></li>
|
||||
<% end %>
|
||||
</ul>
|
||||
</div>
|
||||
<% end %>
|
||||
|
||||
<div>
|
||||
<%= form.label :email, style: "display: block" %>
|
||||
<%= form.text_field :email %>
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<%= form.label :status, style: "display: block" %>
|
||||
<%= form.number_field :status %>
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<%= form.submit %>
|
||||
</div>
|
||||
<% end %>
|
||||
@@ -1,10 +1,26 @@
|
||||
<h1>Editing user</h1>
|
||||
<% content_for :navigation, flush: true do %>
|
||||
<%= image_link_to t(:back), "arrow-left-bold-outline",
|
||||
request.referer.present? ? :back : root_url %>
|
||||
<% end %>
|
||||
|
||||
<%= render "form", user: @user %>
|
||||
<%= tabular_form_for resource, url: registration_path(resource), html: {method: :patch} do |f| %>
|
||||
<%= f.select :status, User.statuses, readonly: !current_user.at_least(:admin) %>
|
||||
|
||||
<br>
|
||||
<% if current_user.at_least(:admin) %>
|
||||
<%= f.text_field :created_at, readonly: true, tabindex: -1 %>
|
||||
<% end %>
|
||||
|
||||
<div>
|
||||
<%= link_to "Show this user", @user %> |
|
||||
<%= link_to "Back to users", users_path %>
|
||||
</div>
|
||||
<%= f.email_field :email, size: 30, autofocus: true, autocomplete: "off" %>
|
||||
<% if f.object.pending_reconfirmation? %>
|
||||
<%= f.text_field :unconfirmed_email, readonly: true, tabindex: -1,
|
||||
hint: t(".unconfirmed_email_hint",
|
||||
timestamp: f.object.confirmation_sent_at.to_fs(:db_without_sec)) %>
|
||||
<% end %>
|
||||
|
||||
<%= f.password_field :password, size: 30, autocomplete: "off",
|
||||
hint: t('.blank_password_hint_html',
|
||||
subhint: t('.minimum_length_hint_html', count: @minimum_password_length)) %>
|
||||
<%= f.password_field :password_confirmation, size: 30, autocomplete: "off" %>
|
||||
|
||||
<%= f.submit t('.update') %>
|
||||
<% end %>
|
||||
|
||||
Reference in New Issue
Block a user