Textarea调整大小并触发best_in_place模糊事件

时间:2013-06-25 09:06:40

标签: javascript ruby-on-rails ruby-on-rails-3.2 best-in-place

我在几个textareas上使用best_in_place gem,有时(看似随机)textarea'跳跃'并在我点击保存时触发模糊事件,提示“放弃更改”警告。

以下是代码:

<p>Administrator Notes (<%= link_to 'Edit', '#', id: 'edit_notes_link', onclick: 'event.preventDefault()' %>)</p>
<div class="panel radius">
  <%= best_in_place [:admin, @booking], :notes, type: :textarea, ok_button: 'Save', cancel_button: 'Cancel', activator: '#edit_notes_link', display_with: :simple_format, nil: '<i>None</i>' %>
</div>

这是行为的GIF:

http://f.cl.ly/items/1q0o0x2G111P012b131z/output_optimized.gif

(和the video GIF取自)

我猜测某些地方有一些JavaScript欺诈,但我不知道从哪里开始调试它。如果您已经看到Best in Place表现得像这样,或者您有一些指导如何调试它,那么我真的很感激一些帮助。

3 个答案:

答案 0 :(得分:0)

如果您使用的是firebug,请尝试打开日志事件以获取更多信息。这是一篇解释它的文章http://www.softwareishard.com/blog/firebug/firebug-tip-log-dom-events/

答案 1 :(得分:0)

我遇到了同样的问题,刚刚删除了ok_button。现在似乎工作正常。

答案 2 :(得分:0)

我还没有使用过最好的宝石,但是  我有类似的要求。我使用了x-editable

工作得很好。