progress and end of day commit

This commit is contained in:
2012-08-22 21:58:20 +02:00
parent 0856528f5e
commit 13dd2bf335
11 changed files with 95 additions and 16 deletions
+16 -4
View File
@@ -1,3 +1,4 @@
button onClick='Qrammer.build_product_list()' class='btn btn-inverse'Lijst
table#products-table.table.table-striped.table-hover
tbody
- content_for :footer do
@@ -6,10 +7,21 @@ table#products-table.table.table-striped.table-hover
$.get('#{product_list_supplier_path(@supplier, format: :json).html_safe}', function(res){
window.products = res
body = $('#products-table tbody')
for(category in window.products){
body.append('<tr><td><h3>'+category+'<h3></td></tr>')
for(iproduct in window.products[category]){
body.append('<tr><td>'+window.products[category][iproduct].name+'</td></tr>')
for(var category in window.products){
body.append('<tr><td colspan="3"><h3>'+category+'<h3></td></tr>');
var category_ref = window.products[category];
for(var iproduct = 0; iproduct < window.products[category].length; iproduct++){
var product_index = iproduct;
row = $('<tr></tr>');
button = $('<button class="btn btn-primary">Add</button>');
var callback = (function(ref){
return function(){ Qrammer.add_product(ref[product_index]) }
})(category_ref)
button.click(callback);
row.append('<td>'+window.products[category][iproduct].name+'</td>');
row.append('<td>'+Qrammer.currency(window.products[category][iproduct].price)+'</td>');
row.append($('<td></td>').append(button));
body.append(row);
}
}
})