Skip to content

Commit

Permalink
Fixed adding pump issue
Browse files Browse the repository at this point in the history
  • Loading branch information
Yu Jiang Tham committed Jun 3, 2014
1 parent 6c7ea54 commit a1caf96
Show file tree
Hide file tree
Showing 7 changed files with 72 additions and 8 deletions.
5 changes: 4 additions & 1 deletion README.md
Expand Up @@ -22,7 +22,10 @@ Usage

The app connects to your local mongo database on startup. You should have mongo running first, or it will throw an error. The web interface is located at http://localhost:3000 (or if you are connecting via a different device, you can point that device to http://x.x.x.x:3000, the IP address of the machine that the node.js app is running on).

Pump controls are accessed in the top-right corner by clicking the PUMP button. You can add pumps and select ingredients for each of those pumps.
You'll likely want to import example drinks collection that I made. It doesn't contain drinks for all combos, but it'll have a few examples. You can add more by following the information at the bottom of this section. Import the drinks collection with this command:
mongoimport --db barmixvah --collection drinks --file drinks.json

Pump controls are accessed in the top-right corner by clicking the PUMP button. You can add/remove pumps with the (+) and (-) buttons and select ingredients for each of those pumps as they appear in the center of the screen.

Drinks can be added by pointing your browser to localhost:3000/add, and can be edited at localhost:3000/edit. Drink images can be added to /public/image/drinks/.

Expand Down
15 changes: 14 additions & 1 deletion app.js
Expand Up @@ -11,7 +11,7 @@ var add = require('./routes/add');
var edit = require('./routes/edit');

var mongoose = require('mongoose');
var db = mongoose.createConnection('localhost', 'bartagnan');
var db = mongoose.createConnection('localhost', 'barmixvah');

var DrinkSchema = require('./models/Drink.js').DrinkSchema;
var Drink = db.model('drinks', DrinkSchema);
Expand Down Expand Up @@ -71,6 +71,19 @@ io.sockets.on('connection', function (socket) {
});
});


db.once('open', function () {
Pump.findOne({}, function (err, pump) {
if (pump == null) {
var pumps = {
label: "pumps",
ingredients: [ { label: "pump0", ingredient: "" } ]
};
Pump.create(pumps);
}
});
});

/// error handlers

