jquery 令牌输入和 active_admin
我想在 active_admin
内使用 jquery-token-input
和 has_many 关系。
最好的方法是什么,以及如何通用地实现它,以便我可以重新使用代码来实现进一步的 has_many 关系。
我期待您的建议和指导方针。
I want to use jquery-token-input
with has_many relationship inside active_admin
.
What is the best way to do it, and how can i implement it generically so that i can re-use the code for further has_many relationships.
I will be looking forward for your suggestion and guide lines.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
好吧,这没有使用
jquery-token-input
,但它有效!我使用了选择。
下载 CSS、JS 和 png 文件并将其放入相应的资源目录中。
在
/app/admin/modelname.rb
中在
active_admin.js
中 在
active_admin.css.scss
中Well, this doesn't use
jquery-token-input
, but it works!I used Chosen.
Download the CSS, JS and png files and put into the appropriate assets directory.
In
/app/admin/modelname.rb
In
active_admin.js
In
active_admin.css.scss
我可以采用 RailsCast 来做到这一点。
http://railscasts.com/episodes/258-token-fields
唯一的附加内容要考虑的是确保 JavaScript 和 CSS 包含在 ActiveAdmin 中。
对于 ActiveAdmin 中的表单,这是我使用的(在文件 app/admin/story.rb 中)。
在这种情况下,我的模型是 Story 和 Issues,通过 has 和属于许多关系连接。
唯一的问题是,令牌输入似乎被主动管理员覆盖,试图找出这个问题。
更新
将以下内容添加到 app/assets/stylesheets/active_admin.css.sass
这将获得一些所需的样式,但仍然需要一些工作,我认为由于与活动管理样式发生冲突。
There's a RailsCast on this that I was able to adapt in order to do this.
http://railscasts.com/episodes/258-token-fields
The only additional things to think about are making sure that the javascript and css are included in ActiveAdmin.
For the form in ActiveAdmin, here's what I used (in the file app/admin/story.rb)
In this case, my models are Story and Issues, connected by a has and belongs to many relationship.
The only gotcha is that the token input seems to be getting overridden by active admin, trying to figure that one out.
Update
Add the following to app/assets/stylesheets/active_admin.css.sass
This gets some of the needed styling going, but some work is still needed, I think due to clashes with active admin styling.