Files
nairobi/app/views/management/users/new.html.erb
Javi Martín 6af8ddd324 Extract component to render the date of birth
We reduce code duplication thanks to that, and make it easier
to change this field.

Note that there was one place where the "16.years" value was
hardcoded. We're moving the test for this case to the
component and changing it so the test doesn't use the default
age.

We're also removing the redundant helper method that had the
same code as a method in the User class which is called
everywhere else.
2024-11-12 15:15:34 +01:00

28 lines
1009 B
Plaintext

<h2><%= t("management.users.create_user_info") %></h2>
<div class="small-12 medium-6 column">
<div class="verification account">
<%= form_for @user, url: management_users_path do |f| %>
<%= f.hidden_field :document_type %>
<%= f.hidden_field :document_number %>
<%= f.text_field :username,
label: t("management.username_label") %>
<%= f.text_field :email,
label: t("management.users.email_optional_label") %>
<div class="date-of-birth">
<%= render Shared::DateOfBirthFieldComponent.new(f, label: t("management.date_of_birth")) %>
</div>
<%= f.submit t("management.users.create_user_submit"), class: "button success" %>
<% end %>
</div>
</div>
<div class="small-12 medium-6 column">
<div class="callout">
<%= render "management/user_permissions",
message: t("management.document_verifications.in_census_has_following_permissions"),
user: @user %>
</div>
</div>