【问题标题】:Nicedit works localhost but not HerokuNicedit 适用于本地主机,但不适用于 Heroku
【发布时间】:2026-01-25 04:20:02
【问题描述】:

我在使用 nicEdit 时遇到问题。

框架是 ruby​​ 2.0.0 / rails 4.0.1

在本地主机中时,仅当您将页面上传两次时才有效。

但是在 Heroku 中部署时,它根本不起作用。

我跟着this example 到了最后一行。

我在 ../vendor/assets/javascripts 下有一个 niEdit.js

这是我的完整表格:

<%= javascript_include_tag 'nicEdit' -%>

<%= simple_form_for(@recipe) do |f| %>
<%= f.error_notification %>

<div class="field">
<%= f.label "Elige un cromo" %><br />
<%= f.file_field :chrome %>
</div>

<div class="form-inputs">
<%= f.association :user, label_method: :name, collection: User.where(name: current_user.name), :label => "Cociner@" %>
<%= f.association :category, :label => "Categoría", label_method: :plato_category, collection: Category.all %>
<%= f.input :plato %>
<%= f.input :minutos %>
<script type="text/javascript">
   bkLib.onDomLoaded(function() { nicEditors.allTextAreas() });
</script>
<div class="well well-small">
  <p>Tejemaneje</p>
  <%= f.text_area :tejemaneje, :rows => 10, :style => 'width: 700px' %>
</div>

 </div>
  <p>
  </p>
<%= f.button :submit, "Receta", :class => "btn btn-success" %>

 <% end %>

我应该做些什么不同的事情才能让它在 localhost 和 heroku 上完全工作?谢谢。

【问题讨论】:

    标签: javascript heroku nicedit


    【解决方案1】:

    部分解决方案:

    我将 nicEdit.js 移到 /assets/javascript 下,脚本现在正在运行,但在 NicEdit.js 中是否有这一行并不重要

    iconsPath : '/assets/nicEditorIcons.gif' 和 /assets/images/nicEditorIcons.gif 下的图标,它们不显示。 /assets/nicEditorIcons.gif 也一样

    我移动了 /assets/javascripts 下的图标并将行更改为

    iconsPath : '.../nicEditorIcons.gif'

    我还尝试将图标放在 /assets/nicEditorIcons.gif 下,并带有图标。没有任何效果。

    Heroku 是否有专门放置图标的地方?我必须更改脚本调用吗?有什么帮助吗?

    【讨论】:

      最近更新 更多