diff --git a/src/Umbraco.Web.UI.Client/src/common/directives/components/media/umbmedianodeinfo.directive.js b/src/Umbraco.Web.UI.Client/src/common/directives/components/media/umbmedianodeinfo.directive.js index 1aa026cb3a..ae4c115bb9 100644 --- a/src/Umbraco.Web.UI.Client/src/common/directives/components/media/umbmedianodeinfo.directive.js +++ b/src/Umbraco.Web.UI.Client/src/common/directives/components/media/umbmedianodeinfo.directive.js @@ -11,8 +11,8 @@ scope.allowOpenMediaType = true; // get document type details scope.mediaType = scope.node.contentType; - // get node url - scope.nodeUrl = scope.node.mediaLink; + // set the media link initially + setMediaLink(); // make sure dates are formatted to the user's locale formatDatesToLocal(); } @@ -25,16 +25,25 @@ }); } + function setMediaLink(){ + scope.nodeUrl = scope.node.mediaLink; + } + scope.openMediaType = function (mediaType) { // remove first "#" from url if it is prefixed else the path won't work var url = "/settings/mediaTypes/edit/" + mediaType.id; $location.path(url); }; - + // watch for content updates - reload content when node is saved, published etc. scope.$watch('node.updateDate', function(newValue, oldValue){ if(!newValue) { return; } if(newValue === oldValue) { return; } + + // Update the media link + setMediaLink(); + + // Update the create and update dates formatDatesToLocal(); }); @@ -46,7 +55,6 @@ }); onInit(); - } var directive = { @@ -64,4 +72,4 @@ angular.module('umbraco.directives').directive('umbMediaNodeInfo', MediaNodeInfoDirective); -})(); \ No newline at end of file +})();