Skip to content

Commit

Permalink
Refactoring
Browse files Browse the repository at this point in the history
  • Loading branch information
sahat committed Dec 29, 2013
1 parent edde46e commit 0337b7f
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
14 changes: 7 additions & 7 deletions public/javascripts/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -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()
});
});

Expand Down
2 changes: 1 addition & 1 deletion views/placeOrder.jade
Original file line number Diff line number Diff line change
Expand Up @@ -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}')
Expand Down

0 comments on commit 0337b7f

Please sign in to comment.