[typo] Sidebars

Piers Cawley pdcawley at bofh.org.uk
Mon Mar 20 19:32:50 EST 2006


"Scott Laird" <scott at sigkill.org> writes:

> I'd really, *really* like to find a way to keep the sidebar code and views
> bundled together in the same directory structure.  From what I can see here,
> you're breaking the two apart as a sort of natural consequence of dropping
> components.  Can we please find a way to stick them back together?

Ah... now I was deliberately trying to reflect the same structure as
the rest of rails; there's nothing to stop us having a structure like:

   vendor/plugins/pluggable_sidebars/sidebars/amazon:
     amazon_sidebar.rb
     _content.rhtml
     _configure.rhtml

ie, just have 'em sat side by side. It's all in how you implement
'with_include_path' 

Hmm... I think this might be the way to go, that way we can sling
extra sidebars around as simple tarballs that can go pretty much
anywhere in the include path. I can imagine a day when complex
sidebars get their own gem installation and you either include them
with environment.rb or do 

   ./script/generate sidebar foo

which copies the appropriate files from the gem directory and dumps
'em in your vendor/plugins/pluggable_sidebars/sidebars directory where
they'll get picked up by init.rb

Of course, YAGNI applies, so I'll not actually implement that until
someone demonstrates a need for it, but it does give us a potential
route to letting people distribute sidebars rather neatly.

Another possible layout for the sidebar's directory gos something like this:

   amazon/amazon_sidebar.rb
         /views/_content.rhtml
                _configure.rhtml
         /tests/test_amazon.rb

Especially handy if we can write a test_sidebars task that will run those
tests.

In other words, it's all up in the air, I haven't implemented anything
yet, so now's a good time to think about what the API is going to be
like.

-- 
Piers Cawley <pdcawley at bofh.org.uk>
http://www.bofh.org.uk/


More information about the Typo-list mailing list