在复选框集合中显示图像 [英] show images in checkbox collection

查看:202
本文介绍了在复选框集合中显示图像的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用best_in_place(这对我的问题不重要)。

I use best_in_place (it's not important for my question).

我要显示图片而不是复选框。

I want to show images instead of the checkbox.

我的图片位于: public / images

>

so I tried:

<%= best_in_place task, :done,:classes => 'highlight_on_success', type: :checkbox, collection: [image_tag("/images/checkbox_yes.gif"), image_tag("/images/checkbox_no.png")] %>

不幸的是,复选框的默认图像(应为第一个图像)显示为 - ,当我按下它,我看到第二个图像。

unfortunately, the default image of the checkbox (should be the first image) is shown as -, and when I press it, I saw the second image.

我试图检查是否有问题第一个图像,所以我把我的代码改成:

I tried to check if there is a problem with my first image, so I changed my code into:

<%= best_in_place task, :done,:classes => 'highlight_on_success', type: :checkbox, collection: [image_tag("/images/checkbox_no.png"), image_tag("/images/checkbox_yes.gif")] %>

但是默认图像(应为第二个图像)显示为

But the default image (should be the second image) was shown as -, and when I pressed it, I saw the first image.

请帮助。

推荐答案

此问题在最近一次请求,因此请更新您的 best_in_place 版本以解决此问题。从测试代码可以看出,您的语法应该很好。

This issue is addressed in a recent pull request, so update your best_in_place version to get this issue resolved. As can be seen from the test code your syntax should be fine.

这篇关于在复选框集合中显示图像的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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