<%= ts('Manage Chapters') %>

<%= ts("Drag chapters to change their order.") %>

<%= ts("Enter new chapter numbers.") %>

<%= form_tag url_for(action: 'update_positions') do %>

<%= submit_tag ts("Update Positions") %> <%= link_to ts("Back"), url_for(@work) %>

<% end %>
<%= content_for :footer_js do %> <%= javascript_tag do %> $j("#sortable_chapter_list").sortable({ delay: 300, update: function(event, ui) { $j(".chapter-position-list").each(function(index, li){ var chapterId = $j(li).attr("id").replace("chapter_",""); $j("#position-for-"+chapterId).html(index+1); }); $j.ajax({ type: 'post', data: $j("#sortable_chapter_list").sortable("serialize") + "&work_id=<%= @work.id %>", dataType: 'script', url: "<%= url_for(:action => :update_positions) %>"}) } }) <% end %> <% end %>