[英]Rails 4 Issue with ckeditor
我有一个部分的ck编辑器输入为
_event_info.html.erb
<%= form_for @event, :url => { :action => "update"} do |f| %>
<%= f.cktext_area :event_info %>
<%= f.submit 'submit' %>
<% end %
我正在显示视图中渲染此局部
show.html.erb
<%= link_to "", "#", :id => 'update-click', :class=>"icon fa-edit fa-2x edit-cover", :remote => true %>
<div id="update-info-show" >
<%= raw(@event.event_info) %>
</div>
<div id="update-info-update" style="display: none">
</div>
<input type="button" id="close-editor" value="Cancel"> </input>
<script type="text/javascript">
$('#update-click').click(function() {
$("#update-info-show").hide();
$("#update-click").hide();
$('#update-info-update').show();
$("#update-info-update").html("<%=j render :partial => 'event_info' %>")
});
$('#close-editor').click(function() {
$('#update-info-update').hide();
$('#update-click').show();
$('#update-info-show').show();
});
</script>
因此,当我单击#update-click按钮时,我正确地获得了ck编辑器,然后,当我单击取消按钮(#close-editor)时,它隐藏了编辑器,但是当我再次单击#update-click按钮时,我没有不再获取ck编辑器,而是获取输入的纯文本区域
请帮我解决这个问题
为什么不只是在div中局部渲染然后隐藏/显示
<div id="update-info-update" style="display: none">
<%=render :partial => 'event_info' %>
</div>
并删除
:remote => true
从链接
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.