Skip to content
This repository has been archived by the owner on Oct 24, 2023. It is now read-only.

citrus/spree_essential_cms

Repository files navigation

Spree Essential CMS Build Status

A robust CMS for Spree Commerce.


Installation

If you don't already have an existing Spree site, click here then come back later... You can also read the Spree docs here...

Otherwise, follow these steps to get up and running with SpreeEssentialCms:

Add spree_essential_cms to your Gemfile:

# Spree 1.1.x
gem 'spree_essential_cms', '~> 0.4.0'

# Spree 1.0.x
gem 'spree_essential_cms', '~> 0.3.0.rc1'

# Spree 0.70.x
gem 'spree_essential_cms', '~> 0.2.1'

# Spree 0.60.x and below
gem 'spree_essential_cms', '~> 0.1.2'

Now, bundle up with:

bundle install

Then run the generators to create the migration files:

bundle exec rails g spree_essentials:install
bundle exec rails g spree_essentials:cms

Now migrate your database:

bundle exec rake db:migrate

Boot your server and checkout the admin at localhost:3000/admin!

bundle exec rails s

To use the built in main menu create a deface override in your application that looks like this:

# app/overrides/main_menu.rb
Deface::Override.new(:virtual_path  => "spree/shared/_store_menu",
                     :name          => "spree_essential_cms_main_menu_items",
                     :insert_after  => "#home-link[data-hook]",
                     :partial       => "spree/shared/main_menu_items",
                     :disabled      => false)

This example override can be found in test/dummy_hooks/templates/main_menu.rb


Usage

Basic usage of this CMS is trivial. Create pages and add content...

Pages also have images so you can create galleries or slideshows.

Content Contexts

Contexts allow you to place different forms of content in various places of a page. A slideshow or a sidebar might be good examples...

You can set a content's context (say that ten times fast!) under the 'Optional Fields' tab in the edit content view.

In your view you'll be able to grab those bits of content like so:

.slideshow
  - if @slides = @page.for_context('slideshow')
    = render 'shared/content', :content => @slides

- if @sidebar = @page.for_context('sidebar').first
  - content_for :sidebar do
    = render 'shared/your_custom_sidebar', :content => @sidebar

Custom image sizes

Use a content decorator when you want different contexts to have their own image sizes:

# app/models/content_decorator.rb

Spree::Content.class_eval do

  # override default image sizes
  def default_attachment_sizes
    { :mini => '48x48>', :medium => '427x287>' }
  end

  # or set a custom size for each context
  def attachment_sizes
    case context
      when 'slideshow'
        sizes = default_attachment_sizes.merge(:slide => '955x476#')
      when 'main'
        sizes = default_attachment_sizes.merge(:custom => '580x289#')
      when 'small-top'
        sizes = default_attachment_sizes.merge(:custom => '364x177#')
      when 'small-bottom'
        sizes = default_attachment_sizes.merge(:custom => '364x109#')
      else
        sizes = default_attachment_sizes
    end
    sizes
  end

end

Custom Home Page

This extension modifies the Spree::HomeController.index method and redirects to /products if no root page is defined in the spree CMS. In order to define a custom home page you'll need to use another view off of the Spree::HomeController class such as splash, add the root route (root :to => 'spree/home#splash') to your config/routes.rb, and add a blank page with path "/" in the spree CMS.


Demo

You can easily use the test/dummy app as a demo of spree_essential_cms. Just cd to where you develop and run:

git clone git://github.com/citrus/spree_essential_cms.git
cd spree_essential_cms
cp test/dummy_hooks/after_migrate.rb.sample test/dummy_hooks/after_migrate.rb
bundle install
bundle exec dummier
cd test/dummy
bundle exec rails s

Testing

Testing for spree_essential_cms is done with unit tests and capybara integration tests. To get setup, run the commands below:

git clone git://github.com/citrus/spree_essential_cms.git
cd spree_essential_cms
bundle install
bundle exec dummier

Now you've got a test app setup in test/dummy. Now you can run the tests with:

bundle exec rake

If for any reason you want to re-create your test/dummy app, just re-run bundle exec dummier.


Change Log

0.4.0 - 2012/5/1

  • Add support for Spree 1.1.x

0.3.0.rc1 - 2012/1/16

  • Add support for Spree 1.0.x

0.2.1 - 2011/12/15

  • Fixes missing partial error on homepage when used with SpreeEssentialBlog

0.2.0 - 2011/12/15

  • Add 0.70.x compatibility
  • Removed spork dev dependency

0.1.1 - 2011/6/2

  • Added the image_size option shared/_content.html.erb
  • Improved documentation

0.1.0 - 2011/6/1

  • Random cleanup
  • Released 0.1.0 to rubygems

2011/4/26

  • Extracted from the Spree Essentials core.

To Do

  • optimizations
  • A 'create translation' button that clones the current page's contents into another language
  • add widgets that you can drop into any page
  • page and menu caching/sweeping
  • nested set for pages
  • create wiki pages

Contributors

If you'd like to help out feel free to fork and send me pull requests!


License

Copyright (c) 2011 - 2012 Spencer Steffen & Citrus, released under the New BSD License All rights reserved.

About

SpreeEssentialCms is a full featured CMS for Spree Commerce.

Resources

License

Stars

Watchers

Forks

Packages

No packages published