Orbit/app/views/admin/users_new_interface/edit_order.html.erb

65 lines
2.0 KiB
Plaintext
Raw Normal View History

<% content_for :side_bar do %>
<%= render :partial => 'admin/users_new_interface/side_bar' %>
<% end %>
<% content_for :page_specific_css do -%>
<%= stylesheet_link_tag "lib/member" %>
<% end -%>
<div id="list-view">
<table id="member-list" class="table main-list">
<thead>
<tr class="sort-header">
<th class="gender"></th>
<th class="span2"><a href="#"><%= t(:position) %></a></th>
<th class="span4"><a href="#"><%= t(:name) %></a></th>
<th><a href="#"><%= t(:email) %></a></th>
</tr>
</thead>
<tbody>
<%= render partial: "user_edit_order", collection: @users %>
</tbody>
</table>
</div>
<div class="bottomnav clearfix">
<div class="action pull-right">
<%= link_to t(:update_), '#', class: "btn btn-primary pull-right" %>
</div>
</div>
<% content_for :page_specific_javascript do %>
<script>
$(function(){
var _userPosition = [];
$('#member-list').on(clickEvent, '.edit_position', function(e){
var $input = $('<input type="text">');
var $cross = $('<a class="btn btn-mini"><i class="icons-cross"/></a>');
$(this).after($cross);
$(this).after($input);
$(this).hide();
$input.val($(this).text()).attr('id', $(this).data('user-id'));
e.preventDefault();
$cross.click(function(event) {
$input.remove();
$(this).siblings('a').show().end().remove();
});
});
$('.bottomnav').on(clickEvent, '.btn', function(e) {
$('#member-list tbody input').each(function() {
_userPosition.push([$(this).val(), $(this).attr('id')])
});
e.preventDefault();
$.ajax({
url: '<%= update_order_admin_users_new_interface_index_path %>',
type: 'POST',
dataType: 'script',
data: {users: _userPosition}
}).done(function() {
_userPosition = [];
console.log(_userPosition)
});
});
});
</script>
<% end %>