Navigation Menu

Skip to content

Commit

Permalink
remove redirect to /products when no homepage is present
Browse files Browse the repository at this point in the history
  • Loading branch information
citrus authored and iloveitaly committed Aug 24, 2012
1 parent 0d63fab commit cee0851
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 16 deletions.
2 changes: 0 additions & 2 deletions app/controllers/spree/home_controller_decorator.rb
Expand Up @@ -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
Expand Down
26 changes: 14 additions & 12 deletions 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') %>
<div class="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') %>
<div class="intro">
<%= render 'spree/shared/content', :content => @page.for_context('intro').first %>
</div>
<% end %>

<div class="left">
<%= render :partial => 'spree/shared/content', :collection => @page.for_context('main') %>
</div>
<% end %>

<div class="left">
<%= render :partial => 'spree/shared/content', :collection => @page.for_context('main') %>
</div>

<div class="right">
<% if defined?(Spree::SpreeEssentialBlog) && !@posts.blank? %>
<div class="home-posts">
Expand All @@ -34,5 +36,5 @@
<% end %>

<div data-hook="homepage_products">
<%= render :partial => 'spree/shared/products', :locals => { :products => @products } %>
<%= render :partial => 'spree/shared/products', :locals => { :products => @products } if @products %>
</div>
4 changes: 2 additions & 2 deletions test/integration/spree/home_integration_test.rb
Expand Up @@ -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
Expand Down

0 comments on commit cee0851

Please sign in to comment.