[Nitro] gen and parts
Fabian Buch
fabian at oggu.de
Tue Aug 8 07:00:39 EDT 2006
Am 08.08.2006 um 01:21 schrieb gabriele renzi:
> I see thank you , I'll implement this since it is simple enough :)
> But just another question: how do you handle references to media/js in
> the part code?
> Do you rely on hardcoded paths (i.e. <img src=/partname/
> something.png>),
> or is there a way through which we could make it modular, allowing for
> the copying of a part with a different name?
Well, I've written a test part where I made a setting for it, like in
the AdminPart there's a setting :charset, mine looks as follows:
class TestPart
setting :public, :default => '/part/test'
setting :charset, :default => 'utf-8'
end
Then in a skin for example I use:
<img src="#{TestPart.public}/media/test.png" />
I'm not so sure whether it's clever to name it :public, maybe
something nicer could be found. But you get the idea and it could be
set as guidline for Part developers to always set this setting
(whether it's :public or something else we define through this
thread) if the part uses a public/ directory.
Gen could then override this setting while copying the part.
My "gen part" doesn't take the latter into account yet.
Fabian
--
Nitro Q&A: http://oxyliquit.de/
Blog: http://blog.fabian-buch.de
More information about the Nitro-general
mailing list