mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-02-27 01:43:22 +00:00
CMS content on home page
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
Spree::OrdersController.class_eval do
|
||||
before_filter :populate_order_distributor, :only => :populate
|
||||
after_filter :populate_variant_attributes, :only => :populate
|
||||
before_filter :populate_order_distributor, :only => :populate
|
||||
after_filter :populate_variant_attributes, :only => :populate
|
||||
|
||||
def populate_order_distributor
|
||||
@distributor = params[:distributor_id].present? ? Spree::Distributor.find(params[:distributor_id]) : nil
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
= cms_page_content(:content, Cms::Page.find_by_full_path('/'))
|
||||
|
||||
- if @products
|
||||
#products= render 'spree/shared/products', :products => @products, :taxon => @taxon
|
||||
- else
|
||||
|
||||
@@ -76,3 +76,39 @@ FactoryGirl.modify do
|
||||
country { Spree::Country.find_by_name 'Australia' || Spree::Country.first }
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
# -- CMS
|
||||
FactoryGirl.define do
|
||||
factory :cms_site, :class => Cms::Site do
|
||||
identifier 'site'
|
||||
label 'site'
|
||||
hostname 'localhost'
|
||||
end
|
||||
|
||||
factory :cms_layout, :class => Cms::Layout do
|
||||
site { Cms::Site.first || create(:cms_site) }
|
||||
label 'layout'
|
||||
identifier 'layout'
|
||||
content '{{ cms:page:content:text }}'
|
||||
end
|
||||
|
||||
factory :cms_page, :class => Cms::Page do
|
||||
site { Cms::Site.first || create(:cms_site) }
|
||||
label 'page'
|
||||
slug 'page'
|
||||
layout { Cms::Layout.first || create(:cms_layout) }
|
||||
|
||||
# Pass content through to block, where it is stored
|
||||
after(:create) do |cms_page, evaluator|
|
||||
cms_page.blocks.first.update_attribute(:content, evaluator.content)
|
||||
cms_page.save! # set_cached_content
|
||||
end
|
||||
end
|
||||
|
||||
factory :cms_block, :class => Cms::Block do
|
||||
page { Cms::Page.first || create(:cms_page) }
|
||||
identifier 'block'
|
||||
content 'hello, block'
|
||||
end
|
||||
end
|
||||
|
||||
23
spec/requests/consumer/cms_spec.rb
Normal file
23
spec/requests/consumer/cms_spec.rb
Normal file
@@ -0,0 +1,23 @@
|
||||
require 'spec_helper'
|
||||
|
||||
feature %q{
|
||||
In order to learn about food
|
||||
As a user of the site
|
||||
I want to see static content pages
|
||||
} do
|
||||
include AuthenticationWorkflow
|
||||
include WebHelper
|
||||
|
||||
|
||||
scenario "viewing the home page" do
|
||||
# Given a CMS home page
|
||||
cms_page = create(:cms_page, content: 'Home page content')
|
||||
|
||||
# When I visit the home page
|
||||
visit spree.root_path
|
||||
|
||||
# Then I should see my content
|
||||
page.should have_content 'Home page content'
|
||||
end
|
||||
|
||||
end
|
||||
Reference in New Issue
Block a user