fix pagination

This commit is contained in:
Harry Bomrah 2015-01-08 20:03:07 +08:00
parent a49fdecb57
commit 3a1d0e6c4e
2 changed files with 25 additions and 18 deletions

View File

@ -34,7 +34,7 @@
</td> </td>
<% else %> <% else %>
<td> <td>
<a class="btn btn-small btn-primary aprrove-btn" href="/admin/admin_modules/approve?module_id=<%= rm.id.to_s %>">Approve</button> <a class="btn btn-small btn-primary approve-btn" href="/admin/admin_modules/approve?module_id=<%= rm.id.to_s %>">Approve</button>
</td> </td>
<% end %> <% end %>
</tr> </tr>

View File

@ -43,9 +43,16 @@
</div> </div>
<script type="text/javascript"> <script type="text/javascript">
var updateTableData = function(){ var updateTableData = function(){
var data = {},
params = getUrlVars();
$.each(params,function(i,v){
data[v] = params[v];
})
$.ajax({ $.ajax({
"url" : "/admin/admin_modules", "url" : "/admin/admin_modules",
"dataType" : "html", "dataType" : "html",
"data" : data,
"type" : "get" "type" : "get"
}).done(function(data){ }).done(function(data){
$("#index_table").html(data); $("#index_table").html(data);
@ -138,14 +145,6 @@
}).done(function(form){ }).done(function(form){
$("#editModal .modal-body").html(form); $("#editModal .modal-body").html(form);
$("#editModal").modal("show"); $("#editModal").modal("show");
$("#editModal #editModuleBtn").on("click",function(){
$("#approveSiteForm").ajaxSubmit({
success : function(){
updateTableData();
$("#editModal").modal("hide");
}
})
})
}) })
return false; return false;
}) })
@ -158,6 +157,18 @@
}).done(function(form){ }).done(function(form){
$("#approveModal .modal-body").html(form); $("#approveModal .modal-body").html(form);
$("#approveModal").modal("show"); $("#approveModal").modal("show");
})
return false;
})
}
$("#editModal #editModuleBtn").on("click",function(){
$("#approveSiteForm").ajaxSubmit({
success : function(){
updateTableData();
$("#editModal").modal("hide");
}
})
})
$("#approveModal #approveModuleBtn").on("click",function(){ $("#approveModal #approveModuleBtn").on("click",function(){
$("#approveSiteForm").ajaxSubmit({ $("#approveSiteForm").ajaxSubmit({
success : function(){ success : function(){
@ -166,10 +177,6 @@
} }
}) })
}) })
})
return false;
})
}
bindHandlers(); bindHandlers();
</script> </script>