diff --git a/generators/devise_views/devise_views_generator.rb b/generators/devise_views/devise_views_generator.rb
index 687ab25d..4c294095 100644
--- a/generators/devise_views/devise_views_generator.rb
+++ b/generators/devise_views/devise_views_generator.rb
@@ -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
diff --git a/generators/devise_views/templates/confirmations/new.html.erb b/generators/devise_views/templates/confirmations/new.html.erb
deleted file mode 100644
index 0a0d0f21..00000000
--- a/generators/devise_views/templates/confirmations/new.html.erb
+++ /dev/null
@@ -1,16 +0,0 @@
-
Resend confirmation instructions
-
-<% form_for resource, :url => confirmation_path(resource_name) do |f| %>
- <%= f.error_messages %>
-
- <%= f.label :email %>
- <%= f.text_field :email %>
-
- <%= f.submit "Resend confirmation instructions" %>
-<% end %>
-
-<%= link_to "Sign in", new_session_path(resource_name) %>
-
-<%- if devise_mapping.recoverable? %>
- <%= link_to "Forgot password?", new_password_path(resource_name) %>
-<% end -%>
diff --git a/generators/devise_views/templates/notifier/confirmation_instructions.html.erb b/generators/devise_views/templates/notifier/confirmation_instructions.html.erb
deleted file mode 100644
index 84665383..00000000
--- a/generators/devise_views/templates/notifier/confirmation_instructions.html.erb
+++ /dev/null
@@ -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) %>
diff --git a/generators/devise_views/templates/notifier/reset_password_instructions.html.erb b/generators/devise_views/templates/notifier/reset_password_instructions.html.erb
deleted file mode 100644
index 5587598d..00000000
--- a/generators/devise_views/templates/notifier/reset_password_instructions.html.erb
+++ /dev/null
@@ -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.
diff --git a/generators/devise_views/templates/passwords/edit.html.erb b/generators/devise_views/templates/passwords/edit.html.erb
deleted file mode 100644
index bf7fddff..00000000
--- a/generators/devise_views/templates/passwords/edit.html.erb
+++ /dev/null
@@ -1,20 +0,0 @@
-Change your password
-
-<% form_for resource, :url => password_path(resource_name), :html => { :method => :put } do |f| %>
- <%= f.error_messages %>
- <%= f.hidden_field :reset_password_token %>
-
- <%= f.label :password %>
- <%= f.password_field :password %>
-
- <%= f.label :password_confirmation %>
- <%= f.password_field :password_confirmation %>
-
- <%= f.submit "Change my password" %>
-<% end %>
-
-<%= link_to "Sign in", new_session_path(resource_name) %>
-
-<%- if devise_mapping.confirmable? %>
- <%= link_to "Didn't receive confirmation instructions?", new_confirmation_path(resource_name) %>
-<% end -%>
diff --git a/generators/devise_views/templates/passwords/new.html.erb b/generators/devise_views/templates/passwords/new.html.erb
deleted file mode 100644
index 37ac6fd8..00000000
--- a/generators/devise_views/templates/passwords/new.html.erb
+++ /dev/null
@@ -1,16 +0,0 @@
-Forgot your password?
-
-<% form_for resource, :url => password_path(resource_name) do |f| %>
- <%= f.error_messages %>
-
- <%= f.label :email %>
- <%= f.text_field :email %>
-
- <%= f.submit "Send me reset password instructions" %>
-<% end %>
-
-<%= link_to "Sign in", new_session_path(resource_name) %>
-
-<%- if devise_mapping.confirmable? %>
- <%= link_to "Didn't receive confirmation instructions?", new_confirmation_path(resource_name) %>
-<% end -%>
diff --git a/generators/devise_views/templates/sessions/new.html.erb b/generators/devise_views/templates/sessions/new.html.erb
deleted file mode 100644
index 81cf6803..00000000
--- a/generators/devise_views/templates/sessions/new.html.erb
+++ /dev/null
@@ -1,23 +0,0 @@
-Sign in
-
-<% form_for resource, :url => session_path(resource_name) do |f| -%>
- <%= f.label :email %>
- <%= f.text_field :email %>
-
- <%= f.label :password %>
- <%= f.password_field :password %>
-
- <% if devise_mapping.rememberable? -%>
- <%= f.check_box :remember_me %> <%= f.label :remember_me %>
- <% end -%>
-
- <%= f.submit "Sign in" %>
-<% end -%>
-
-<%- if devise_mapping.recoverable? %>
- <%= link_to "Forgot password?", new_password_path(resource_name) %>
-<% end -%>
-
-<%- if devise_mapping.confirmable? %>
- <%= link_to "Didn't receive confirmation instructions?", new_confirmation_path(resource_name) %>
-<% end -%>