Skip to content

Commit aa2d15a

Browse files
committed
Move devise/shared/_links.erb to devise/_links.erb
1 parent 0b55ebb commit aa2d15a

File tree

17 files changed

+52
-54
lines changed

17 files changed

+52
-54
lines changed

CHANGELOG.rdoc

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,11 @@ Notes: https://@plataformatec/devise/wiki/How-To:-Upgrade-to-Devise-2.0
99
* Do not run validations unless on reconfirmable branch
1010

1111
* enhancements
12-
* allow parent controller to be customizable
13-
* inherit from the same Devise parent controller (by @sj26)
12+
* Allow parent controller to be customizable
13+
* Inherit from the same Devise parent controller (by @sj26)
14+
15+
* deprecation
16+
* Move devise/shared/_links.erb to devise/_links.erb
1417

1518
== 2.0.0.rc
1619

app/views/devise/_links.erb

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
<%- if controller_name != 'sessions' %>
2+
<%= link_to "Sign in", new_session_path(resource_name) %><br />
3+
<% end -%>
4+
5+
<%- if devise_mapping.registerable? && controller_name != 'registrations' %>
6+
<%= link_to "Sign up", new_registration_path(resource_name) %><br />
7+
<% end -%>
8+
9+
<%- if devise_mapping.recoverable? && controller_name != 'passwords' %>
10+
<%= link_to "Forgot your password?", new_password_path(resource_name) %><br />
11+
<% end -%>
12+
13+
<%- if devise_mapping.confirmable? && controller_name != 'confirmations' %>
14+
<%= link_to "Didn't receive confirmation instructions?", new_confirmation_path(resource_name) %><br />
15+
<% end -%>
16+
17+
<%- if devise_mapping.lockable? && resource_class.unlock_strategy_enabled?(:email) && controller_name != 'unlocks' %>
18+
<%= link_to "Didn't receive unlock instructions?", new_unlock_path(resource_name) %><br />
19+
<% end -%>
20+
21+
<%- if devise_mapping.omniauthable? %>
22+
<%- resource_class.omniauth_providers.each do |provider| %>
23+
<%= link_to "Sign in with #{provider.to_s.titleize}", omniauth_authorize_path(resource_name, provider) %><br />
24+
<% end -%>
25+
<% end -%>

app/views/devise/confirmations/new.html.erb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,4 +9,4 @@
99
<div><%= f.submit "Resend confirmation instructions" %></div>
1010
<% end %>
1111

12-
<%= render :partial => "devise/shared/links" %>
12+
<%= render "links" %>

app/views/devise/passwords/edit.html.erb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,4 +13,4 @@
1313
<div><%= f.submit "Change my password" %></div>
1414
<% end %>
1515

16-
<%= render :partial => "devise/shared/links" %>
16+
<%= render "links" %>

app/views/devise/passwords/new.html.erb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,4 +9,4 @@
99
<div><%= f.submit "Send me reset password instructions" %></div>
1010
<% end %>
1111

12-
<%= render :partial => "devise/shared/links" %>
12+
<%= render "links" %>

app/views/devise/registrations/new.html.erb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,4 +15,4 @@
1515
<div><%= f.submit "Sign up" %></div>
1616
<% end %>
1717

18-
<%= render :partial => "devise/shared/links" %>
18+
<%= render "links" %>

app/views/devise/sessions/new.html.erb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,4 +14,4 @@
1414
<div><%= f.submit "Sign in" %></div>
1515
<% end %>
1616

17-
<%= render :partial => "devise/shared/links" %>
17+
<%= render "links" %>

app/views/devise/shared/_links.erb

Lines changed: 3 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,3 @@
1-
<%- if controller_name != 'sessions' %>
2-
<%= link_to "Sign in", new_session_path(resource_name) %><br />
3-
<% end -%>
4-
5-
<%- if devise_mapping.registerable? && controller_name != 'registrations' %>
6-
<%= link_to "Sign up", new_registration_path(resource_name) %><br />
7-
<% end -%>
8-
9-
<%- if devise_mapping.recoverable? && controller_name != 'passwords' %>
10-
<%= link_to "Forgot your password?", new_password_path(resource_name) %><br />
11-
<% end -%>
12-
13-
<%- if devise_mapping.confirmable? && controller_name != 'confirmations' %>
14-
<%= link_to "Didn't receive confirmation instructions?", new_confirmation_path(resource_name) %><br />
15-
<% end -%>
16-
17-
<%- if devise_mapping.lockable? && resource_class.unlock_strategy_enabled?(:email) && controller_name != 'unlocks' %>
18-
<%= link_to "Didn't receive unlock instructions?", new_unlock_path(resource_name) %><br />
19-
<% end -%>
20-
21-
<%- if devise_mapping.omniauthable? %>
22-
<%- resource_class.omniauth_providers.each do |provider| %>
23-
<%= link_to "Sign in with #{provider.to_s.titleize}", omniauth_authorize_path(resource_name, provider) %><br />
24-
<% end -%>
25-
<% end -%>
1+
<% ActiveSupport::Deprecation.warn "Rendering partials devise/shared/_links.erb is deprecated" \
2+
"please use devise/_links.erb instead." %>
3+
<%= render "links" %>

app/views/devise/unlocks/new.html.erb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,4 +9,4 @@
99
<div><%= f.submit "Resend unlock instructions" %></div>
1010
<% end %>
1111

12-
<%= render :partial => "devise/shared/links" %>
12+
<%= render "links" %>

lib/generators/devise/views_generator.rb

Lines changed: 6 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -32,17 +32,6 @@ def target_path
3232
end
3333
end
3434

35-
class SharedViewsGenerator < Rails::Generators::Base #:nodoc:
36-
include ViewPathTemplates
37-
source_root File.expand_path("../../../../app/views/devise", __FILE__)
38-
desc "Copies shared Devise views to your application."
39-
40-
# Override copy_views to just copy mailer and shared.
41-
def copy_views
42-
view_directory :shared
43-
end
44-
end
45-
4635
class FormForGenerator < Rails::Generators::Base #:nodoc:
4736
include ViewPathTemplates
4837
source_root File.expand_path("../../../../app/views/devise", __FILE__)
@@ -80,12 +69,15 @@ def target_path
8069
end
8170

8271
class ViewsGenerator < Rails::Generators::Base
72+
include ViewPathTemplates
73+
74+
source_root File.expand_path("../../../../app/views/devise", __FILE__)
8375
desc "Copies Devise views to your application."
8476

85-
argument :scope, :required => false, :default => nil,
86-
:desc => "The scope to copy views to"
77+
def copy_views
78+
copy_file "_links.erb", "#{target_path}/_links.erb"
79+
end
8780

88-
invoke SharedViewsGenerator
8981
hook_for :form_builder, :aliases => "-b",
9082
:desc => "Form builder to be used",
9183
:default => defined?(SimpleForm) ? "simple_form_for" : "form_for"

0 commit comments

Comments
 (0)