admin管理员组文章数量:1025486
I'm having an issue with rendering a partial in a modal window. I've tried it with both simple modal as well as prototype-window. I'm basically trying to render a partial within the modal popup. Here is what it looks like now:
<%=link_to_function("Share This!", "win = new Window({title: \"Share This\", width:200, height:150, destroyOnClose: true, recenterAuto:false});
win.getContent().update("+escape_javascript(render :partial => 'groups/show')+");
win.showCenter();
")%>
I've tried multiple binations of how to put the escape_javascript bit as well as trying this in simple modal.
Any help would be really appreciated.
I'm having an issue with rendering a partial in a modal window. I've tried it with both simple modal as well as prototype-window. I'm basically trying to render a partial within the modal popup. Here is what it looks like now:
<%=link_to_function("Share This!", "win = new Window({title: \"Share This\", width:200, height:150, destroyOnClose: true, recenterAuto:false});
win.getContent().update("+escape_javascript(render :partial => 'groups/show')+");
win.showCenter();
")%>
I've tried multiple binations of how to put the escape_javascript bit as well as trying this in simple modal.
Any help would be really appreciated.
Share Improve this question asked Feb 22, 2012 at 20:48 pashpash 1071 silver badge8 bronze badges1 Answer
Reset to default 6I'm thinking it would be easier render the partial on the page (hidden) and then capture it into the window using setContent when the button's pressed. This would mean you could put the more of the js outside the page, which would be a bit nicer too.
In the view:
<div id="groups_show" style="display:none">
<%= render :partial => 'groups/show' %>
</div>
<%= link_to_function("Share This!", "show_group_popup()") %>
In application.js (or other included js file):
function show_group_popup() {
$('groups_show').show();
win = new Window({title: "Share This", width:200, height:150, destroyOnClose: true, recenterAuto:false});
win.setContent('groups_show',true,true);
win.show();
}
I'm having an issue with rendering a partial in a modal window. I've tried it with both simple modal as well as prototype-window. I'm basically trying to render a partial within the modal popup. Here is what it looks like now:
<%=link_to_function("Share This!", "win = new Window({title: \"Share This\", width:200, height:150, destroyOnClose: true, recenterAuto:false});
win.getContent().update("+escape_javascript(render :partial => 'groups/show')+");
win.showCenter();
")%>
I've tried multiple binations of how to put the escape_javascript bit as well as trying this in simple modal.
Any help would be really appreciated.
I'm having an issue with rendering a partial in a modal window. I've tried it with both simple modal as well as prototype-window. I'm basically trying to render a partial within the modal popup. Here is what it looks like now:
<%=link_to_function("Share This!", "win = new Window({title: \"Share This\", width:200, height:150, destroyOnClose: true, recenterAuto:false});
win.getContent().update("+escape_javascript(render :partial => 'groups/show')+");
win.showCenter();
")%>
I've tried multiple binations of how to put the escape_javascript bit as well as trying this in simple modal.
Any help would be really appreciated.
Share Improve this question asked Feb 22, 2012 at 20:48 pashpash 1071 silver badge8 bronze badges1 Answer
Reset to default 6I'm thinking it would be easier render the partial on the page (hidden) and then capture it into the window using setContent when the button's pressed. This would mean you could put the more of the js outside the page, which would be a bit nicer too.
In the view:
<div id="groups_show" style="display:none">
<%= render :partial => 'groups/show' %>
</div>
<%= link_to_function("Share This!", "show_group_popup()") %>
In application.js (or other included js file):
function show_group_popup() {
$('groups_show').show();
win = new Window({title: "Share This", width:200, height:150, destroyOnClose: true, recenterAuto:false});
win.setContent('groups_show',true,true);
win.show();
}
本文标签: javascriptRendering partial in rails modalStack Overflow
版权声明:本文标题:javascript - Rendering partial in rails modal - Stack Overflow 内容由热心网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://it.en369.cn/questions/1745635546a2160425.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论