(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
placeholders…
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:

…html…

…html…

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
block.

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
hints.
Thanks

Gijs N.

Gijs,

Check out the MasterView plugin for rails, this sounds like it would
meet
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
html
into a dynamic web app. This sounds just like what you are looking for.
The
syntax for the attributes is based on the rails helpers themselves and
the
project is open in that you can create your own as well. In addition
unlike
the other templating engines, MasterView allows you to take full
advantage
of layouts, partials, helpers, and anything you could do in ERb, so you
can
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
html
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
documentation,
screenshots, and video available on http://masterview.org/

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

Have a blessed day!

Jeff B.
MasterView, project founder
http://masterview.org/

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.

…Gijs

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