Basic mini cms

Mini CMS

I tend to follow a very similar pattern when setting up small websites
for people. Basically it’s like this for an example site with three
pages. Two controllers, Welcome and Pages.


The Welcome controller is simple contains the following really.

It contains a “find_by” method to find the page content by the name of
the action. I use a before filter to do this before each action.

def home
end

def contact
end

def links
end


Views

all contain the same thing.

If there’s page content – display it.

Pages controller just a normal scaffolded controller to CRUD pages. The
title of the page is used as the key to link content to the pages so it
needs to match the action names. I set up all my pages in the initial
migration with some dummy content. I use the new basic
http_authentication built into rails 2 to secure this controller.

Then I have a layout for the welcome which generates a menu at the top
with links to each action, I need to update this by hand as pages change
name or are added or deleted.

Basically my approach works fine, just wondering if others use the same
type of approach and looking for tips to refine this!

A page in my database is again simple title:string, body:text

Tips appreciated.

Cheers

bsp

Anyone on this. Sorry if I’m a little unclear.

Just interested in how others might create a very basic website for
people with a backend CMS.

The layout file is where I set out my navigation menus, and I need to
edit this if the “client” changes the site structure.

Sometimes I use “tinymce” to allow the client to format text without
having to learn basic html.

workflow is roughly.

  1. create welcome controller with actions and views for each page
  2. create pages scaffolded controller
  3. add a page record for each page and some dummy content
  4. edit layout for navigation menu
  5. edit welcome views to include the page records “content”

Am I missing a trick or two?

Any tips?

Michael S. wrote:

In the Learning Rails screencast series, we’re building up a mini-CMS
as an example. You can download our code and see the screencasts that
walk through it. We don’t use separate actions for each page, but
treat the Page as a restful resource and use the name of the page to
find the appropriate page contents. We made a separate “viewer”
controller to render the page so we could keep the page_controller as
the standard scaffolded REST controller.

http://www.BuildingWebApps.com/learningrails

There’s three screencasts posted now, which create the basic Page
model and then add user authentication. The fourth screencast, which
will be published Monday, allows pages to be set as admin access only
and also automatically creates the navigation. We’ll be further
enhancing it in the next couple screencasts.

Michael S.
www.BuildingWebApps.com

On Apr 24, 1:34 am, bingo bob [email protected]

Michael,

Your site is a wonderful resource, I listened to the audio stuff this
morning and it really helped cement my knowledge.

I’ve subscribed and I’ll be tuning in.

I liked the IDE/simple editor debate. For the record I’m a textmate man,
:-).

cheers

bb

In the Learning Rails screencast series, we’re building up a mini-CMS
as an example. You can download our code and see the screencasts that
walk through it. We don’t use separate actions for each page, but
treat the Page as a restful resource and use the name of the page to
find the appropriate page contents. We made a separate “viewer”
controller to render the page so we could keep the page_controller as
the standard scaffolded REST controller.

http://www.BuildingWebApps.com/learningrails

There’s three screencasts posted now, which create the basic Page
model and then add user authentication. The fourth screencast, which
will be published Monday, allows pages to be set as admin access only
and also automatically creates the navigation. We’ll be further
enhancing it in the next couple screencasts.

Michael S.
www.BuildingWebApps.com

On Apr 24, 1:34 am, bingo bob [email protected]