scinote-web/app/views/users/registrations/new.html.erb
2020-08-11 15:39:35 +02:00

95 lines
3.8 KiB
Text

<% provide(:head_title, t('users.registrations.new.head_title')) %>
<% content_for(:body_class, 'sign-up-layout') %>
<div class="sign-up-container">
<div class="sign-up-form-wrapper">
<div class="center-block center-block-narrow">
<h1 class="sign-up-title"><%= t 'users.registrations.new.head_title' %></h1>
<%- if Rails.configuration.x.enable_user_registration && Rails.configuration.x.linkedin_signin_enabled && @oauth_authorize != true %>
<div class="linkedin-container">
<%= render partial: "users/shared/linkedin_sign_in_links", locals: { resource_name: resource_name } %>
<span><%= t("devise.sessions.new.or") %></span>
</div>
<% end -%>
<div data-hook="sign-up-form-hook">
<%= form_for(:user, as: resource_name, url: registration_path(resource_name), html: { id: "sign-up-form" } ) do |f| %>
<div class="form-group sci-input-container">
<%= f.label :full_name, t('users.registrations.new.full_name_label') %>
<%= f.text_field :full_name, autofocus: true, class: 'form-control sci-input-field' %>
</div>
<div class="form-group sci-input-container">
<%= f.label :email, t('users.registrations.new.email_label') %>
<%= f.email_field :email, class: 'form-control sci-input-field' %>
</div>
<div class="form-group sci-input-container">
<%= f.label :password, t('users.registrations.new.password_label') %>
<% if @minimum_password_length %>
<em class="minimum-password-length"><%= t('users.registrations.new.minimum_password_length', password_length: @minimum_password_length) %></em>
<% end %>
<%= f.password_field :password, autocomplete: 'off', class: 'form-control sci-input-field' %>
</div>
<div class="form-group sci-input-container" id="password_confirmation_form">
<%= f.label :password_confirmation, t('users.registrations.new.password_confirmation_label') %>
<%= f.password_field :password_confirmation, autocomplete: 'off', class: 'form-control sci-input-field' %>
</div>
<% if Rails.configuration.x.new_team_on_signup %>
<div class="form-group sci-input-container" id="team_name_form">
<%= label :team, :name, t('users.registrations.new.team_name_label') %>
<% if @team %>
<%= text_field :team, :name, class: 'form-control sci-input-field', value: @team.name,
placeholder: t('users.registrations.new.team_name_placeholder') %>
<% else %>
<%= text_field :team, :name, class: 'form-control sci-input-field',
placeholder: t('users.registrations.new.team_name_placeholder') %>
<% end %>
</div>
<% end %>
<%= recaptcha_input_tag %>
<div class="form-group" data-hook="sign-up-form-submit">
<%= f.button 'Sign up', class: 'btn btn-primary sign-up-button' %>
</div>
<% end %>
</div>
<%= render partial: 'users/shared/links', locals: {linkedin_skip: true} %>
</div>
</div>
</div>
<% if resource and not resource.errors.empty? %>
<script>
(function () {
var formErrors = {};
<% resource.errors.as_json.each do |err, messages| %>
formErrors["<%= err %>"]=[]
<% messages.each do |message| %>
formErrors["<%= err %>"].push('<%= message %>');
<% end %>
<% end %>
$("form").renderFormErrors("user", formErrors, false);
}());
</script>
<% end %>
<% if @team and not @team.errors.empty? %>
<script>
(function () {
var formErrors = {};
<% @team.errors.as_json.each do |err, messages| %>
formErrors["<%= err %>"]=[]
<% messages.each do |message| %>
formErrors["<%= err %>"].push('<%= message %>');
<% end %>
<% end %>
$("form").renderFormErrors('team', formErrors, false);
}());
</script>
<% end %>