embedded scaffold garbled

6 views
Skip to first unread message

Hernan Astudillo

unread,
Jul 28, 2010, 10:18:20 PM7/28/10
to activescaffold
I'm embedding another AS from another controller with an action link :

config.action_links.add "Agregar Sols", :action => "list", :controller => "disponibles",
:type => :member, :inline => true, :position => :after, :parameters => {:associations => "disponibles"}

however, it displays a lot of json garbage, like this:

try {
$("as_disponibles-content").update("<table cellpadding=\"0\" cellspacing=\"0\">\n  <thead>\n    <tr>\n        \n    <th id=\"as_disponibles-id-column\" class=\" \" title=\"\">\n          <a href=\"/disponibles/list?associations=disponibles&amp;id=37&amp;page=1&amp;sort=id&amp;sort_direction=ASC\" onclick=\"addActiveScaffoldPageToHistory('/disponibles/list?associations=disponibles&amp;id=37&amp;page=1&amp;sort=id&amp;sort_direction=ASC', 'as_disponibles'); new Ajax.Request('/disponibles/list?associations=disponibles&amp;id=37&amp;page=1&amp;sort=id&amp;sort_direction=ASC', {asynchronous:true, evalScripts:true, method:'get', onFailure:function(request){ActiveScaffold.report_500_response('as_disponibles-active-scaffold')}, onLoading:function(request){Element.addClassName('as_disponibles-id-column','loading');}, parameters:'authenticity_token=' + encodeURIComponent('P5ZlH7hj+1Gq0lraHMvRmWqHTZ7wmPgpLkaVIi0iHHc=')}); return false;\">Id</a>\n       </th>\n    <th id=\"as_disponibles-rut-column\" class=\" \" title=\"\">\n   

....and so on.


Looking at it, seems like it's missing an enclosing CDATA tag, within a <script>, that's why it doesn't get that "try". 
So, thing is, that in frontends/default/views/_list_inline_adapter.html.erb at:
<%=payload %> 
needs that enclosure 
or in: lib/extensions/action_controller_rendering.rb
line: 9
:locals => {:payload => render_to_string(args.first, &block)},

that render_to_string is returning javascript with no script tag.

any help? 



Sergio Cambra .:: entreCables S.L. ::.

unread,
Jul 29, 2010, 2:52:33 AM7/29/10
to actives...@googlegroups.com
On Jueves, 29 de Julio de 2010 04:18:20 Hernan Astudillo escribió:
> I'm embedding another AS from another controller with an action link :
>
> config.action_links.add "Agregar Sols", :action => "list", :controller =>
> "disponibles",
>
> :type => :member, :inline => true, :position => :after, :parameters =>
>
> {:associations => "disponibles"}

Why don't you use config.nested.add_link?
Anyway, try to add :format => :html in :parameters key.

--
Sergio Cambra .:: entreCables S.L. ::.
Mariana Pineda 23, 50.018 Zaragoza
T) 902 021 404 F) 976 52 98 07 E) ser...@entrecables.com

Hernan Astudillo

unread,
Jul 29, 2010, 3:37:05 AM7/29/10
to actives...@googlegroups.com
:format => :html worked fine, but it includes the whole layout, and it didn't work with :layout => false as parameter. Any workaround?

i don't use nested because i'm using it also, but with another controller with very different config. And as far as i know, you can only nest 1 controller to each associated model, right? maybe i could use another relation for that... but conditions depends on record data and current_user, and current_user can't... wait, it can be used in model. maybe it could work, i'll try that

thanks Sergio


--
You received this message because you are subscribed to the Google Groups "ActiveScaffold : Ruby on Rails plugin" group.
To post to this group, send email to actives...@googlegroups.com.
To unsubscribe from this group, send email to activescaffol...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/activescaffold?hl=en.


Sergio Cambra .:: entreCables S.L. ::.

unread,
Jul 30, 2010, 2:21:41 AM7/30/10
to actives...@googlegroups.com
On Jueves, 29 de Julio de 2010 09:37:05 Hernan Astudillo escribió:
> :format => :html worked fine, but it includes the whole layout, and it
>
> didn't work with :layout => false as parameter. Any workaround?

I tried it with master branch and it didn't include layout, which branch are
you using?

> > activescaffol...@googlegroups.com<activescaffold%2Bunsubscribe@
> >googlegroups.com> .


> > For more options, visit this group at
> > http://groups.google.com/group/activescaffold?hl=en.

--

Reply all
Reply to author
Forward
0 new messages