Skip to content

Commit

Permalink
fix bad create link on formTable view
Browse files Browse the repository at this point in the history
  • Loading branch information
jstrachan committed Mar 26, 2013
1 parent ef09723 commit ca6fb7b
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
6 changes: 3 additions & 3 deletions hawtio-web/src/main/webapp/app/wiki/js/helpers.ts
Expand Up @@ -33,18 +33,18 @@ module Wiki {
}

export function createLink(pageId:string, $location, $scope) {
var path = $location.path();
var link = null;
if (pageId) {
link = "#/wiki/create/" + pageId;
} else {
// lets use the current path
var path = $location.path();
link = "#" + path.replace(/(view|edit)/, "create");
link = "#" + path.replace(/(view|edit|formTable)/, "create");
}
// we have the link so lets now remove the last path
// or if there is no / in the path then remove the last section
var idx = link.lastIndexOf("/");
if (idx > 0 && !$scope.children) {
if (idx > 0 && !$scope.children && !path.startsWith("/wiki/formTable")) {
link = link.substring(0, idx + 1);
}
return link;
Expand Down
5 changes: 4 additions & 1 deletion hawtio-web/src/main/webapp/app/wiki/js/navbar.ts
@@ -1,7 +1,10 @@
module Wiki {
export function NavBarController($scope, $location, $routeParams, workspace:Workspace, wikiRepository:GitWikiRepository) {

$scope.createLink = () => Wiki.createLink(Wiki.pageId($routeParams, $location), $location, $scope);
$scope.createLink = () => {
var pageId = Wiki.pageId($routeParams, $location);
return Wiki.createLink(pageId, $location, $scope);
};

$scope.sourceLink = () => {
var path = $location.path();
Expand Down

0 comments on commit ca6fb7b

Please sign in to comment.