Ruby Forum Radiant CMS > Layouts, snippets and site assets on the file system?

Posted by Alex Wayne (squeegy)
on 13.05.2008 18:18
First off, what I have done so far in Radiant has been pretty inspiring.
I usually hate CMS solutions due to their inflexibility.  The super
simple Radiant extension is a huge selling point for me.  I intend to
use a Radiant install as the base for projects since it gives me
publishing, admin authentication, and admin architecture for almost no
effort.  I'm pretty experienced with Rails, but new to Radiant.

Maintaining layouts and snippets in the admin interface via text area is
so much less fun than editing these things in Textmate.  My current
workflow is to use the "It's all text" Firefox plugin to edit text area
contents in Textmate.  It's not so bad, but I have switch to the browser
and press the save button, then switch to my tab with the radiant app
and refresh to see my changes.  Its far more tedious than the usual
cmd-s, cmd-tab, F5 I'm used to.  Page content would change far more
frequently and is a good fit for the database, in my opinion.  Plus the
regular, non-technical, maintainers of the site probably shouldn't have
access to changing layouts and snippets anyway.

So, I am looking for a way to store site structure files in the file
system, version controlled and in a higher level template language like
erb or haml.  Then store page content in the database in radius format
just like normal.

Is there an extension for that?  Or is that even a good idea?

Thanks for the great tool,
-Alex
Posted by Sean Cribbs (seancribbs)
on 13.05.2008 18:37
(Received via mailing list)
Alex,

I've been promising for a long time, so I better own up on it.  I wrote
an extension for Digital Pulp that lets you import/export several models
between the database and the file system so that they can be stored in a
SCM.  There are a number of other extensions that the DP devs and I have
been wanting to export for a while.  Although I have a few other things
to do this Friday, I'll put that on the to-dos as well.

Sean
Posted by Alex Wayne (squeegy)
on 13.05.2008 21:12
Sean Cribbs wrote:
> Alex,
> 
> I've been promising for a long time, so I better own up on it.  I wrote
> an extension for Digital Pulp that lets you import/export several models
> between the database and the file system so that they can be stored in a
> SCM.  There are a number of other extensions that the DP devs and I have
> been wanting to export for a while.  Although I have a few other things
> to do this Friday, I'll put that on the to-dos as well.
> 
> Sean

Rock on.  Thank you, I will keep an ear out!
Posted by Alex Wayne (squeegy)
on 28.05.2008 22:57
Sean Cribbs wrote:
> Alex,
> 
> I've been promising for a long time, so I better own up on it.  I wrote
> an extension for Digital Pulp that lets you import/export several models
> between the database and the file system so that they can be stored in a
> SCM.  There are a number of other extensions that the DP devs and I have
> been wanting to export for a while.  Although I have a few other things
> to do this Friday, I'll put that on the to-dos as well.
> 
> Sean

Firstly, I realize I am in no position to demand anything!

I have been watching the git repo and the blog, and haven't seen 
anything about this.  Any progress that i missed?

Thanks.
Posted by Jonathan McCoy (jonjon)
on 14.06.2008 00:23
In parallel, it would be nice to add another basic user-level of 
"Designer", for managing Snippets - in the absence of SCM/file support 
for layouts/partials.

In keeping designs and code DRY, we find ourselves using snippets to 
contain more than user-editable content, and use them heavily for 
fragments of design logic. As such, we want to keep day-to-day users far 
away from anything that can cause damage to the site.

Standard (Pages) -> Designer (+ Snippets) -> Administrator (+ Layouts, 
Users, etc)

Does the Developer flag do anything in production mode?

Thanks,
Jon.
Posted by Daniel Collis-puro (djcp)
on 14.06.2008 03:51
Sean Cribbs wrote:
> Alex,
> 
> I've been promising for a long time, so I better own up on it.  I wrote
> an extension for Digital Pulp that lets you import/export several models
> between the database and the file system so that they can be stored in a
> SCM.  There are a number of other extensions that the DP devs and I have
> been wanting to export for a while.  Although I have a few other things
> to do this Friday, I'll put that on the to-dos as well.
> 
> Sean

Was this done via FUSE?

http://redhanded.hobix.com/inspect/railsfsAfterACoupleMinutesOfToolingWithFuseWhoa.html

Seems like that's the "Right" way. I've used FUSE extensively to mount 
remote filesystems via SSH and it works wonderfully.

--DJCP
Posted by Jonathan McCoy (jonjon)
on 14.06.2008 17:59
Daniel Collis-puro wrote:

