Rails best_in_place jQuery 就地编辑:激活按钮不起作用 [英] Rails best_in_place jQuery in place editing :activator button not working

查看:35
本文介绍了Rails best_in_place jQuery 就地编辑:激活按钮不起作用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的部分设置如下:

<%= best_in_place_if can?(:edit, Artist), @artist, :display_name, type: :input, :activator => "#activator" %>
<a href="#" id="activator">Edit</a>

当我点击 Edit 链接时,没有任何反应.

When I click the Edit link, nothing happens.

如果我删除 :activator =>#activator" 来自 best_in_place 链接,然后它允许我单击文本字段以开始按预期进行编辑;唯一的问题是这在 iPad 上不起作用,所以我需要一个单独的按钮来触发这个编辑功能.

If I remove :activator => "#activator" from the best_in_place link, it then allows me to click the text field to start editing as I expect; the only problem is this doesn't work on iPad so I need a separate button to trigger this edit function.

有没有人知道让 :activator 设置工作的解决方法,或者有其他建议(包括不同的 gem),他们知道可以用于现场编辑字段?

Does anyone know of a workaround for getting the :activator setting working, or have another suggestion (including a different gem) that they know would work for in place editing of fields?

推荐答案

您是否使用局部来显示艺术家列表?也许ID不够具体,所以它变得混乱,因为有一个id为激活器"的激活器链接,但同时有多个激活器".尝试更具体地使用 ID.类似的东西:

Are you using the partial to display a list of artists? Perhaps the ID isn't specific enough, so it's getting confused since there's an activator link with id "activator", but there are multiple "activator"s at the same time. Try being more specific with the ID. Something like:

<%= best_in_place_if can?(:edit, Artist), @artist, :display_name, type: :input, :activator => "#activator-#{@artist.id}" %>
<a href="#" id="activator-#{@artist.id}">Edit</a>

这篇关于Rails best_in_place jQuery 就地编辑:激活按钮不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