scinote-web/app/views/users/invitations/edit.html.erb

88 lines
2.4 KiB
Text
Raw Normal View History

2016-02-12 23:52:43 +08:00
<% 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 } do |f| %>
2016-02-12 23:52:43 +08:00
<%= f.hidden_field :invitation_token %>
<div class="form-group">
<%= f.label :full_name %>
<%= f.text_field :full_name,
value: (params[:user] ? params[:user][:full_name] : ''),
autofocus: true,
class: 'form-control' %>
</div>
2016-02-12 23:52:43 +08:00
<div class="form-group">
<%= f.label :password %>
<% if @minimum_password_length %>
<em>(<%= @minimum_password_length %> characters minimum)</em>
<% end %>
<%= f.password_field :password, autocomplete: "off", class: "form-control" %>
2016-02-12 23:52:43 +08:00
</div>
<div class="form-group">
<%= f.label :password_confirmation %>
<%= f.password_field :password_confirmation, autocomplete: "off", class: "form-control" %>
</div>
<% if Rails.configuration.x.new_team_on_signup %>
<div class="form-group"
data-hook="confirm-invitation-team-name">
2017-01-25 19:01:23 +08:00
<%= label :team, :name, t('users.registrations.new.team_name_label') %>
<% if @team %>
<%= text_field :team, :name, class: 'form-control', value: @team.name %>
2016-02-12 23:52:43 +08:00
<% else %>
2017-01-25 19:01:23 +08:00
<%= text_field :team,
:name,
class: 'form-control',
2017-01-25 19:01:23 +08:00
value: (params[:team] ? params[:team][:name] : '') %>
2016-02-12 23:52:43 +08:00
<% end %>
</div>
<% end %>
<%= recaptcha_input_tag %>
2016-11-25 18:52:33 +08:00
<div class="form-group" data-hook="confirm-invitation-form-submit">
2016-02-12 23:52:43 +08:00
<%= f.submit "Sign Up", class: "btn btn-primary" %>
</div>
<% end %>
</div>
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 = {};
2020-08-13 17:34:21 +08:00
<% 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 = {};
2020-08-13 17:34:21 +08:00
<% @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 %>