Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
46 commits
Select commit Hold shift + click to select a range
8c82c0f
refactoring layout
Aug 4, 2014
00371f3
merging master into develop
Aug 4, 2014
ddd388c
transitioning to dev setup
Aug 4, 2014
0ec5f00
vertical modify display works
Aug 4, 2014
32c7ad5
coloring and modifying
Aug 5, 2014
6e03120
hierarchy works
Aug 6, 2014
63a134a
working on session editing
Aug 8, 2014
751e6e7
starting to comment
Feb 22, 2015
c522f2c
Merge branch 'master' into release
Feb 22, 2015
e560739
removing trash
May 12, 2015
19a82e6
major overhaul
May 12, 2015
e24b647
major refactoring
May 13, 2015
6080a76
index kinda works
May 14, 2015
3cc283c
changed everything
May 25, 2015
9e0c173
finally clientside
May 25, 2015
eb87310
renovating create
russellmays May 26, 2015
6428787
building views
russellmays May 27, 2015
190459e
building models in create
russellmays May 27, 2015
aac57f8
added marionette
russellmays May 30, 2015
99dcdfc
switching to composite view
russellmays Jun 1, 2015
984c2c5
lots of things work
russellmays Jun 2, 2015
ee22ea4
color focus works
russellmays Jun 2, 2015
9846ba0
nesting finally works
russellmays Jun 2, 2015
38c2e3f
save and child work
russellmays Jun 3, 2015
c5f10fb
save delete children work
russellmays Jun 3, 2015
9a48c89
hitting database
russellmays Jun 4, 2015
2e68ab0
push to database works
russellmays Jun 4, 2015
aff97c5
rolling along
russellmays Jun 5, 2015
f0340a4
got versioner working
russellmays Jun 5, 2015
6924694
changing api
russellmays Jun 9, 2015
177893b
removing node_modules
russellmays Jun 9, 2015
cf9ec9f
lots has changed
russellmays Jun 12, 2015
36b2c5a
nesting works
russellmays Jun 12, 2015
ee036f3
can add existing recipes
russellmays Jun 16, 2015
5d2d77e
downloads work
russellmays Jun 18, 2015
ea17f9c
getting post logic down
russellmays Jun 18, 2015
cee8379
post not working
russellmays Jun 19, 2015
4a4afd4
post works
russellmays Jun 26, 2015
5dfe75e
get nests properly
russellmays Jul 2, 2015
590123b
sorta works
russellmays Jul 2, 2015
ec8fde4
beautification
russellmays Jul 3, 2015
4174124
looking pretty
russellmays Jul 6, 2015
440f88a
fixed depth calls
russellmays Jul 7, 2015
5101277
messing with templates
russellmays Jul 17, 2015
0b87a8b
keeping everything for now
russellmays Jul 21, 2015
2b7247b
here we go
russellmays Jul 28, 2015
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
data
node_modules
*.swp
34 changes: 7 additions & 27 deletions app.js
Original file line number Diff line number Diff line change
@@ -1,21 +1,8 @@
var express = require('express');
var routes = require('./routes');
var http = require('http');
var path = require('path');

var mongoose = require('mongoose');
var mongoUri = process.env.MONGOLAB_URI || process.env.MONGOHQ_URL || 'mongodb://localhost/cellpack';
mongoose.connect(mongoUri);
var recipeSchema = mongoose.Schema({
recipeIdentifier: String,
recipeOptions: mongoose.Schema.Types.Mixed,
recipeChildren: []
}, {collection: 'recipes'});
var Recipe = mongoose.model('Recipe', recipeSchema);

var app = express();
var path = require('path');

app.set('port', process.env.PORT || 3000);
app.set('port', process.env.PORT || 8000);
app.set('views', path.join(__dirname, 'views'));
app.set('view engine', 'jade');
app.use(express.logger('dev'));
Expand All @@ -25,24 +12,17 @@ app.use(express.methodOverride());
app.use(app.router);
app.use(express.static(__dirname + '/public'));

// development only
if ('development' == app.get('env')) {
app.use(express.errorHandler());
}

app.get('/', routes.index(Recipe));
app.post('/versioner', routes.versioner(Recipe));

app.get('/modify', routes.modify(Recipe));
app.post('/hierarchy', routes.hierarchy(Recipe));
app.post('/tabler', routes.tabler(Recipe));
app.post('/commit', routes.commit(Recipe));
// mongoose connection
var mongoose = require('./mongoose');

