Rails:tinyMCE 无法加载我的部分内容
我再次需要您有关 Rails 的帮助。这次,我遇到了tinyMCE 的问题。我可以让它在我的项目中工作,但当我尝试渲染部分内容时则不行。
好的,所以我想做的是用tinyMCE 显示文本区域的集合。为此,我称之为部分。让我给你展示我的代码,它会更容易理解。
所以我有我的模板,我想在其中显示所有内容:
#index.html.erb
<% if !@online_cv_fields.empty? then %>
<%= render :partial => 'online_cv_fields/form', :collection => @online_cv_fields %>
<% end %>
然后是我正在调用的部分
<%= form_for(form) do |f| %>
<% if form.errors.any? %>
<div id="error_explanation">
<h2><%= pluralize(form.errors.count, "error") %> prohibited this online_cv_field from being saved:</h2>
<ul>
<% form.errors.full_messages.each do |msg| %>
<li><%= msg %></li>
<% end %>
</ul>
</div>
<% end %>
<div class="field">
<%= f.label :field_name %><br />
<%= f.text_field :field_name %>
</div>
<div class="field">
<%= f.label :field_content %><br />
<%= f.text_area :field_content, :class => "mceEditor" %>
</div>
<div class="actions">
<%= f.submit %>
</div>
<% end %>
并且我正在我的应用程序布局中加载我的javascript
<%= javascript_include_tiny_mce_if_used %>
<%= tiny_mce if using_tiny_mce? %>
我的问题是Javascript不会加载索引。即使我尝试“强制”应用程序加载tinyMCE,
<%= javascript_include_tiny_mce %>
<%= tiny_mce %>
它也不起作用。
有什么线索吗?
谢谢 !
Once more, I'll need your help with Rails. This time, I've a problem with tinyMCE. I can get it working on my project but not when I'm trying to render a partial.
Ok, so what I'm trying to do is displaying a collection of textarea with tinyMCE. For that, I call a partial. Let me show you my code, it would be easier to understand.
So i have my template where I want to display everything:
#index.html.erb
<% if !@online_cv_fields.empty? then %>
<%= render :partial => 'online_cv_fields/form', :collection => @online_cv_fields %>
<% end %>
Then the partial i'm calling
<%= form_for(form) do |f| %>
<% if form.errors.any? %>
<div id="error_explanation">
<h2><%= pluralize(form.errors.count, "error") %> prohibited this online_cv_field from being saved:</h2>
<ul>
<% form.errors.full_messages.each do |msg| %>
<li><%= msg %></li>
<% end %>
</ul>
</div>
<% end %>
<div class="field">
<%= f.label :field_name %><br />
<%= f.text_field :field_name %>
</div>
<div class="field">
<%= f.label :field_content %><br />
<%= f.text_area :field_content, :class => "mceEditor" %>
</div>
<div class="actions">
<%= f.submit %>
</div>
<% end %>
And I'm loading my javascript in my application layout
<%= javascript_include_tiny_mce_if_used %>
<%= tiny_mce if using_tiny_mce? %>
My problem is that the Javascript won't load for the index. Even if I try to "force" the application to load tinyMCE with
<%= javascript_include_tiny_mce %>
<%= tiny_mce %>
It just doesn't work.
Any clue?
Thanks !
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您使用什么模式? TinyMCE 是否知道您希望它拾取“mceEditor”类?请参阅:http://tinymce.moxiecode.com/wiki.php/Configuration:mode 和 http://tinymce.moxiecode.com/wiki.php/Configuration:elements< /a>
您可能还想尝试 TinyMCE Hammer:http://tinymcehammer.lanalot.com/
What mode are you using? Does TinyMCE know you want you want it to pick up the 'mceEditor' class? See: http://tinymce.moxiecode.com/wiki.php/Configuration:mode and http://tinymce.moxiecode.com/wiki.php/Configuration:elements
You might also like to try TinyMCE Hammer: http://tinymcehammer.lanalot.com/