Permalink
Browse files

Move controller helpers into Spree::AuthenticationHelpers module

  • Loading branch information...
1 parent 40b1f9e commit 4812d2268799e9da597a7d58042d8b0ad2878e1f @radar radar committed May 28, 2012
View
4 core/lib/generators/spree/custom_user/custom_user_generator.rb
@@ -12,10 +12,10 @@ def self.source_paths
def generate
template 'migration.rb.tt', "db/migrate/#{Time.now.strftime("%Y%m%d%H%m%S")}_add_spree_fields_to_custom_user_table.rb"
- template 'controller_helpers_ext.rb.tt', "lib/spree/core/controller_helpers_ext.rb"
+ template 'authentication_helpers.rb.tt', "lib/spree/authentication_helpers.rb"
insert_into_file 'config/initializers/spree.rb', :before => "# Configure Spree Preferences" do
- %Q{require 'spree/core/controller_helpers_ext'\n}
+ %Q{require 'spree/authentication_helpers'\n}
end
end
View
28 core/lib/generators/spree/custom_user/templates/authentication_helpers.rb.tt
@@ -0,0 +1,28 @@
+module Spree
+ module AuthenticationHelpers
+ def self.included(receiver)
+ receiver.send :helper_method, :spree_login_path
+ receiver.send :helper_method, :spree_signup_path
+ receiver.send :helper_method, :spree_logout_path
+ end
+
+ def spree_current_user
+ current_person
+ end
+
+ def spree_login_path
+ main_app.login_path
+ end
+ helper_method :spree_login_path
+
+ def spree_signup_path
+ main_app.signup_path
+ end
+ helper_method :spree_signup_path
+
+ def spree_logout_path
+ main_app.logout_path
+ end
+ helper_method :spree_logout_path
+ end
+end

0 comments on commit 4812d22

Please sign in to comment.