// development error handler
Expand Down
38 changes: 38 additions & 0 deletions drinks.json
@@ -0,0 +1,38 @@
{ "name" : "Adios Motherfucker", "image" : "amf.jpg", "_id" : { "$oid" : "5358b436e421851b34d8e374" }, "ingredients" : [ { "name" : "Vodka", "amount" : 0.5, "_id" : { "$oid" : "5358b436e421851b34d8e37b" } }, { "name" : "Rum", "amount" : 0.5, "_id" : { "$oid" : "5358b436e421851b34d8e37a" } }, { "name" : "Tequila", "amount" : 0.5, "_id" : { "$oid" : "5358b436e421851b34d8e379" } }, { "name" : "Gin", "amount" : 0.5, "_id" : { "$oid" : "5358b436e421851b34d8e378" } }, { "name" : "Blue Liqueur", "amount" : 0.5, "_id" : { "$oid" : "5358b436e421851b34d8e377" } }, { "name" : "Sweet & Sour", "amount" : 2, "_id" : { "$oid" : "5358b436e421851b34d8e376" } }, { "name" : "Sprite", "amount" : 2, "_id" : { "$oid" : "5358b436e421851b34d8e375" } } ], "__v" : 0 }
{ "name" : "Long Island Iced Tea", "image" : "longisland.jpg", "_id" : { "$oid" : "5358d10268b5fccf36690173" }, "ingredients" : [ { "name" : "Vodka", "amount" : 1, "_id" : { "$oid" : "5358d10268b5fccf3669017a" } }, { "name" : "Tequila", "amount" : 1, "_id" : { "$oid" : "5358d10268b5fccf36690179" } }, { "name" : "Rum", "amount" : 1, "_id" : { "$oid" : "5358d10268b5fccf36690178" } }, { "name" : "Gin", "amount" : 1, "_id" : { "$oid" : "5358d10268b5fccf36690177" } }, { "name" : "Triple Sec", "amount" : 1, "_id" : { "$oid" : "5358d10268b5fccf36690176" } }, { "name" : "Sweet & Sour", "amount" : 1.5, "_id" : { "$oid" : "5358d10268b5fccf36690175" } }, { "name" : "Coke", "amount" : 1, "_id" : { "$oid" : "5358d10268b5fccf36690174" } } ], "__v" : 0 }
{ "name" : "Rum and Coke", "image" : "rumandcoke.jpg", "_id" : { "$oid" : "53595a9ab707637438d900fc" }, "ingredients" : [ { "name" : "Rum", "amount" : 1, "_id" : { "$oid" : "53595a9ab707637438d900fe" } }, { "name" : "Coke", "amount" : 3, "_id" : { "$oid" : "53595a9ab707637438d900fd" } } ], "__v" : 0 }
{ "name" : "Vodka Sprite", "image" : "vodkasprite.jpg", "_id" : { "$oid" : "53595aebb707637438d900ff" }, "ingredients" : [ { "name" : "Vodka", "amount" : 1, "_id" : { "$oid" : "53595aebb707637438d90101" } }, { "name" : "Sprite", "amount" : 3, "_id" : { "$oid" : "53595aebb707637438d90100" } } ], "__v" : 0 }
{ "name" : "Whiskey Ginger", "image" : "jamesonginger.jpg", "_id" : { "$oid" : "535984984ff0defd3b531206" }, "ingredients" : [ { "name" : "Whiskey", "amount" : 1, "_id" : { "$oid" : "535984984ff0defd3b531208" } }, { "name" : "Ginger Ale", "amount" : 3, "_id" : { "$oid" : "535984984ff0defd3b531207" } } ], "__v" : 0 }
{ "name" : "Colorado Bulldog", "image" : "coloradobulldog.jpg", "_id" : { "$oid" : "5359854c7fcea2f53d4b619a" }, "ingredients" : [ { "name" : "Vodka", "amount" : 1, "_id" : { "$oid" : "5359854c7fcea2f53d4b619d" } }, { "name" : "Kaluha", "amount" : 1, "_id" : { "$oid" : "5359854c7fcea2f53d4b619c" } }, { "name" : "Coke", "amount" : 0.1, "_id" : { "$oid" : "5359854c7fcea2f53d4b619b" } } ], "__v" : 0 }
{ "name" : "Sex on the Beach", "image" : "sexonthebeach.jpg", "_id" : { "$oid" : "535985d34bcedd163e7a1549" }, "ingredients" : [ { "name" : "Vodka", "amount" : 1.5, "_id" : { "$oid" : "535985d34bcedd163e7a154d" } }, { "name" : "Peach Schnapps", "amount" : 0.5, "_id" : { "$oid" : "535985d34bcedd163e7a154c" } }, { "name" : "Cranberry Juice", "amount" : 2, "_id" : { "$oid" : "535985d34bcedd163e7a154b" } }, { "name" : "Orange Juice", "amount" : 2, "_id" : { "$oid" : "535985d34bcedd163e7a154a" } } ], "__v" : 0 }
{ "name" : "Tokyo Tea", "image" : "tokyotea.jpg", "_id" : { "$oid" : "535986d4e8e8db463ea08e78" }, "ingredients" : [ { "name" : "Vodka", "amount" : 0.5, "_id" : { "$oid" : "535986d4e8e8db463ea08e7e" } }, { "name" : "Rum", "amount" : 0.5, "_id" : { "$oid" : "535986d4e8e8db463ea08e7d" } }, { "name" : "Gin", "amount" : 0.5, "_id" : { "$oid" : "535986d4e8e8db463ea08e7c" } }, { "name" : "Tequila", "amount" : 0.5, "_id" : { "$oid" : "535986d4e8e8db463ea08e7b" } }, { "name" : "Triple Sec", "amount" : 0.5, "_id" : { "$oid" : "535986d4e8e8db463ea08e7a" } }, { "name" : "Midori Melon", "amount" : 1, "_id" : { "$oid" : "535986d4e8e8db463ea08e79" } } ], "__v" : 0 }
{ "name" : "Cranberry Mojito", "image" : "cranberrymojito.jpg", "_id" : { "$oid" : "535987f7e8e8db463ea08e7f" }, "ingredients" : [ { "name" : "Rum", "amount" : 0.2, "_id" : { "$oid" : "535987f7e8e8db463ea08e82" } }, { "name" : "Cranberry Juice", "amount" : 0.5, "_id" : { "$oid" : "535987f7e8e8db463ea08e81" } }, { "name" : "Sprite", "amount" : 0.5, "_id" : { "$oid" : "535987f7e8e8db463ea08e80" } } ], "__v" : 0 }
{ "name" : "Cranberry Rum Punch", "image" : "cranberryrumpunch.jpg", "_id" : { "$oid" : "535989d4e8e8db463ea08e83" }, "ingredients" : [ { "name" : "Cranberry Juice", "amount" : 1, "_id" : { "$oid" : "535989d4e8e8db463ea08e86" } }, { "name" : "Rum", "amount" : 0.5, "_id" : { "$oid" : "535989d4e8e8db463ea08e85" } }, { "name" : "Ginger Ale", "amount" : 0.5, "_id" : { "$oid" : "535989d4e8e8db463ea08e84" } } ], "__v" : 0 }
{ "name" : "Main Squeeze", "image" : "stolimainsqueeze.jpg", "_id" : { "$oid" : "5359e19f8a866721467170f1" }, "ingredients" : [ { "name" : "Vodka", "amount" : 1.5, "_id" : { "$oid" : "5359e19f8a866721467170f5" } }, { "name" : "Triple Sec", "amount" : 0.5, "_id" : { "$oid" : "5359e19f8a866721467170f4" } }, { "name" : "Orange Juice", "amount" : 2, "_id" : { "$oid" : "5359e19f8a866721467170f3" } }, { "name" : "Sprite", "amount" : 0.25, "_id" : { "$oid" : "5359e19f8a866721467170f2" } } ], "__v" : 0 }
{ "name" : "Cranberry Vodka Martini", "image" : "cranberryvodkamartini.jpg", "_id" : { "$oid" : "5359e5cee06495a746c7f760" }, "ingredients" : [ { "name" : "Cranberry Juice", "amount" : 2.5, "_id" : { "$oid" : "5359e5cee06495a746c7f763" } }, { "name" : "Vodka", "amount" : 1.5, "_id" : { "$oid" : "5359e5cee06495a746c7f762" } }, { "name" : "Triple Sec", "amount" : 0.5, "_id" : { "$oid" : "5359e5cee06495a746c7f761" } } ], "__v" : 0 }
{ "name" : "Screwrita", "image" : "screwrita.jpg", "_id" : { "$oid" : "5359e9833cdca9f3463e6925" }, "ingredients" : [ { "name" : "Orange Juice", "amount" : 1.2, "_id" : { "$oid" : "5359e9833cdca9f3463e6928" } }, { "name" : "Tequila", "amount" : 0.3, "_id" : { "$oid" : "5359e9833cdca9f3463e6927" } }, { "name" : "Triple Sec", "amount" : 0.15, "_id" : { "$oid" : "5359e9833cdca9f3463e6926" } } ], "__v" : 0 }
{ "name" : "Screwdriver", "image" : "screwdriver.jpg", "_id" : { "$oid" : "536a51437c74403f2b626e13" }, "ingredients" : [ { "name" : "Vodka", "amount" : 1.5, "_id" : { "$oid" : "536a51437c74403f2b626e15" } }, { "name" : "Orange Juice", "amount" : 6, "_id" : { "$oid" : "536a51437c74403f2b626e14" } } ], "__v" : 0 }
{ "name" : "Madras", "image" : "madras.jpg", "_id" : { "$oid" : "536a52f17c74403f2b626e16" }, "ingredients" : [ { "name" : "Vodka", "amount" : 2, "_id" : { "$oid" : "536a52f17c74403f2b626e19" } }, { "name" : "Cranberry Juice", "amount" : 3, "_id" : { "$oid" : "536a52f17c74403f2b626e18" } }, { "name" : "Orange Juice", "amount" : 1, "_id" : { "$oid" : "536a52f17c74403f2b626e17" } } ], "__v" : 0 }
{ "name" : "Bay Breeze", "image" : "baybreeze.jpg", "_id" : { "$oid" : "536a54127c74403f2b626e1a" }, "ingredients" : [ { "name" : "Vodka", "amount" : 1, "_id" : { "$oid" : "536a54127c74403f2b626e1d" } }, { "name" : "Pineapple Juice", "amount" : 1, "_id" : { "$oid" : "536a54127c74403f2b626e1c" } }, { "name" : "Cranberry Juice", "amount" : 1, "_id" : { "$oid" : "536a54127c74403f2b626e1b" } } ], "__v" : 0 }
{ "name" : "Vodka Cranberry", "image" : "vodkacranberry.jpg", "_id" : { "$oid" : "536a54817c74403f2b626e1e" }, "ingredients" : [ { "name" : "Vodka", "amount" : 1, "_id" : { "$oid" : "536a54817c74403f2b626e20" } }, { "name" : "Cranberry Juice", "amount" : 2, "_id" : { "$oid" : "536a54817c74403f2b626e1f" } } ], "__v" : 0 }
{ "name" : "Mimosa", "image" : "mimosa.jpg", "_id" : { "$oid" : "536a55a9896b14dd2b45196d" }, "ingredients" : [ { "name" : "Champagne", "amount" : 3, "_id" : { "$oid" : "536a55a9896b14dd2b45196f" } }, { "name" : "Orange Juice", "amount" : 1, "_id" : { "$oid" : "536a55a9896b14dd2b45196e" } } ], "__v" : 0 }
{ "__v" : 0, "_id" : { "$oid" : "536a5654896b14dd2b451970" }, "image" : "saketini.jpg", "ingredients" : [ { "name" : "Gin", "amount" : 6, "_id" : { "$oid" : "536a5654896b14dd2b451972" } }, { "name" : "Sake", "amount" : 1, "_id" : { "$oid" : "536a5654896b14dd2b451971" } } ], "name" : "Saketini" }
{ "__v" : 0, "_id" : { "$oid" : "536a56eb896b14dd2b451973" }, "image" : "sakini.jpg", "ingredients" : [ { "name" : "Vodka", "amount" : 3, "_id" : { "$oid" : "536a56eb896b14dd2b451975" } }, { "name" : "Sake", "amount" : 1, "_id" : { "$oid" : "536a56eb896b14dd2b451974" } } ], "name" : "Sakini" }
{ "name" : "Texas Tea", "image" : "texastea.png", "_id" : { "$oid" : "536bacb79adbafa004a5164b" }, "ingredients" : [ { "name" : "Vodka", "amount" : 0.5, "_id" : { "$oid" : "536bacb79adbafa004a5164f" } }, { "name" : "Rum", "amount" : 0.5, "_id" : { "$oid" : "536bacb79adbafa004a5164e" } }, { "name" : "Tequila", "amount" : 1, "_id" : { "$oid" : "536bacb79adbafa004a5164d" } }, { "name" : "Coke", "amount" : 0.5, "_id" : { "$oid" : "536bacb79adbafa004a5164c" } } ], "__v" : 0 }
{ "name" : "Robinson Crusoe", "image" : "robinson.jpg", "_id" : { "$oid" : "536badf09adbafa004a51650" }, "ingredients" : [ { "name" : "Rum", "amount" : 1, "_id" : { "$oid" : "536badf09adbafa004a51652" } }, { "name" : "Pineapple Juice", "amount" : 1, "_id" : { "$oid" : "536badf09adbafa004a51651" } } ], "__v" : 0 }
{ "name" : "Manguito Rico", "image" : "manguito.jpg", "_id" : { "$oid" : "536c2620129acd9811e096e4" }, "ingredients" : [ { "name" : "Vodka", "amount" : 2, "_id" : { "$oid" : "536c2620129acd9811e096e7" } }, { "name" : "Mango Juice", "amount" : 4, "_id" : { "$oid" : "536c2620129acd9811e096e6" } }, { "name" : "Triple Sec", "amount" : 1, "_id" : { "$oid" : "536c2620129acd9811e096e5" } } ], "__v" : 0 }
{ "name" : "Palm Beach", "image" : "palmbeach.jpg", "_id" : { "$oid" : "536c26be129acd9811e096e8" }, "ingredients" : [ { "name" : "Rum", "amount" : 1, "_id" : { "$oid" : "536c26be129acd9811e096eb" } }, { "name" : "Gin", "amount" : 1, "_id" : { "$oid" : "536c26be129acd9811e096ea" } }, { "name" : "Pineapple Juice", "amount" : 1, "_id" : { "$oid" : "536c26be129acd9811e096e9" } } ], "__v" : 0 }
{ "name" : "Matador", "image" : "matador.jpg", "_id" : { "$oid" : "536c2711129acd9811e096ec" }, "ingredients" : [ { "name" : "Tequila", "amount" : 3, "_id" : { "$oid" : "536c2711129acd9811e096ee" } }, { "name" : "Pineapple Juice", "amount" : 4, "_id" : { "$oid" : "536c2711129acd9811e096ed" } } ], "__v" : 0 }
{ "name" : "Waikiki Beachcomber", "image" : "waikiki.jpg", "_id" : { "$oid" : "536c27b6129acd9811e096ef" }, "ingredients" : [ { "name" : "Gin", "amount" : 2, "_id" : { "$oid" : "536c27b6129acd9811e096f2" } }, { "name" : "Triple Sec", "amount" : 2, "_id" : { "$oid" : "536c27b6129acd9811e096f1" } }, { "name" : "Pineapple Juice", "amount" : 1, "_id" : { "$oid" : "536c27b6129acd9811e096f0" } } ], "__v" : 0 }
{ "name" : "Trotsky", "image" : "trotsky.jpg", "_id" : { "$oid" : "536c283d129acd9811e096f3" }, "ingredients" : [ { "name" : "Tequila", "amount" : 3, "_id" : { "$oid" : "536c283d129acd9811e096f6" } }, { "name" : "Cranberry Juice", "amount" : 1, "_id" : { "$oid" : "536c283d129acd9811e096f5" } }, { "name" : "Triple Sec", "amount" : 0.25, "_id" : { "$oid" : "536c283d129acd9811e096f4" } } ], "__v" : 0 }
{ "name" : "Hawaiian Cocktail", "image" : "hawaiiancocktail.jpg", "_id" : { "$oid" : "536c2886129acd9811e096f7" }, "ingredients" : [ { "name" : "Gin", "amount" : 4, "_id" : { "$oid" : "536c2886129acd9811e096fa" } }, { "name" : "Pineapple Juice", "amount" : 1, "_id" : { "$oid" : "536c2886129acd9811e096f9" } }, { "name" : "Triple Sec", "amount" : 1, "_id" : { "$oid" : "536c2886129acd9811e096f8" } } ], "__v" : 0 }
{ "name" : "Cooler Than You Think", "image" : "coolerthanyouthink.jpg", "_id" : { "$oid" : "536c391a4306bf0b12de0d01" }, "ingredients" : [ { "name" : "Vodka", "amount" : 1, "_id" : { "$oid" : "536c391a4306bf0b12de0d05" } }, { "name" : "Gin", "amount" : 1, "_id" : { "$oid" : "536c391a4306bf0b12de0d04" } }, { "name" : "Cranberry Juice", "amount" : 4, "_id" : { "$oid" : "536c391a4306bf0b12de0d03" } }, { "name" : "Grapefruit Juice", "amount" : 2, "_id" : { "$oid" : "536c391a4306bf0b12de0d02" } } ], "__v" : 0 }
{ "__v" : 0, "_id" : { "$oid" : "536c39904306bf0b12de0d06" }, "image" : "brassyblond.jpg", "ingredients" : [ { "name" : "Vodka", "amount" : 2, "_id" : { "$oid" : "536c39904306bf0b12de0d09" } }, { "name" : "Pineapple Juice", "amount" : 2, "_id" : { "$oid" : "536c39904306bf0b12de0d08" } }, { "name" : "Triple Sec", "amount" : 0.25, "_id" : { "$oid" : "536c39904306bf0b12de0d07" } } ], "name" : "Brassy Blond" }
{ "name" : "Iguana", "image" : "iguana.jpg", "_id" : { "$oid" : "536c3a0e4306bf0b12de0d0a" }, "ingredients" : [ { "name" : "Vodka", "amount" : 2, "_id" : { "$oid" : "536c3a0e4306bf0b12de0d0d" } }, { "name" : "Tequila", "amount" : 1, "_id" : { "$oid" : "536c3a0e4306bf0b12de0d0c" } }, { "name" : "Kaluha", "amount" : 1, "_id" : { "$oid" : "536c3a0e4306bf0b12de0d0b" } } ], "__v" : 0 }
{ "name" : "Brave Bull", "image" : "bravebull.jpg", "_id" : { "$oid" : "536c3a774306bf0b12de0d0e" }, "ingredients" : [ { "name" : "Tequila", "amount" : 2, "_id" : { "$oid" : "536c3a774306bf0b12de0d10" } }, { "name" : "Kaluha", "amount" : 1, "_id" : { "$oid" : "536c3a774306bf0b12de0d0f" } } ], "__v" : 0 }
{ "name" : "Siesta", "image" : "siesta.jpg", "_id" : { "$oid" : "536c3aa54306bf0b12de0d11" }, "ingredients" : [ { "name" : "Gin", "amount" : 1, "_id" : { "$oid" : "536c3aa54306bf0b12de0d13" } }, { "name" : "Kaluha", "amount" : 1, "_id" : { "$oid" : "536c3aa54306bf0b12de0d12" } } ], "__v" : 0 }
{ "name" : "Caribbean Bliss", "image" : "caribbeanbliss.jpg", "_id" : { "$oid" : "5376d244e8e271e536d26510" }, "ingredients" : [ { "name" : "Vodka", "amount" : 1, "_id" : { "$oid" : "5376d244e8e271e536d26513" } }, { "name" : "Tequila", "amount" : 1, "_id" : { "$oid" : "5376d244e8e271e536d26512" } }, { "name" : "Orange Juice", "amount" : 4, "_id" : { "$oid" : "5376d244e8e271e536d26511" } } ], "__v" : 0 }
{ "name" : "Barucca Tease", "image" : "baruccatease.jpg", "_id" : { "$oid" : "5376d2d4e8e271e536d26514" }, "ingredients" : [ { "name" : "Vodka", "amount" : 1, "_id" : { "$oid" : "5376d2d4e8e271e536d26517" } }, { "name" : "Triple Sec", "amount" : 1, "_id" : { "$oid" : "5376d2d4e8e271e536d26516" } }, { "name" : "Orange Juice", "amount" : 4, "_id" : { "$oid" : "5376d2d4e8e271e536d26515" } } ], "__v" : 0 }
{ "name" : "Cosmopolitan", "image" : "cosmo.jpg", "_id" : { "$oid" : "53778acce8e271e536d26518" }, "ingredients" : [ { "name" : "Vodka", "amount" : 1.5, "_id" : { "$oid" : "53778acce8e271e536d2651c" } }, { "name" : "Triple Sec", "amount" : 0.5, "_id" : { "$oid" : "53778acce8e271e536d2651b" } }, { "name" : "Cranberry Juice", "amount" : 0.75, "_id" : { "$oid" : "53778acce8e271e536d2651a" } }, { "name" : "Lime Juice", "amount" : 0.5, "_id" : { "$oid" : "53778acce8e271e536d26519" } } ], "__v" : 0 }
{ "name" : "Margarita", "image" : "margarita.jpg", "_id" : { "$oid" : "53778c7ee8e271e536d2651d" }, "ingredients" : [ { "name" : "Tequila", "amount" : 3, "_id" : { "$oid" : "53778c7ee8e271e536d26520" } }, { "name" : "Lime Juice", "amount" : 1.5, "_id" : { "$oid" : "53778c7ee8e271e536d2651f" } }, { "name" : "Triple Sec", "amount" : 1, "_id" : { "$oid" : "53778c7ee8e271e536d2651e" } } ], "__v" : 0 }
{ "name" : "Eater", "image" : "eater.jpg", "_id" : { "$oid" : "53778d9ee8e271e536d26521" }, "ingredients" : [ { "name" : "Vodka", "amount" : 0.3, "_id" : { "$oid" : "53778d9ee8e271e536d26526" } }, { "name" : "Tequila", "amount" : 1, "_id" : { "$oid" : "53778d9ee8e271e536d26525" } }, { "name" : "Orange Juice", "amount" : 1, "_id" : { "$oid" : "53778d9ee8e271e536d26524" } }, { "name" : "Cranberry Juice", "amount" : 1, "_id" : { "$oid" : "53778d9ee8e271e536d26523" } }, { "name" : "Triple Sec", "amount" : 1, "_id" : { "$oid" : "53778d9ee8e271e536d26522" } } ], "__v" : 0 }
12 changes: 10 additions & 2 deletions public/javascripts/controllers/DrinkController.js
Expand Up @@ -39,20 +39,28 @@ function DrinkController($scope, $http) {
$scope.drinks = drinks;
};

