[Nitro] gen and parts
gabriele renzi
surrender_it at yahoo.it
Wed Aug 9 04:30:26 EDT 2006
Fabian Buch ha scritto:
> 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" />
makes sense, even if I admit I prefer to set <base
href="#{TestPart.public}> so that I can simplify the rest of the html code.
> 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.
The idea of using it as a guideline is a good one.
Thell devs they could be happy following the common sense and getting
features for free and all that.
As for the name.. well, it has a name clash with ruby's #public so
possibly public_root or public_dir could be better ?
> Gen could then override this setting while copying the part.
> My "gen part" doesn't take the latter into account yet.
yup
--
blog en: http://www.riffraff.info
blog it: http://riffraff.blogsome.com
jabber : rff.rff at gmail dot com
More information about the Nitro-general
mailing list