Use the media file name as display name in the file link

This commit is contained in:
Kenn Jacobsen
2019-01-24 11:48:39 +01:00
committed by Sebastiaan Janssen
parent 8d2c1332d3
commit 32f228fa7c
2 changed files with 9 additions and 2 deletions

View File

@@ -40,6 +40,13 @@
function setMediaLink(){
scope.nodeUrl = scope.node.mediaLink;
// grab the file name from the URL and use it as the display name in the file link
var match = /.*\/(.*)/.exec(scope.nodeUrl);
if (match) {
scope.nodeFileName = match[1];
} else {
scope.nodeFileName = scope.nodeUrl;
}
}
scope.openMediaType = function (mediaType) {
@@ -92,4 +99,4 @@
angular.module('umbraco.directives').directive('umbMediaNodeInfo', MediaNodeInfoDirective);
})();
})();

View File

@@ -14,7 +14,7 @@
<li>
<a href="{{nodeUrl}}" target="_blank">
<i class="icon icon-out"></i>
<span>{{nodeUrl}}</span>
<span>{{nodeFileName}}</span>
</a>
</li>
</ul>