Rails:用Rails编写onclick代码



您可能会发现这个非常基本的问题,但我不知道如何在rails中编写此代码:

  <input type='image' src='http://images.aviary.com/images/edit-photo.png' value='Edit photo' onclick="return launchEditor('image1', 'http://images.aviary.com/imagesv5/feather_default.jpg');" />

我正在上传照片,需要使用上面的代码来编辑照片。

这里我想使用下面的代码:

<%= image_tag photo.object.avatar.url(:thumb), :class => "foodio_photo" unless f.object.new_record? or photo.object.new_record? %>

请帮忙!我是新手。

首先,放置onclick的位置在javascript文件中。也就是说,这应该可以工作:

"foodio_photo",:onclick => "doSomethingWith(this)"),除非f.t object.new_record?还是photo.object.new_record ?%>

最新更新