app.get('/create', routes.create(Recipe));
app.post('/create', routes.createRecipe(Recipe));

app.post('/download', routes.downloadRecipe(Recipe));
// load routes
require('./routes')(app);

var http = require('http');
http.createServer(app).listen(app.get('port'), function(){
console.log('Express server listening on port ' + app.get('port'));
});
14 changes: 0 additions & 14 deletions json_parser.py

This file was deleted.

8 changes: 8 additions & 0 deletions models/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
// load models
Recipe = require("./recipe");

// export models and functions
exports.oid = Recipe.oid;
exports.RecipeModel = Recipe.RecipeModel;
exports.flattenRecipe = Recipe.flattenRecipe;
exports.nestRecipe = Recipe.nestRecipe;
94 changes: 94 additions & 0 deletions models/recipe.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,94 @@
var mongoose = require("mongoose");
exports.oid = mongoose.Types.ObjectId;

var recipeSchema = mongoose.Schema({
name: String,
version: Number,
current: Boolean,
option: String,
children: []
}, {collection: "recipes"});
exports.RecipeModel = mongoose.model("Recipe", recipeSchema);

function flattenRecipe(r) {
var innerFlatten = function(rec, result) {

var id = "";
if (rec["_id"]) {
id = rec["_id"];
} else {
id = rec["cid"];
}

var newName = rec["name"];
var newVersion = rec["version"];
var newCurrent = rec["current"];
var newOption = rec["option"];

var childArray = [];
for (var d = 0; d < rec["children"].length; d++) {
var childId = "";
if (rec["children"][d]["_id"]) {
childId = rec["children"][d]["_id"];
} else {
childId = rec["children"][d]["cid"];
}
childArray.push(childId);
}

var newRec = {name: newName, version: newVersion, option: newOption, children: childArray, _id: id, current: newCurrent};
result.push(newRec);
if (rec["children"].length > 0) {
for (var c = 0; c < rec["children"].length; c++) {
innerFlatten(rec["children"][c], result);
}
}
return result;
}
return innerFlatten(r, []);
}
exports.flattenRecipe = flattenRecipe;


function nestRecipe(ra) {
while (ra.length > 1) {
var inner = function () {
for (var z = (ra.length-1); z >= 0; z--) {
//console.log(ra);
if (ra[z]["children"].length < 1 || ra[z]["children"].every(function(ele, ind, arr) {return ("name" in ele);})) {
//console.log(ra[z]);
//console.log(ra[z]["_id"]);
for (var y = (ra.length-1); y >= 0; y--) {
//console.log(ra[z]["_id"]);
for (var x = 0; x < ra[y]["children"].length; x++) {
//console.log(ra);
//console.log(z);
//console.log(ra[z]);
if (ra[y]["children"][x].toString() == ra[z]["_id"]) {
var tRec = ra.splice(z, 1)[0];
var insertRec = {};
insertRec["_id"] = tRec["_id"];
insertRec["name"] = tRec["name"];
insertRec["version"] = tRec["version"];
insertRec["current"] = tRec["current"];
insertRec["option"] = tRec["option"];
insertRec["children"] = tRec["children"];
ra[y]["children"][x] = insertRec;
return;
}
}
}
}
}
}
inner();
}
var topRec = {};
topRec["_id"] = ra[0]["_id"];
topRec["name"] = ra[0]["name"];
topRec["version"] = ra[0]["version"];
topRec["option"] = ra[0]["option"];
topRec["children"] = ra[0]["children"];
return topRec;
}
exports.nestRecipe = nestRecipe;
3 changes: 3 additions & 0 deletions mongoose/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
var mongoose = require('mongoose');
var mongoUri = process.env.MONGOLAB_URI || process.env.MONGOHQ_URL || 'mongodb://localhost/cellpack';
mongoose.connect(mongoUri);
1 change: 0 additions & 1 deletion node_modules/.bin/express

This file was deleted.

1 change: 0 additions & 1 deletion node_modules/.bin/jade

This file was deleted.

9 changes: 0 additions & 9 deletions node_modules/express/.npmignore

This file was deleted.

4 changes: 0 additions & 4 deletions node_modules/express/.travis.yml

This file was deleted.

Loading