make some shared devise logic into a helper

This commit is contained in:
Maxwell Salzberg 2011-10-02 09:15:02 -07:00
parent 9562fb41a8
commit 7c9eb065ba
3 changed files with 6 additions and 2 deletions

View file

@ -7,4 +7,8 @@ module SessionsHelper
nil
end
end
def should_display_registration_link?
!AppConfig[:registrations_closed] && devise_mapping.registerable? && controller_name != 'registrations'
end
end

View file

@ -45,7 +45,7 @@
= f.submit t('devise.sessions.new.sign_in'), :tabindex => 4
- if !AppConfig[:registrations_closed] && devise_mapping.registerable? && controller_name != 'registrations'
- if should_display_registration_link?
%br
%br
%br

View file

@ -24,5 +24,5 @@
= link_to "Forgot password?", new_password_path(resource_name)
%footer
- if !AppConfig[:registrations_closed] && devise_mapping.registerable? && controller_name != 'registrations'
- if should_display_registration_link?
= link_to t('.sign_up'), new_registration_path(resource_name)