我正在嘗試使用集成的scriptaculous拖放效果創建Ruby on Rails應用程序。Ruby on Rails拖放不起作用
由於我是Ruby的新手,在查看許多文檔時,我最終看到了這段代碼,但無法理解爲什麼控制器代碼沒有執行。
在html.erb頁面起源DIV
<% for therm in @therms %>
<tr valign="top" class="<%= cycle('list-line-odd', 'list-line-even') %>">
<td>
<% therm_id = "therm_#{therm.id}" %>
<li class="origin" id='<%= therm_id %>'><%= therm.id %></li>
</td>
目標
<%= image_tag "dragtrash.png", :id=>'trash'%>
而且我確定放置目標
<%= drop_receiving_element('trash',
:accept => 'origin',
:complete => "$('spinner').hide();" ,
:before => "$('spinner').show();" ,
:hoverclass => 'hover',
:with => "'paramid=' + encodeURIComponent(element.id.split('_').last())" ,
:url => {:action=>:trash_therm})%>
在我的控制器
最後
def trash_therm
redirect_to(:action => 'create')
end
當我將物品放入目標時,丟棄的內容將粘貼到目標上。 如果目標沒有「捕捉」物品,它會回覆到原來的位置。 我不明白爲什麼控制器中的代碼沒有執行。
提前感謝幫助
你看過什麼JavaScript在做什麼? – BaroqueBobcat 2009-10-09 20:59:34
我怎樣才能看到它? Thansks – SilverRuby 2009-10-10 03:45:35