scinote-web/app/views/users/registrations/new.html.erb

98 lines
3.9 KiB
Text
Raw Normal View History

2017-01-25 19:01:23 +08:00
<% provide(:head_title, t('users.registrations.new.head_title')) %>
2020-03-27 16:43:49 +08:00
<% 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>
2016-02-12 23:52:43 +08:00
2020-03-27 16:43:49 +08:00
<%- 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 -%>
2016-02-12 23:52:43 +08:00
2020-03-27 16:43:49 +08:00
<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| %>
2016-02-12 23:52:43 +08:00
2020-03-27 16:43:49 +08:00
<div class="form-group sci-input-container">
2020-03-27 17:34:06 +08:00
<%= f.label :full_name, t('users.registrations.new.full_name_label') %>
2020-03-27 16:43:49 +08:00
<%= f.text_field :full_name, autofocus: true, class: 'form-control sci-input-field' %>
</div>
2016-02-12 23:52:43 +08:00
2020-03-27 16:43:49 +08:00
<div class="form-group sci-input-container">
2020-03-27 17:34:06 +08:00
<%= f.label :email, t('users.registrations.new.email_label') %>
2020-03-27 16:43:49 +08:00
<%= f.email_field :email, class: 'form-control sci-input-field' %>
</div>
2016-02-12 23:52:43 +08:00
2020-03-27 16:43:49 +08:00
<div class="form-group sci-input-container">
2020-03-27 17:34:06 +08:00
<%= f.label :password, t('users.registrations.new.password_label') %>
2020-03-27 16:43:49 +08:00
<% if @minimum_password_length %>
2020-03-27 17:34:06 +08:00
<em class="minimum-password-length"><%= t('users.registrations.new.minimum_password_length', password_length: @minimum_password_length) %></em>
2020-03-27 16:43:49 +08:00
<% 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">
2020-03-27 17:34:06 +08:00
<%= f.label :password_confirmation, t('users.registrations.new.password_confirmation_label') %>
2020-03-27 16:43:49 +08:00
<%= 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 %>
2016-11-22 21:57:41 +08:00
2020-03-27 16:43:49 +08:00
<div class="form-group" data-hook="sign-up-form-submit">
2020-07-06 20:52:42 +08:00
<%= f.button 'Sign up', class: 'btn btn-primary sign-up-button' %>
2020-03-27 16:43:49 +08:00
</div>
<% end %>
</div>
<%= render partial: 'users/shared/links', locals: {linkedin_skip: true} %>
2016-02-12 23:52:43 +08:00
</div>
</div>
2016-02-12 23:52:43 +08:00
</div>
<%= render partial: 'users/sessions/login_disclaimer'%>
2021-07-23 17:56:28 +08:00
<% if resource && resource.errors.present? %>
2016-02-12 23:52:43 +08:00
<script>
(function () {
var formErrors = {};
<% resource.errors.as_json.each do |err, messages| %>
formErrors["<%= err %>"]=[]
<% messages.each do |message| %>
formErrors["<%= err %>"].push('<%= message %>');
<% end %>
2016-02-12 23:52:43 +08:00
<% end %>
$("form").renderFormErrors("user", formErrors, false);
2016-02-12 23:52:43 +08:00
}());
</script>
<% end %>
2021-07-23 17:56:28 +08:00
<% if @team && @team.errors.present? %>
2016-02-12 23:52:43 +08:00
<script>
(function () {
var formErrors = {};
<% @team.errors.as_json.each do |err, messages| %>
formErrors["<%= err %>"]=[]
<% messages.each do |message| %>
formErrors["<%= err %>"].push('<%= message %>');
<% end %>
2016-02-12 23:52:43 +08:00
<% end %>
2017-01-25 19:01:23 +08:00
$("form").renderFormErrors('team', formErrors, false);
2016-02-12 23:52:43 +08:00
}());
</script>
<% end %>