Generate Devise views
This commit is contained in:
parent
80fbd8c051
commit
79d95f1351
6 changed files with 147 additions and 0 deletions
24
app/views/users/passwords/edit.html.erb
Normal file
24
app/views/users/passwords/edit.html.erb
Normal file
|
@ -0,0 +1,24 @@
|
|||
<h2><%= t(".change_your_password") %></h2>
|
||||
|
||||
<%= simple_form_for(resource, as: resource_name, url: password_path(resource_name), html: { method: :put }) do |f| %>
|
||||
<%= f.error_notification %>
|
||||
|
||||
<%= f.input :reset_password_token, as: :hidden %>
|
||||
<%= f.full_error :reset_password_token %>
|
||||
|
||||
<div class="form-inputs">
|
||||
<%= f.input :password,
|
||||
label: t(".new_password"),
|
||||
required: true,
|
||||
autofocus: true,
|
||||
hint: (t('devise.shared.minimum_password_length', count: @minimum_password_length) if @minimum_password_length),
|
||||
input_html: { autocomplete: "new-password" } %>
|
||||
<%= f.input :password_confirmation, label: t(".confirm_new_password"), required: true %>
|
||||
</div>
|
||||
|
||||
<div class="form-actions">
|
||||
<%= f.button :submit, t(".change_my_password") %>
|
||||
</div>
|
||||
<% end %>
|
||||
|
||||
<%= render "users/shared/links" %>
|
18
app/views/users/passwords/new.html.erb
Normal file
18
app/views/users/passwords/new.html.erb
Normal file
|
@ -0,0 +1,18 @@
|
|||
<h2><%= t(".forgot_your_password") %></h2>
|
||||
|
||||
<%= simple_form_for(resource, as: resource_name, url: password_path(resource_name), html: { method: :post }) do |f| %>
|
||||
<%= f.error_notification %>
|
||||
|
||||
<div class="form-inputs">
|
||||
<%= f.input :email,
|
||||
required: true,
|
||||
autofocus: true,
|
||||
input_html: { autocomplete: "email" } %>
|
||||
</div>
|
||||
|
||||
<div class="form-actions">
|
||||
<%= f.button :submit, t(".send_me_reset_password_instructions") %>
|
||||
</div>
|
||||
<% end %>
|
||||
|
||||
<%= render "users/shared/links" %>
|
35
app/views/users/registrations/edit.html.erb
Normal file
35
app/views/users/registrations/edit.html.erb
Normal file
|
@ -0,0 +1,35 @@
|
|||
<h2><%= t(".title", resource: resource.model_name.human) %></h2>
|
||||
|
||||
<%= simple_form_for(resource, as: resource_name, url: registration_path(resource_name), html: { method: :put }) do |f| %>
|
||||
<%= f.error_notification %>
|
||||
|
||||
<div class="form-inputs">
|
||||
<%= f.input :email, required: true, autofocus: true %>
|
||||
|
||||
<% if devise_mapping.confirmable? && resource.pending_reconfirmation? %>
|
||||
<p><%= t(".currently_waiting_confirmation_for_email", email: resource.unconfirmed_email) %></p>
|
||||
<% end %>
|
||||
|
||||
<%= f.input :password,
|
||||
hint: t(".leave_blank_if_you_don_t_want_to_change_it"),
|
||||
required: false
|
||||
input_html: { autocomplete: "new-password" } %>
|
||||
<%= f.input :password_confirmation,
|
||||
required: false,
|
||||
input_html: { autocomplete: "new-password" } %>
|
||||
<%= f.input :current_password,
|
||||
hint: t(".we_need_your_current_password_to_confirm_your_changes"),
|
||||
required: true,
|
||||
input_html: { autocomplete: "current-password" } %>
|
||||
</div>
|
||||
|
||||
<div class="form-actions">
|
||||
<%= f.button :submit, t(".update") %>
|
||||
</div>
|
||||
<% end %>
|
||||
|
||||
<h3><%= t(".cancel_my_account") %></h3>
|
||||
|
||||
<p><%= t(".unhappy") %> <%= link_to t(".cancel_my_account"), registration_path(resource_name), data: { confirm: t(".are_you_sure") }, method: :delete %></p>
|
||||
|
||||
<%= link_to t("devise.shared.links.back"), :back %>
|
25
app/views/users/registrations/new.html.erb
Normal file
25
app/views/users/registrations/new.html.erb
Normal file
|
@ -0,0 +1,25 @@
|
|||
<h2><%= t(".sign_up") %></h2>
|
||||
|
||||
<%= simple_form_for(resource, as: resource_name, url: registration_path(resource_name)) do |f| %>
|
||||
<%= f.error_notification %>
|
||||
|
||||
<div class="form-inputs">
|
||||
<%= f.input :email,
|
||||
required: true,
|
||||
autofocus: true ,
|
||||
input_html: { autocomplete: "email" }%>
|
||||
<%= f.input :password,
|
||||
required: true,
|
||||
hint: (t('devise.shared.minimum_password_length', count: @minimum_password_length) if @minimum_password_length),
|
||||
input_html: { autocomplete: "new-password" } %>
|
||||
<%= f.input :password_confirmation,
|
||||
required: true,
|
||||
input_html: { autocomplete: "new-password" } %>
|
||||
</div>
|
||||
|
||||
<div class="form-actions">
|
||||
<%= f.button :submit, t(".sign_up") %>
|
||||
</div>
|
||||
<% end %>
|
||||
|
||||
<%= render "users/shared/links" %>
|
20
app/views/users/sessions/new.html.erb
Normal file
20
app/views/users/sessions/new.html.erb
Normal file
|
@ -0,0 +1,20 @@
|
|||
<h2><%= t(".sign_in") %></h2>
|
||||
|
||||
<%= simple_form_for(resource, as: resource_name, url: session_path(resource_name)) do |f| %>
|
||||
<div class="form-inputs">
|
||||
<%= f.input :email,
|
||||
required: false,
|
||||
autofocus: true,
|
||||
input_html: { autocomplete: "email" } %>
|
||||
<%= f.input :password,
|
||||
required: false,
|
||||
input_html: { autocomplete: "current-password" } %>
|
||||
<%= f.input :remember_me, as: :boolean if devise_mapping.rememberable? %>
|
||||
</div>
|
||||
|
||||
<div class="form-actions">
|
||||
<%= f.button :submit, t(".sign_in") %>
|
||||
</div>
|
||||
<% end %>
|
||||
|
||||
<%= render "users/shared/links" %>
|
25
app/views/users/shared/_links.html.erb
Normal file
25
app/views/users/shared/_links.html.erb
Normal file
|
@ -0,0 +1,25 @@
|
|||
<%- if controller_name != 'sessions' %>
|
||||
<%= link_to t(".sign_in"), new_session_path(resource_name) %><br />
|
||||
<% end -%>
|
||||
|
||||
<%- if devise_mapping.registerable? && controller_name != 'registrations' %>
|
||||
<%= link_to t(".sign_up"), new_registration_path(resource_name) %><br />
|
||||
<% end -%>
|
||||
|
||||
<%- if devise_mapping.recoverable? && controller_name != 'passwords' && controller_name != 'registrations' %>
|
||||
<%= link_to t(".forgot_your_password"), new_password_path(resource_name) %><br />
|
||||
<% end -%>
|
||||
|
||||
<%- if devise_mapping.confirmable? && controller_name != 'confirmations' %>
|
||||
<%= link_to t('.didn_t_receive_confirmation_instructions'), new_confirmation_path(resource_name) %><br />
|
||||
<% end -%>
|
||||
|
||||
<%- if devise_mapping.lockable? && resource_class.unlock_strategy_enabled?(:email) && controller_name != 'unlocks' %>
|
||||
<%= link_to t('.didn_t_receive_unlock_instructions'), new_unlock_path(resource_name) %><br />
|
||||
<% end -%>
|
||||
|
||||
<%- if devise_mapping.omniauthable? %>
|
||||
<%- resource_class.omniauth_providers.each do |provider| %>
|
||||
<%= link_to t('.sign_in_with_provider', provider: OmniAuth::Utils.camelize(provider)), omniauth_authorize_path(resource_name, provider) %><br />
|
||||
<% end -%>
|
||||
<% end -%>
|
Reference in a new issue