> Was this done via FUSE?
> 
> http://redhanded.hobix.com/inspect/railsfsAfterACoupleMinutesOfToolingWithFuseWhoa.html
> 
> Seems like that's the "Right" way. I've used FUSE extensively to mount 
> remote filesystems via SSH and it works wonderfully.
> 
> --DJCP

Highly unlikely. FUSE is a modular file system API - basically a simple 
means to build your own file system without actually having to do 
anything majorly complex. Although yes, what you linked to would be a 
cool solution - it still lacks version control. You'd also have to make 
it uber-bespoke to Radiant, and to each model in the Radiant schema, 
otherwise you'll be working with YAML etc. If somebody did build a FUSE 
interface for Radiant, it would be nice if each page is represented by a 
folder, with files corresponding to each page part, with the extension 
being the filter used. A meta file could contain the overall page 
settings.

eg:

/welcome/ (path is slug)
/welcome/page.meta (YAML settings for page)
/welcome/body.textile
/welcome/extended.smartypants
/welcome/extended.html (plain/non-filtered)

and so forth...

The real goal here however, is to allow layouts and partials to exist in 
the filesystem (within the 'app/view' folder structure), which 
immediately allows you to use an SCM (SVN, CVS, GIT etc) either for the 
whole project, or as an SVN External (or GIT/CVS equivalent). My 
preference would be to allow both file system and DB based 
layouts/snippets to co-exist, with file system layouts taking precedence 
in case of name clashes. It'd be great to use HAML as well. I'd also 
add, support for Multi-Site would be highly desired.

Jon.
Posted by Sean Cribbs (seancribbs)
on 14.06.2008 19:52
(Received via mailing list)
Jonathan McCoy wrote:
> settings.
>   
You just described the file_system extension written for Redken to a T.
I would like to release it but I'm not ready to support it yet or to
detox the code.

Sean
Posted by Arik Jones (imakethings)
on 14.06.2008 23:30
Gah! Shafted again! How long you gonna keep these awesome extensions 
under your wings? What detoxing needs to be done?

Sean Cribbs wrote:
> Jonathan McCoy wrote:
>> settings.
>>   
> You just described the file_system extension written for Redken to a T.
> I would like to release it but I'm not ready to support it yet or to
> detox the code.
> 
> Sean
Posted by Jonathan McCoy (jonjon)
on 16.06.2008 23:44
Sean Cribbs wrote:
> Jonathan McCoy wrote:
>> settings.
>>   
> You just described the file_system extension written for Redken to a T.
> I would like to release it but I'm not ready to support it yet or to
> detox the code.
> 
> Sean

Nice!

My next mission is to design/build a platform for content delivery (the 
binary kind) - basically a front end for managing content (videos, 
images, PDF's etc), engines to maintain and distribute the content 
(faux-RAID), and a delivery mechanism (caching HTTP app). Keen to find a 
solution using Radiant, but failing that will build a plugin for the 
integration.

Jon.
Posted by Jonathan McCoy (jonjon)
on 17.06.2008 13:24
Jonathan McCoy wrote:
> In parallel, it would be nice to add another basic user-level of 
> "Designer", for managing Snippets - in the absence of SCM/file support 
> for layouts/partials.
> 
> In keeping designs and code DRY, we find ourselves using snippets to 
> contain more than user-editable content, and use them heavily for 
> fragments of design logic. As such, we want to keep day-to-day users far 
> away from anything that can cause damage to the site.
> 
> Standard (Pages) -> Designer (+ Snippets) -> Administrator (+ Layouts, 
> Users, etc)
> 
> Does the Developer flag do anything in production mode?
> 
> Thanks,
> Jon.

I've monkey-patched a frozen version of Radiant (0.6.7) with some of the 
functionality I lusted for above. No testing or a "designer" flag (just 
put snippets on the Admin/Dev level). I'd be more inclined to assemble 
patches and tests (to the spec above) if anybody else was interested in 
it being pushed into the trunk?

Would be nice to review the user levels available - or if we're all 
feeling code-happy, granular access control. I can foresee the need for 
the following roles at least:

1. Content Monkey (pages + preferences)
2. Designer (+ layouts + snippets)
3. Developer (+ extensions)
4. Administrator (+ user management)

In hindsight to my previous post, I'd keep the developer flag for the 
benefit of extensions/plugins that need technical setup. Another 
question, is whether flags are more desirable than a user-level number 
(ie 1 to 4) or even a class-name, which can be mapped out to a role 
name. A popup list with userlevels can be used instead. It removes the 
uncertainty of having admin flagged, but developer unflagged -> what 
rights does the user have?!

I am having trouble finding where the user-level is set for the tab 
display - I've traced back through all the libraries, but can't seem to 
find (or rather see) where snippets (or rather other admin/dev tabs) are 
set...

Cheers,
Jon.