Skip to content

Commit

Permalink
hide the .profile extension from the breadcrumbs in the wiki too #518
Browse files Browse the repository at this point in the history
  • Loading branch information
jstrachan committed Sep 12, 2013
1 parent 28bcafb commit 4cdad58
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 8 deletions.
14 changes: 14 additions & 0 deletions hawtio-web/src/main/webapp/app/wiki/js/helpers.ts
Expand Up @@ -218,6 +218,20 @@ module Wiki {
return "";
}

/**
* Returns the file name for the given name; we hide some extensions
*/
export function hideFineNameExtensions(name) {
if (name) {
angular.forEach(Wiki.hideExtentions, (extension) => {
if (name.endsWith(extension)) {
name = name.substring(0, name.length - extension.length);
}
});
}
return name;
}

export function fileIconHtml(row) {
var css = null;
var icon = null;
Expand Down
5 changes: 4 additions & 1 deletion hawtio-web/src/main/webapp/app/wiki/js/navbar.ts
Expand Up @@ -66,9 +66,12 @@ module Wiki {
}
});
// lets swizzle the last one or two to be formTable views if the last or 2nd to last

var loc = $location.path();
if ($scope.breadcrumbs.length) {
var last = $scope.breadcrumbs[$scope.breadcrumbs.length - 1];
// possibly trim any required file extensions
last.name = Wiki.hideFineNameExtensions(last.name);

var swizzled = false;
angular.forEach(Wiki.customViewLinks, (link) => {
if (!swizzled && loc.startsWith(link)) {
Expand Down
8 changes: 1 addition & 7 deletions hawtio-web/src/main/webapp/app/wiki/js/view.ts
Expand Up @@ -97,13 +97,7 @@ module Wiki {
};

$scope.fileName = (entity) => {
var name = entity.name;
angular.forEach(Wiki.hideExtentions, (extension) => {
if (name.endsWith(extension)) {
name = name.substring(0, name.length - extension.length);
}
});
return name;
return Wiki.hideFineNameExtensions(entity.name);
};

$scope.fileIconHtml = (entity) => {
Expand Down

0 comments on commit 4cdad58

Please sign in to comment.