mirror of
https://github.com/heartcombo/devise.git
synced 2022-11-09 12:18:31 -05:00
Recursively copy original templates in devise_views.
This commit is contained in:
parent
dd3e534a19
commit
86f37cd5e1
7 changed files with 9 additions and 99 deletions
|
@ -1,22 +1,20 @@
|
|||
class DeviseViewsGenerator < Rails::Generator::Base
|
||||
|
||||
def initialize(*args)
|
||||
super
|
||||
@source_root = options[:source] || File.join(spec.path, '..', '..', 'app', 'views')
|
||||
end
|
||||
|
||||
def manifest
|
||||
record do |m|
|
||||
views_directory = File.join('app', 'views')
|
||||
m.directory views_directory
|
||||
|
||||
{
|
||||
:sessions => [:new],
|
||||
:passwords => [:new, :edit],
|
||||
:confirmations => [:new],
|
||||
:notifier => [:confirmation_instructions, :reset_password_instructions]
|
||||
}.each do |dir, templates|
|
||||
m.directory File.join(views_directory, dir.to_s)
|
||||
Dir[File.join(@source_root, "**/*.erb")].each do |file|
|
||||
file = file.gsub(@source_root, "")[1..-1]
|
||||
|
||||
templates.each do |template|
|
||||
template_path = "#{dir}/#{template}.html.erb"
|
||||
m.file "#{template_path}", "#{views_directory}/#{template_path}"
|
||||
end
|
||||
m.directory File.join(views_directory, File.dirname(file))
|
||||
m.file file, File.join(views_directory, file)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -1,16 +0,0 @@
|
|||
<h2>Resend confirmation instructions</h2>
|
||||
|
||||
<% form_for resource, :url => confirmation_path(resource_name) do |f| %>
|
||||
<%= f.error_messages %>
|
||||
|
||||
<p><%= f.label :email %></p>
|
||||
<p><%= f.text_field :email %></p>
|
||||
|
||||
<p><%= f.submit "Resend confirmation instructions" %></p>
|
||||
<% end %>
|
||||
|
||||
<%= link_to "Sign in", new_session_path(resource_name) %><br />
|
||||
|
||||
<%- if devise_mapping.recoverable? %>
|
||||
<%= link_to "Forgot password?", new_password_path(resource_name) %><br />
|
||||
<% end -%>
|
|
@ -1,5 +0,0 @@
|
|||
Welcome <%= @resource.email %>!
|
||||
|
||||
You can confirm your account through the link below:
|
||||
|
||||
<%= link_to 'Confirm my account', confirmation_url(@resource, :confirmation_token => @resource.confirmation_token) %>
|
|
@ -1,8 +0,0 @@
|
|||
Hello <%= @resource.email %>!
|
||||
|
||||
Someone has requested a link to change your password, and you can do this through the link below.
|
||||
|
||||
<%= link_to 'Change my password', edit_password_url(@resource, :reset_password_token => @resource.reset_password_token) %>
|
||||
|
||||
If you didn't request this, please ignore this email.
|
||||
Your password won't change until you access the link above and create a new one.
|
|
@ -1,20 +0,0 @@
|
|||
<h2>Change your password</h2>
|
||||
|
||||
<% form_for resource, :url => password_path(resource_name), :html => { :method => :put } do |f| %>
|
||||
<%= f.error_messages %>
|
||||
<%= f.hidden_field :reset_password_token %>
|
||||
|
||||
<p><%= f.label :password %></p>
|
||||
<p><%= f.password_field :password %></p>
|
||||
|
||||
<p><%= f.label :password_confirmation %></p>
|
||||
<p><%= f.password_field :password_confirmation %></p>
|
||||
|
||||
<p><%= f.submit "Change my password" %></p>
|
||||
<% end %>
|
||||
|
||||
<%= link_to "Sign in", new_session_path(resource_name) %><br />
|
||||
|
||||
<%- if devise_mapping.confirmable? %>
|
||||
<%= link_to "Didn't receive confirmation instructions?", new_confirmation_path(resource_name) %><br />
|
||||
<% end -%>
|
|
@ -1,16 +0,0 @@
|
|||
<h2>Forgot your password?</h2>
|
||||
|
||||
<% form_for resource, :url => password_path(resource_name) do |f| %>
|
||||
<%= f.error_messages %>
|
||||
|
||||
<p><%= f.label :email %></p>
|
||||
<p><%= f.text_field :email %></p>
|
||||
|
||||
<p><%= f.submit "Send me reset password instructions" %></p>
|
||||
<% end %>
|
||||
|
||||
<%= link_to "Sign in", new_session_path(resource_name) %><br />
|
||||
|
||||
<%- if devise_mapping.confirmable? %>
|
||||
<%= link_to "Didn't receive confirmation instructions?", new_confirmation_path(resource_name) %><br />
|
||||
<% end -%>
|
|
@ -1,23 +0,0 @@
|
|||
<h2>Sign in</h2>
|
||||
|
||||
<% form_for resource, :url => session_path(resource_name) do |f| -%>
|
||||
<p><%= f.label :email %></p>
|
||||
<p><%= f.text_field :email %></p>
|
||||
|
||||
<p><%= f.label :password %></p>
|
||||
<p><%= f.password_field :password %></p>
|
||||
|
||||
<% if devise_mapping.rememberable? -%>
|
||||
<p><%= f.check_box :remember_me %> <%= f.label :remember_me %></p>
|
||||
<% end -%>
|
||||
|
||||
<p><%= f.submit "Sign in" %></p>
|
||||
<% end -%>
|
||||
|
||||
<%- if devise_mapping.recoverable? %>
|
||||
<%= link_to "Forgot password?", new_password_path(resource_name) %><br />
|
||||
<% end -%>
|
||||
|
||||
<%- if devise_mapping.confirmable? %>
|
||||
<%= link_to "Didn't receive confirmation instructions?", new_confirmation_path(resource_name) %><br />
|
||||
<% end -%>
|
Loading…
Reference in a new issue