From 0337b7f270d19a9cd754dc231304eb8972c1d5e8 Mon Sep 17 00:00:00 2001 From: Sahat Yalkabov Date: Sun, 29 Dec 2013 03:23:02 -0500 Subject: [PATCH] Refactoring --- public/javascripts/main.js | 14 +++++++------- views/placeOrder.jade | 2 +- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/public/javascripts/main.js b/public/javascripts/main.js index 2ba3107..4150b34 100644 --- a/public/javascripts/main.js +++ b/public/javascripts/main.js @@ -13,17 +13,17 @@ $('.btn-danger').click(function(eventObject) { }); /** - * New Order page + * Place A New Order page */ -$('.btn-success').click(function(eventObject) { +$('.btn-success').click(function(e) { var items = []; - var orderType = $(eventObject.target).data('order-type') - var $quantityFields = $('.quantity'); + var orderType = $(e.target).data('order-type') + var $qty = $('.quantity'); - $.each($quantityFields, function(index, field) { + $.each($qty, function(index, input) { items.push({ - name: $(field).data('name'), - quantity: $(field).val() + name: $(input).data('name'), + quantity: $(input).val() }); }); diff --git a/views/placeOrder.jade b/views/placeOrder.jade index 037c637..2185e08 100644 --- a/views/placeOrder.jade +++ b/views/placeOrder.jade @@ -34,7 +34,7 @@ block content for item in items[orderType] tr td= item - td.col-xs-1 + td.col-xs-2 input.form-control.input-sm.quantity(type='text', value=0, data-name='#{item.name}') button.btn.btn-large.btn-success(data-order-type='#{orderType}')