[Nitro] Wee+Nitro status

Michael Neumann mneumann at ntecs.de
Thu Jun 30 09:18:24 EDT 2005

Hi George & Co,

I've made some progress on merging Wee and Nitro.
I can now handle a Wee Component as a Nitro Controller. But my ultimate 
goal is to be able to call Wee components from within Nitro controllers.

The idea is as follows:

Each component must have a unique name, e.g. 'pager', or 'pager1', 
'pager2' etc... Of course, only the root_components have to be registered.

The Session stores the components in a Hash:

   session[:components] => { 'pager' => Wee::Component... }

Inside your Nitro Controller, you can create new components with:

   make_component 'pager', Wee::Component.new

Or once you don't need them any longer, drop them with:

   drop_component 'pager'

Both is just sugar for:

   session[:components]['pager'] = ...
   # or

Except, that for page-full components, the latter might remove the 
page-id for 'pager' from the URL.

Then you can render a component with:

   render_component 'pager'

Additionally you need a special ComponentController, registered under 
/component. This is needed for the callbacks.

I'd like to access the components under:


Or even better:


Is there a simple way how I could map that to method 'callback' of the 
ComponentController with the component name as parameter, e.g.

   def callback(component_name)
     # ...

Or as: request.params['component_name']

For pageless components (no backtracking), we're done here. But to make 
  page-full components work, we need to carry around the page-ids of 
each component in the url, e.g.

When 'render_component' is called for the first time for a component, 
it's page-id is injected into the URL and carried around until it is 
removed from the URL. This could be done by:

   forget_component 'pager'

You can of course mix page-full and page-less components.
Any ideas for the "?query" names I should use to not interfer with other 
Nitro apps?



   _c . "component name" = "page_id"

Nitro coders that also use Wee components in their apps, would have to 
include all those params into each link. This could be done like:

   <a href="/blog/show?oid=444&<%= include_component_params %>

Or a shader could do this automatically...

Hope you'll enjoy this.



More information about the Nitro-general mailing list