41 lines
971 B
Plaintext
41 lines
971 B
Plaintext
<% content_for :page_specific_css do %>
|
|
<%= stylesheet_link_tag "universal_table/universal-table" %>
|
|
<% end %>
|
|
<div style="margin-bottom: 1em;">
|
|
<button type="button" class="btn btn-primary" id="update_sort_button"><%= t('universal_table.manual_update_sort') %></button>
|
|
</div>
|
|
<%= render partial: 'edit_sort' %>
|
|
<script type="text/javascript">
|
|
function update_sort(){
|
|
var ids = $.map($('#sortable>tr'),function(v){return $(v).data('id')});
|
|
$.ajax({
|
|
url: "<%= admin_universal_table_update_sort_path(@table) %>",
|
|
type: 'POST',
|
|
dataType: 'text',
|
|
data: {ids: ids},
|
|
success: function(data){
|
|
$('#data-table').replaceWith(data);
|
|
sortable();
|
|
}
|
|
});
|
|
}
|
|
function sortable(){
|
|
$( "#sortable" ).sortable({
|
|
update: function( event, ui ) {
|
|
update_sort();
|
|
}
|
|
});
|
|
}
|
|
$(document).ready(function(){
|
|
$('#update_sort_button').click(update_sort);
|
|
sortable();
|
|
});
|
|
</script>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|