Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Finished save new page

  • Loading branch information...
commit 26bb7d63cce761508c5a6db63b3f18ccecb7f21c 1 parent 5457772
@robrighter authored
Showing with 13 additions and 6 deletions.
  1. +11 −4 datastore.js
  2. +2 −2 index.js
View
15 datastore.js
@@ -217,18 +217,25 @@
var iter = function(result){
console.log('ITERATING with: ' + sys.inspect(result));
if(result.parentid == 0){
- if(path.length > 0){
+ if(path.length == 0){
//this is the first one, so the path is actually /
+ console.log('Current path: ' + sys.inspect(path));
+ console.log('RETURNING AS ROOT!!!!!');
callback('/');
}
else{
- callback(path.join('/'));
+ var toreturn = path.join('/');
+ console.log('About to return from getPathForItem: ' + path.join('/'));
+ callback(toreturn);
}
}
else{
//still not there yet so lets add the slug and move on
- path.push(result.slug);
- NodeCMSContentGraph.find({ __id: result.parentid }).first(iter);
+ path.unshift(result.slug);
+ console.log('Looking for parentid of: ' + result.parentid);
+ console.log('Current path: ' + sys.inspect(path));
+ console.log('Joined path = ' + path.join('/'));
+ NodeCMSContentGraph.findById(result.parentid).first(iter);
}
}
iter(item);
View
4 index.js
@@ -79,9 +79,9 @@
ds.addContentToSitemap(content, doc.__parentid, doc.__template, function(result){
if(result){
ds.getPathForItem(result, function(path){
- console.log('REDIRECTING TO: ' + '_admin/'+path);
+ console.log('REDIRECTING TO: ' + '/_admin/'+path);
req.flash('confirm', 'Success! The page has been saved.');
- res.redirect('_admin/' + path);
+ res.redirect('/_admin/' + path);
});
//res.send({status: true, newslug: result.slug});
}
Please sign in to comment.
Something went wrong with that request. Please try again.