From cee08512d903e02fc8c9f4991d668eea320a99e6 Mon Sep 17 00:00:00 2001 From: Spencer Steffen Date: Mon, 7 May 2012 16:35:01 -0700 Subject: [PATCH] remove redirect to /products when no homepage is present --- .../spree/home_controller_decorator.rb | 2 -- app/views/spree/pages/home.html.erb | 26 ++++++++++--------- .../spree/home_integration_test.rb | 4 +-- 3 files changed, 16 insertions(+), 16 deletions(-) diff --git a/app/controllers/spree/home_controller_decorator.rb b/app/controllers/spree/home_controller_decorator.rb index 0c0d68c..5bdba8e 100644 --- a/app/controllers/spree/home_controller_decorator.rb +++ b/app/controllers/spree/home_controller_decorator.rb @@ -12,8 +12,6 @@ def index def get_homepage @page = Spree::Page.find_by_path("/") - redirect_to products_url if @page.nil? - @page end def accurate_title diff --git a/app/views/spree/pages/home.html.erb b/app/views/spree/pages/home.html.erb index 0de25ea..2b25f93 100644 --- a/app/views/spree/pages/home.html.erb +++ b/app/views/spree/pages/home.html.erb @@ -1,17 +1,19 @@ -<% unless @page.images.empty? %> - <%= render 'spree/shared/slideshow', :images => @page.images, :size => :slide %> -<% end %> - -<% if @page.has_context?('intro') %> -
- <%= render 'spree/shared/content', :content => @page.for_context('intro').first %> +<% unless @page.nil? %> + <% unless @page.images.empty? %> + <%= render 'spree/shared/slideshow', :images => @page.images, :size => :slide %> + <% end %> + + <% if @page.has_context?('intro') %> +
+ <%= render 'spree/shared/content', :content => @page.for_context('intro').first %> +
+ <% end %> + +
+ <%= render :partial => 'spree/shared/content', :collection => @page.for_context('main') %>
<% end %> -
- <%= render :partial => 'spree/shared/content', :collection => @page.for_context('main') %> -
-
<% if defined?(Spree::SpreeEssentialBlog) && !@posts.blank? %>
@@ -34,5 +36,5 @@ <% end %>
- <%= render :partial => 'spree/shared/products', :locals => { :products => @products } %> + <%= render :partial => 'spree/shared/products', :locals => { :products => @products } if @products %>
diff --git a/test/integration/spree/home_integration_test.rb b/test/integration/spree/home_integration_test.rb index 36607c1..123b807 100644 --- a/test/integration/spree/home_integration_test.rb +++ b/test/integration/spree/home_integration_test.rb @@ -7,9 +7,9 @@ class Spree::HomeIntegrationTest < SpreeEssentials::IntegrationCase @images = Dir[File.expand_path("../../../../lib/tasks/sample", __FILE__) + "/*.jpg"] end - should "redirect to products when no homepage is present" do + should "not redirect to products when no homepage is present" do visit "/" - assert_equal spree.products_path, current_path + assert_equal "/", current_path end context "an existing homepage" do