Rails - dynamic addition to sortable_element

Add to the sorted list using Ajax, and in order to get the Scriptaculous effects that can be used after the addition, the only way I found is to re-execute the sortable_element.

Can anyone suggest a better way to do this, with full code this is a hack:

><%= link_to_remote "Add",  
    :url => { :controller => "pages", :action => "add_fragment", :pid => pid, :index => index  },  
    :complete => "eval(decodeURIComponent(#{sortable_element 'frag_list', :url => sort_frag_pages_path, :complete => visual_effect(:highlight, 'frag_list'), :handle => 'handle'}).gsub('//',''));" %>
+3
source share
1 answer

the answer is to add this to the controller method called by link_to_remote

page.sortable: frag_list

+1
source

Source: https://habr.com/ru/post/1744227/


All Articles