scinote-web/app/views/users/invitations/edit.html.erb
Soufiane 30c5b1675f
Missing warning messages when setting up new user [SCI-8595] (#5548)
* Fix form errors in users invitation edit [SCI-8595]

Co-authored-by: Sboursen <dev.sboursen@gmail.com>

* Fix form errors in users confirmation new [SCI-8595]

Co-authored-by: Sboursen <dev.sboursen@gmail.com>

* Fix form errors in users registration [SCI-8595]

Co-authored-by: Sboursen <dev.sboursen@gmail.com>

---------

Co-authored-by: Sboursen <dev.sboursen@gmail.com>
2023-06-02 15:35:29 +02:00

83 lines
2.7 KiB
Text

<% provide(:head_title, t("users.invitations.edit.head_title")) %>
<div class="center-block center-block-narrow">
<h2><%= t 'devise.invitations.edit.header' %></h2>
<%= form_for (resource or :user), as: resource_name, url: invitation_path(resource_name), html: { method: :put, id: 'invitation-form' } do |f| %>
<%= f.hidden_field :invitation_token %>
<p class="sci-input-container">
<%= f.label :full_name %>
<%= f.text_field :full_name,
value: (params[:user] ? params[:user][:full_name] : ''),
autofocus: true,
class: 'sci-input-field' %>
</p>
<p class="sci-input-container">
<%= f.label :password %>
<% if @minimum_password_length %>
<em>(<%= @minimum_password_length %> characters minimum)</em>
<% end %>
<%= f.password_field :password, autocomplete: "off", class: "sci-input-field" %>
</p>
<p class="sci-input-container">
<%= f.label :password_confirmation %>
<%= f.password_field :password_confirmation, autocomplete: "off", class: "sci-input-field" %>
</p>
<% if Rails.configuration.x.new_team_on_signup %>
<p class="sci-input-container"
data-hook="confirm-invitation-team-name">
<%= label :team, :name, t('users.registrations.new.team_name_label') %>
<% if @team %>
<%= text_field :team, :name, class: 'sci-input-field', value: @team.name %>
<% else %>
<%= text_field :team,
:name,
class: 'form-control',
value: (params[:team] ? params[:team][:name] : '') %>
<% end %>
</p>
<% end %>
<%= recaptcha_input_tag %>
<div class="form-group" data-hook="confirm-invitation-form-submit">
<%= f.submit "Sign Up", class: "btn btn-primary invitation-submit" %>
</div>
<% end %>
</div>
<%= render partial: 'users/sessions/login_disclaimer'%>
<% if resource && resource.errors.present? %>
<% form_errors = {} %>
<% resource.errors.as_json.each do |err, messages| %>
<% form_errors[err] = [] %>
<% messages.each do |message| %>
<% form_errors[err].push(message) %>
<% end %>
<% end %>
<div class="hidden" id="resource-error-data" data-form-errors="<%= form_errors.to_json %>"></div>
<%= javascript_include_tag 'users/invitations/resource_errors', nonce: true %>
<% end %>
<% if @team && @team.errors.present? %>
<%= form_errors = {} %>
<% @team.errors.as_json.each do |err, messages| %>
<% form_errors[err] = [] %>
<% messages.each do |message| %>
<% form_errors[err].push(message) %>
<% end %>
<% end %>
<div class="hidden" id="team-error-data" data-form-errors="<%= form_errors.to_json %>"></div>
<%= javascript_include_tag 'users/invitations/team_errors', nonce: true %>
<% end %>