Skip to content
davydotcom edited this page Nov 27, 2012 · 9 revisions

Creating a Rails App

There exists a lot of documentation on creating a rails application so we will skip the details and go straight to the areas that pertain to spud_cms:

First create your rails project if you do not have one:

rails new my_spud_app

Now add spud_cms to your Gemfile as well as any other spud engines you may want to use:

gem 'spud_cms'

Run bundler: bundle install and install the migrations from the new gems you have installed:

bundle exec rake railties:install:migrations
rake db:migrate

Change ApplicationController to inherit from Spud::ApplicationController instead of ActionController::Base

class ApplicationController < Spud::ApplicationController

Note: While this step is not necessarily mandatory, it is required to use private cms pages as well as automatically handle user timezones

Running for the First Time

Spud CMS comes preconfigured with the most common use of default settings. This means it is quick and easy to get your site up and running. Simply start your rails webserver (rails s) and point your browser to [http://localhost:3000/spud/admin].

You will be directed to a first time setup screen where you will create your super administrative account. Once this is complete you are free to create your pages and menus.

Creating your first page

By default, Spud CMS expects a page named "Home" which will be the default homepage of your site. It will also default to only containing 1 content block titled "body". To configure your content blocks (i.e. sidebars or multi-column templates), please check out the wiki page on Templates.

Pages have a bit of customizability that can prove useful. You can select both templates and parent pages if you wish to structure your pages and use that structure to build navigation. Also, pages contain advanced options for SEO crawling (such as meta keywords, and descriptions). It is even possible to restrict pages to members only.

Pages are pretty powerful, and fast. They support use of liquid templates, which allow for injectable segments of the page. An example of this might be an inquiry form using spud inquiries, or a banner set from spud_banners (Coming Soon).

Defining Templates / Layouts

Spud CMS allows you to define different templates / layouts for your website. You may use a different template for the homepage, or use a 2 column layout for a certain content page. Simply add the file to your views/layouts folder (erb or haml are currently supported). Once these files are added, you may add more information about the content areas of a template, as well as its name, in a ruby comment at the top of the template file.

<%
#template_name: 2 Columns
#html: Left
#html: Right
%>

...

Pretty cool right? For more information on defining your own templates, check out the wiki page Creating Templates.

Using Menus

Several CMS, tools utilize your page structure to define your navigation. Spud, has taken a different philosophy. Menus do not always correlate to your page structure, and more advanced capabilities are sometimes needed. This is why we have menu management. To use these menus, simply take advantage of the sp_list_menu helper method in your layout views. For information on how to use this helper to render your menus check out: Menu Rendering Helper

Integrating other Spud Modules

Spud is a very modular site management engine. There are several other modules you may want to use when building a typical CMS based site, that we have decided to separate to reduce bloat.

  • Spud Blog (Blog / News Management)
  • Spud Media (Media Library management, Recommended for allowing user to upload content via spud admin to their CMS, or blog)
  • Spud Inquiries ( Contact Forms / Inquiry Management)
  • Spud Banners (Coming Soon Banner Management)