Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
#388 deal better with new files which have a path in their names
  • Loading branch information
jstrachan committed Jul 12, 2013
1 parent 1f8e381 commit 38c4192
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions hawtio-web/src/main/webapp/app/wiki/js/view.ts
Expand Up @@ -138,15 +138,22 @@ module Wiki {
console.log("Created file " + name);
Wiki.onComplete(status);

// lets deal with directories in the name
var folder = $scope.pageId;
var fileName = name;
var idx = name.lastIndexOf("/");
if (idx > 0) {
folder += "/" + name.substring(0, idx);
name = name.substring(idx + 1);
}

// lets navigate to the edit link
// load the directory and find the child item
$scope.git = wikiRepository.getPage($scope.branch, $scope.pageId, $scope.objectId, (details) => {
$scope.git = wikiRepository.getPage($scope.branch, folder, $scope.objectId, (details) => {
// lets find the child entry so we can calculate its correct edit link
var link = null;
if (details && details.children) {
console.log("Requeried the directory " + details.children.length + " children");
var idx = name.lastIndexOf("/");
var fileName = (idx > 0) ? name.substring(idx + 1) : name;
var child = details.children.find(c => c.name === fileName);
if (child) {
link = $scope.childLink(child);
Expand Down

0 comments on commit 38c4192

Please sign in to comment.