Permalink
Browse files

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

  • Loading branch information...
josevalim committed Jan 2, 2012
1 parent 0b55ebb commit aa2d15aa338cd1e83462d58ff4eec1ce5fa122fb
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
@@ -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 -%>
@@ -9,4 +9,4 @@
<div><%= f.submit "Resend confirmation instructions" %></div>
<% end %>
<%= render :partial => "devise/shared/links" %>
<%= render "links" %>
@@ -13,4 +13,4 @@
<div><%= f.submit "Change my password" %></div>
<% end %>
<%= render :partial => "devise/shared/links" %>
<%= render "links" %>
@@ -9,4 +9,4 @@
<div><%= f.submit "Send me reset password instructions" %></div>
<% end %>
<%= render :partial => "devise/shared/links" %>
<%= render "links" %>
@@ -15,4 +15,4 @@
<div><%= f.submit "Sign up" %></div>
<% end %>
<%= render :partial => "devise/shared/links" %>
<%= render "links" %>
@@ -14,4 +14,4 @@
<div><%= f.submit "Sign in" %></div>
<% end %>
<%= render :partial => "devise/shared/links" %>
<%= render "links" %>
@@ -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" %>
@@ -9,4 +9,4 @@
<div><%= f.submit "Resend unlock instructions" %></div>
<% end %>
<%= render :partial => "devise/shared/links" %>
<%= render "links" %>
@@ -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"
@@ -12,4 +12,4 @@
</div>
<% end %>
<%= render :partial => "devise/shared/links" %>
<%= render "links" %>
@@ -16,4 +16,4 @@
</div>
<% end %>
<%= render :partial => "devise/shared/links" %>
<%= render "links" %>
@@ -12,4 +12,4 @@
</div>
<% end %>
<%= render :partial => "devise/shared/links" %>
<%= render "links" %>
@@ -14,4 +14,4 @@
</div>
<% end %>
<%= render :partial => "devise/shared/links" %>
<%= render "links" %>
@@ -12,4 +12,4 @@
</div>
<% end %>
<%= render :partial => "devise/shared/links" %>
<%= render "links" %>
@@ -12,4 +12,4 @@
</div>
<% end %>
<%= render :partial => "devise/shared/links" %>
<%= render "links" %>
@@ -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

0 comments on commit aa2d15a

Please sign in to comment.