$scope.initializePumps = function () {
console.log('ran');
$http.post('/initializePumps').success(function (data) {
console.log(data);
return data;
});
};

$scope.setPumps = function (pumps) {
$scope.pumps = pumps[0];
};

$scope.getPumps = function () {
$http.get('/pumps.json').success(function (data) {
$http.get('/pump.json').success(function (data) {
console.log(data);
return data;
});
};

$scope.addPump = function () {
var index = 0;
if (typeof $scope.pumps.label === 'undefined') {
if (typeof $scope.pumps === 'undefined') {
$scope.pumps = {
label: "pumps",
ingredients: [ { label: "pump0", ingredient: "" } ]
Expand Down
2 changes: 2 additions & 0 deletions public/javascripts/robot/frontend.js
Expand Up @@ -71,11 +71,13 @@ $(document).ready(function () {
if (pumpControlsVisible) {
pumpControlsVisible = false;
$('#hiddenPumpControls').hide();
$('#plusMinus').hide();
$(this).text("PUMP");
$(this).removeClass("active");
} else {
pumpControlsVisible = true;
$('#hiddenPumpControls').show();
$('#plusMinus').show();
$(this).text("x");
$(this).addClass("active");
}
Expand Down
3 changes: 3 additions & 0 deletions routes/index.js
Expand Up @@ -23,9 +23,12 @@ exports.updatePump = function (Pump) {
console.log(pump);
console.log('====');
console.log(err);
console.log('request body');
console.log(req.body);
if (pump == null) {
Pump.create(req.body);
pump = req.body;
console.log('pump eq null');
}
res.send(pump);
});
Expand Down
5 changes: 1 addition & 4 deletions views/index.jade
Expand Up @@ -8,10 +8,7 @@ block head
script(type='text/javascript', src='/javascripts/robot/frontend.js')

block content
div#fullWidth(ng-controller="DrinkController", ng-init="setDrinks( #{JSON.stringify(drinks)} ); setPumps( #{JSON.stringify(pumps)} ); writeNumDuplicates()")
//-div#launcher
div#selectedDrink(style="background-image: url('/images/drinks/{{selectedDrink.image || \'no_image.jpg\'}}')") {{selectedDrink.name || "Select a Drink"}}
div#fullWidth(ng-controller="DrinkController", ng-init="setDrinks( #{JSON.stringify(drinks)} ); setPumps( #{JSON.stringify(pumps)} ); writeNumDuplicates()")
div#drinkScope.container-fluid
div#cover
h1.title Bar Mixvah
Expand Down

0 comments on commit a1caf96

Please sign in to comment.