(Re-)designing a CMS

Hello Rails-list,

I’m working on a CMS in Rails.
The company that I work for currently uses a CMS written in PHP, and I
want to mimick it in Rails, and improve along the way.

The PHP variant works with templates like this:

In the root of the webdir, there are the template files, named
cms_news.html for example.
This page contains custom tags, in the form of definitions and
The definition tags go like:

They are placed on top of the file, before the tag.
PHP uses str_replace() to filter out these tags.
This definition pulls its data from SQL table ‘t_articles’

The placeholder tags define where the previously defined ‘block’
should be displayed in the page:



This prints a list of articles according to the definition.
The -tag (in cmsdef) adds a little editbutton, which can
bring up a popup within which one can modify the contents of the

With this functionality, it’s possible to build quite a website, and
manage it in a WYSIWYG-way.

But how to approach this in Rails?
The goals are simple, really… I want to be able to have designers
create regular HTML files, with a couple of special tags where they
want to display dynamic content.
Within the CMS interface, the site must be viewable in ‘preview’ and
‘edit’ mode.
In preview-mode, the website is rendered like the world would see it.
In edit-mode, some edit buttons appear above the dynamic spots.

Should I try to mimick it as close as possible, using Ruby’s File
library and lots of gsub’s?
Or maybe there’s a better way, using RHTML or Liquid, to achieve the
same goal?

It’s a bit of an open question, and I’m just looking for thoughts or

Gijs N.


Check out the MasterView plugin for rails, this sounds like it would
your needs nicely.

MasterView is a WYSIWYG friendly syntax inspired by PHP/Zope TAL which
allows you to take html and add attribute directives that turn plain
into a dynamic web app. This sounds just like what you are looking for.
syntax for the attributes is based on the rails helpers themselves and
project is open in that you can create your own as well. In addition
the other templating engines, MasterView allows you to take full
of layouts, partials, helpers, and anything you could do in ERb, so you
keep things DRY yet still be able to view/edit in a WYSIWYG browser. The
attribute directives are smart in that they inherit properties from the
itself as well, so when you adjust style or sizes of fields, that
information gets passed through to the rails helper.

The project is open source, available on rubyforge. There is
screenshots, and video available on http://masterview.org/

If you have a chance to check the project out, be sure to let us know
you think and if there are any ways in which we can improve the project.
team is always looking for feedback.

Have a blessed day!

Jeff B.
MasterView, project founder

Thanks Jeff, that looks very interesting. (and complete!)
I’m going to give it a try, and if we decide to continue with it, I’ll
let you know.


This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs