Hi,

On Fri, Feb 22, 2013 at 4:23 PM, roland16 <rolan...@poczta.onet.pl> wrote:

> Hi,
> Let's say there is a component title.mi which contains some information
> determined by child component of Base.mc.
> 'title.mi' component is called in <%augment wrap> method of Base.mc like:
>
> <%class>
> has 'title';
> </%class>
> <%augment wrap>
> % $.Defer {{
> <& 'title.mi' &>
> % }}
> <% inner() %>
> </%augment>
>
> title.mi :
> <% $.title %>
>
> The original 'title.mi' component is actually quite large and i don't want
> to put the code inside Base.mc.
>
> Is there a way to set the 'title' attribute in child component of Base.mc
> (i.e. index.mc by writing $.title('deferred value') ) so that 'title.mi'
> will be executed with deferred value of 'title' attr?
>

The problem is that $.title in title.mi is not the same $.title in index.mc…
They are different components, different object instances.

In title, you need to access $m->page->title…

I wrote a small proof-of-concept, you can find it here:

https://github.com/melo/pocs/tree/master/mason_attrs

See how $self is a different instance inside title.mi and index.mc.


As I understand, defer method gets a block of code and inserts it into the
> output at request end (executing this block by CODE->() and replacing the
> markups with executed code).
> I know that calling component via <& &>, which is eq to $m->comp, executes
> the code that is inside.
> $m->construct constructs and return a new instance of the component, but
> is there a way to call a main method of this component by the Defer plugin?
>

Yes, $m->page.

Bye,
-- 
Pedro Melo
@pedromelo
http://www.simplicidade.org/
http://about.me/melo
xmpp:m...@simplicidade.org
mailto:m...@simplicidade.org
------------------------------------------------------------------------------
Everyone hates slow websites. So do we.
Make your web apps faster with AppDynamics
Download AppDynamics Lite for free today:
http://p.sf.net/sfu/appdyn_d2d_feb
_______________________________________________
Mason-users mailing list
Mason-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mason-users

Reply via email to