Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Move devise/shared/_links.erb to devise/_links.erb

  • Loading branch information...
commit aa2d15aa338cd1e83462d58ff4eec1ce5fa122fb 1 parent 0b55ebb
José Valim josevalim authored
7 CHANGELOG.rdoc
View
@@ -9,8 +9,11 @@ Notes: https://@plataformatec/devise/wiki/How-To:-Upgrade-to-Devise-2.0
* Do not run validations unless on reconfirmable branch
* enhancements
- * allow parent controller to be customizable
- * inherit from the same Devise parent controller (by @sj26)
+ * Allow parent controller to be customizable
+ * Inherit from the same Devise parent controller (by @sj26)
+
+* deprecation
+ * Move devise/shared/_links.erb to devise/_links.erb
== 2.0.0.rc
25 app/views/devise/_links.erb
View
@@ -0,0 +1,25 @@
+<%- if controller_name != 'sessions' %>
+ <%= link_to "Sign in", new_session_path(resource_name) %><br />
+<% end -%>
+
+<%- if devise_mapping.registerable? && controller_name != 'registrations' %>
+ <%= link_to "Sign up", new_registration_path(resource_name) %><br />
+<% end -%>
+
+<%- if devise_mapping.recoverable? && controller_name != 'passwords' %>
+ <%= link_to "Forgot your password?", new_password_path(resource_name) %><br />
+<% end -%>
+
+<%- if devise_mapping.confirmable? && controller_name != 'confirmations' %>
+ <%= link_to "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 "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 "Sign in with #{provider.to_s.titleize}", omniauth_authorize_path(resource_name, provider) %><br />
+ <% end -%>
+<% end -%>
2  app/views/devise/confirmations/new.html.erb
View
@@ -9,4 +9,4 @@
<div><%= f.submit "Resend confirmation instructions" %></div>
<% end %>
-<%= render :partial => "devise/shared/links" %>
+<%= render "links" %>
2  app/views/devise/passwords/edit.html.erb
View
@@ -13,4 +13,4 @@
<div><%= f.submit "Change my password" %></div>
<% end %>
-<%= render :partial => "devise/shared/links" %>
+<%= render "links" %>
2  app/views/devise/passwords/new.html.erb
View
@@ -9,4 +9,4 @@
<div><%= f.submit "Send me reset password instructions" %></div>
<% end %>
-<%= render :partial => "devise/shared/links" %>
+<%= render "links" %>
2  app/views/devise/registrations/new.html.erb
View
@@ -15,4 +15,4 @@
<div><%= f.submit "Sign up" %></div>
<% end %>
-<%= render :partial => "devise/shared/links" %>
+<%= render "links" %>
2  app/views/devise/sessions/new.html.erb
View
@@ -14,4 +14,4 @@
<div><%= f.submit "Sign in" %></div>
<% end %>
-<%= render :partial => "devise/shared/links" %>
+<%= render "links" %>
28 app/views/devise/shared/_links.erb
View
@@ -1,25 +1,3 @@
-<%- if controller_name != 'sessions' %>
- <%= link_to "Sign in", new_session_path(resource_name) %><br />
-<% end -%>
-
-<%- if devise_mapping.registerable? && controller_name != 'registrations' %>
- <%= link_to "Sign up", new_registration_path(resource_name) %><br />
-<% end -%>
-
-<%- if devise_mapping.recoverable? && controller_name != 'passwords' %>
- <%= link_to "Forgot your password?", new_password_path(resource_name) %><br />
-<% end -%>
-
-<%- if devise_mapping.confirmable? && controller_name != 'confirmations' %>
- <%= link_to "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 "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 "Sign in with #{provider.to_s.titleize}", omniauth_authorize_path(resource_name, provider) %><br />
- <% end -%>
-<% end -%>
+<% ActiveSupport::Deprecation.warn "Rendering partials devise/shared/_links.erb is deprecated" \
+ "please use devise/_links.erb instead." %>
+<%= render "links" %>
2  app/views/devise/unlocks/new.html.erb
View
@@ -9,4 +9,4 @@
<div><%= f.submit "Resend unlock instructions" %></div>
<% end %>
-<%= render :partial => "devise/shared/links" %>
+<%= render "links" %>
20 lib/generators/devise/views_generator.rb
View
@@ -32,17 +32,6 @@ def target_path
end
end
- class SharedViewsGenerator < Rails::Generators::Base #:nodoc:
- include ViewPathTemplates
- source_root File.expand_path("../../../../app/views/devise", __FILE__)
- desc "Copies shared Devise views to your application."
-
- # Override copy_views to just copy mailer and shared.
- def copy_views
- view_directory :shared
- end
- end
-
class FormForGenerator < Rails::Generators::Base #:nodoc:
include ViewPathTemplates
source_root File.expand_path("../../../../app/views/devise", __FILE__)
@@ -80,12 +69,15 @@ def target_path
end
class ViewsGenerator < Rails::Generators::Base
+ include ViewPathTemplates
+
+ source_root File.expand_path("../../../../app/views/devise", __FILE__)
desc "Copies Devise views to your application."
- argument :scope, :required => false, :default => nil,
- :desc => "The scope to copy views to"
+ def copy_views
+ copy_file "_links.erb", "#{target_path}/_links.erb"
+ end
- invoke SharedViewsGenerator
hook_for :form_builder, :aliases => "-b",
:desc => "Form builder to be used",
:default => defined?(SimpleForm) ? "simple_form_for" : "form_for"
2  lib/generators/templates/simple_form_for/confirmations/new.html.erb
View
@@ -12,4 +12,4 @@
</div>
<% end %>
-<%= render :partial => "devise/shared/links" %>
+<%= render "links" %>
2  lib/generators/templates/simple_form_for/passwords/edit.html.erb
View
@@ -16,4 +16,4 @@
</div>
<% end %>
-<%= render :partial => "devise/shared/links" %>
+<%= render "links" %>
2  lib/generators/templates/simple_form_for/passwords/new.html.erb
View
@@ -12,4 +12,4 @@
</div>
<% end %>
-<%= render :partial => "devise/shared/links" %>
+<%= render "links" %>
2  lib/generators/templates/simple_form_for/registrations/new.html.erb
View
@@ -14,4 +14,4 @@
</div>
<% end %>
-<%= render :partial => "devise/shared/links" %>
+<%= render "links" %>
2  lib/generators/templates/simple_form_for/sessions/new.html.erb
View
@@ -12,4 +12,4 @@
</div>
<% end %>
-<%= render :partial => "devise/shared/links" %>
+<%= render "links" %>
2  lib/generators/templates/simple_form_for/unlocks/new.html.erb
View
@@ -12,4 +12,4 @@
</div>
<% end %>
-<%= render :partial => "devise/shared/links" %>
+<%= render "links" %>
2  test/generators/views_generator_test.rb
View
@@ -46,7 +46,7 @@ def assert_files(scope = nil, options={})
assert_file "app/views/#{scope}/registrations/new.html.erb"
assert_file "app/views/#{scope}/registrations/edit.html.erb"
assert_file "app/views/#{scope}/sessions/new.html.erb"
- assert_file "app/views/#{scope}/shared/_links.erb"
assert_file "app/views/#{scope}/unlocks/new.html.erb"
+ assert_file "app/views/#{scope}/_links.erb"
end
end
Please sign in to comment.
Something went wrong with that request. Please try again.