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);
}
}
})
+4 -5
View File
@@ -51,12 +51,11 @@ html lang="en"
= yield
.span3
.well.sidebar-nav
h3 Sidebar
h3 Qrammer
ul.nav.nav-list
li.nav-header Sidebar
li= link_to "Link 1", "/path1"
li= link_to "Link 2", "/path2"
li= link_to "Link 3", "/path3"
li.nav-header Links
li= link_to "Home", root_path
li= link_to "Companytools", 'http://www.companytools.nl/'
footer
p &copy; Companytools 2012
@@ -4,6 +4,10 @@
= f.label :name, class: 'control-label'
.controls
= f.text_field :name, class: 'text_field'
.control-group class=(@product_category.errors[:position].any? ? 'error' : nil)
= f.label :position, class: 'control-label'
.controls
= f.text_field :position, class: 'text_field'
.control-group class=(@product_category.errors[:supplier_id].any? ? 'error' : nil)
= f.label :supplier_id, Supplier.model_name.human, class: 'control-label'
.controls
+3 -1
View File
@@ -5,6 +5,7 @@ div.page-header= title :index, model_class
thead
tr
th= model_class.human_attribute_name(:name)
th= model_class.human_attribute_name(:position)
th= Supplier.model_name.human
th= model_class.human_attribute_name(:created_at)
th=t 'helpers.actions'
@@ -12,7 +13,8 @@ div.page-header= title :index, model_class
- @product_categories.each do |product_category|
tr
td= link_to product_category.name, product_category
td= link_to product_category.supplier.name, product_category.supplier
td= product_category.position
td= link_to_if product_category.supplier.present?, product_category.supplier.try(:name), product_category.supplier
td=l product_category.created_at, format: :short
td
= link_to t('helpers.links.edit'), [:edit, product_category], class: 'btn btn-mini'
+5 -2
View File
@@ -4,8 +4,11 @@
dl.dl-horizontal.show-list
dt= model_class.human_attribute_name(:name)
dd= @product_category.name
dt= Supplier.model_name.human
dd= link_to @product_category.supplier.name, @product_category.supplier
dt= model_class.human_attribute_name(:position)
dd= @product_category.position
- if @product_category.supplier.present?
dt= Supplier.model_name.human
dd= link_to @product_category.supplier.name, @product_category.supplier
.form-actions
= link_to t("helpers.links.back"), product_categories_path, class: 'btn'
+2 -2
View File
@@ -17,8 +17,8 @@ div.page-header= title :index, model_class
td= link_to product.name, product
td= product.code
td= product.price
td= link_to product.product_category.name, product.product_category
td= link_to product.supplier.name, product.supplier
td= link_to_if product.product_category.present?, product.product_category.try(:name), product.product_category
td= link_to_if product.supplier.present?, product.supplier.try(:name), product.supplier
td=l product.created_at, format: :short
td
= link_to t('helpers.links.edit'), [:edit, product], class: 'btn btn-mini'