On Tuesday, September 27, 2011 7:00:43 AM UTC-4, Noel Villamor wrote:
>
> Gotcha! Thanks for the hint Anthony.
>
> Controller:
>
> a=PluginMModal(title='Hello World',content='give this a
> try!',close="close",width=30,height=30,id='59d38b19-05aa-4125-a19b-6e17069cd873')
> ... a.link(...)
>
a.link() does not add a 'link' attribute to the 'a' object, it actually
returns the link itself, so simply calling the method in the controller
without assigning the result to a variable and then passing it to the view
will be useless. You're better off calling this method directly in the view
-- creating the link in the controller doesn't make things any easier
because you still have to explicitly place the link in the view (see below).
View:
>
> {{extend 'layout.html'}}
> {{=form}}
> {{a=PluginMModal(title='Hello World',content='give this a
> try!',close="close",width=30,height=30,id='59d38b19-05aa-4125-a19b-6e17069cd873')}}
> {{=a}}
>
There is no need to create a new object in the view -- your problem is that
although you created an object in the controller, you never passed it to the
view. The view only gets objects that are passed to it in the dict returned
by the controller. Also, you have to place the a.link() separately. Try
this:
Controller:
def func():
modal = PluginMModal(title='Hello World',content='give this a
try!',close="close",width=30,height=30)
return dict(modal=modal)
View:
{{=modal}}
{{=modal.link('Click me')}}
Anthony