diff --git a/src/Umbraco.Web.UI.Client/src/views/prevalueeditors/mediapicker.controller.js b/src/Umbraco.Web.UI.Client/src/views/prevalueeditors/mediapicker.controller.js index e5c09f420e..95b2c64a6f 100644 --- a/src/Umbraco.Web.UI.Client/src/views/prevalueeditors/mediapicker.controller.js +++ b/src/Umbraco.Web.UI.Client/src/views/prevalueeditors/mediapicker.controller.js @@ -9,6 +9,10 @@ function mediaPickerController($scope, dialogService, entityResource, $log, icon $scope.renderModel = []; + $scope.allowRemove = true; + $scope.allowEdit = true; + $scope.sortable = false; + var dialogOptions = { multiPicker: false, entityType: "Media", @@ -49,8 +53,7 @@ function mediaPickerController($scope, dialogService, entityResource, $log, icon }; } - $scope.remove =function(index, event){ - event.preventDefault(); + $scope.remove =function(index){ $scope.renderModel.splice(index, 1); }; @@ -66,8 +69,17 @@ function mediaPickerController($scope, dialogService, entityResource, $log, icon return dialogOptions.idType === "udi" ? i.udi : i.id; }); if (currIds.indexOf(itemId) < 0) { + item.icon = iconHelper.convertFromLegacyIcon(item.icon); $scope.renderModel.push({ name: item.name, id: item.id, icon: item.icon, udi: item.udi }); + + // store the index of the new item in the renderModel collection so we can find it again + var itemRenderIndex = $scope.renderModel.length - 1; + // get and update the path for the picked node + entityResource.getUrl(item.id, dialogOptions.entityType).then(function(data){ + $scope.renderModel[itemRenderIndex].path = data; + }); + } }; @@ -88,13 +100,21 @@ function mediaPickerController($scope, dialogService, entityResource, $log, icon if (modelIds.length > 0) { entityResource.getByIds(modelIds, dialogOptions.entityType).then(function (data) { _.each(data, function (item, i) { + item.icon = iconHelper.convertFromLegacyIcon(item.icon); - $scope.renderModel.push({ name: item.name, id: item.id, icon: item.icon, udi: item.udi }); + $scope.renderModel.push({ name: item.name, id: item.id, icon: item.icon, udi: item.udi }); + + // store the index of the new item in the renderModel collection so we can find it again + var itemRenderIndex = $scope.renderModel.length - 1; + // get and update the path for the picked node + entityResource.getUrl(item.id, dialogOptions.entityType).then(function(data){ + $scope.renderModel[itemRenderIndex].path = data; + }); + }); }); } - - + } angular.module('umbraco').controller("Umbraco.PrevalueEditors.MediaPickerController",mediaPickerController); \ No newline at end of file diff --git a/src/Umbraco.Web.UI.Client/src/views/prevalueeditors/mediapicker.html b/src/Umbraco.Web.UI.Client/src/views/prevalueeditors/mediapicker.html index a902385956..f8d780d3e2 100644 --- a/src/Umbraco.Web.UI.Client/src/views/prevalueeditors/mediapicker.html +++ b/src/Umbraco.Web.UI.Client/src/views/prevalueeditors/mediapicker.html @@ -1,30 +1,33 @@
- - - - - - + +
diff --git a/src/Umbraco.Web.UI.Client/src/views/prevalueeditors/treepicker.controller.js b/src/Umbraco.Web.UI.Client/src/views/prevalueeditors/treepicker.controller.js index cf81d1cda6..c5746ec149 100644 --- a/src/Umbraco.Web.UI.Client/src/views/prevalueeditors/treepicker.controller.js +++ b/src/Umbraco.Web.UI.Client/src/views/prevalueeditors/treepicker.controller.js @@ -7,6 +7,9 @@ angular.module('umbraco') $scope.renderModel = []; $scope.ids = []; + $scope.allowRemove = true; + $scope.allowEdit = true; + $scope.sortable = false; var config = { multiPicker: false, @@ -25,8 +28,17 @@ angular.module('umbraco') $scope.ids = $scope.model.value.split(','); entityResource.getByIds($scope.ids, config.entityType).then(function (data) { _.each(data, function (item, i) { + item.icon = iconHelper.convertFromLegacyIcon(item.icon); - $scope.renderModel.push({ name: item.name, id: item.id, icon: item.icon, udi: item.udi }); + $scope.renderModel.push({name: item.name, id: item.id, icon: item.icon, udi: item.udi}); + + // store the index of the new item in the renderModel collection so we can find it again + var itemRenderIndex = $scope.renderModel.length - 1; + // get and update the path for the picked node + entityResource.getUrl(item.id, config.entityType).then(function(data){ + $scope.renderModel[itemRenderIndex].path = data; + }); + }); }); } @@ -55,7 +67,7 @@ angular.module('umbraco') }; } - + $scope.remove =function(index){ $scope.renderModel.splice(index, 1); $scope.ids.splice(index, 1); @@ -73,12 +85,20 @@ angular.module('umbraco') var itemId = config.idType === "udi" ? item.udi : item.id; if ($scope.ids.indexOf(itemId) < 0){ + item.icon = iconHelper.convertFromLegacyIcon(item.icon); - - $scope.ids.push(itemId); + $scope.ids.push(itemId); $scope.renderModel.push({name: item.name, id: item.id, icon: item.icon, udi: item.udi}); $scope.model.value = trim($scope.ids.join(), ","); - } + + // store the index of the new item in the renderModel collection so we can find it again + var itemRenderIndex = $scope.renderModel.length - 1; + // get and update the path for the picked node + entityResource.getUrl(item.id, config.entityType).then(function(data){ + $scope.renderModel[itemRenderIndex].path = data; + }); + + } }; diff --git a/src/Umbraco.Web.UI.Client/src/views/prevalueeditors/treepicker.html b/src/Umbraco.Web.UI.Client/src/views/prevalueeditors/treepicker.html index 5ec114fc19..0ac971caad 100644 --- a/src/Umbraco.Web.UI.Client/src/views/prevalueeditors/treepicker.html +++ b/src/Umbraco.Web.UI.Client/src/views/prevalueeditors/treepicker.html @@ -1,24 +1,27 @@
- - - + + Add +