diff --git a/src/Umbraco.Web.UI.Client/src/common/mocks/resources/contenttype.mocks.js b/src/Umbraco.Web.UI.Client/src/common/mocks/resources/contenttype.mocks.js index 7f293362a8..1382d7ddd8 100644 --- a/src/Umbraco.Web.UI.Client/src/common/mocks/resources/contenttype.mocks.js +++ b/src/Umbraco.Web.UI.Client/src/common/mocks/resources/contenttype.mocks.js @@ -9,9 +9,9 @@ angular.module('umbraco.mocks'). } var types = [ - { name: "News Article", description: "Standard news article", alias: "newsArticle", id: 1234, icon: "icon-file" }, - { name: "News Area", description: "Area to hold all news articles, there should be only one", alias: "newsArea", id: 1234, icon: "icon-suitcase" }, - { name: "Employee", description: "Employee profile information page", alias: "employee", id: 1234, icon: "icon-user" } + { name: "News Article", description: "Standard news article", alias: "newsArticle", id: 1234, icon: "icon-file", thumbnail: "icon-file" }, + { name: "News Area", description: "Area to hold all news articles, there should be only one", alias: "newsArea", id: 1234, icon: "icon-suitcase", thumbnail: "icon-suitcase" }, + { name: "Employee", description: "Employee profile information page", alias: "employee", id: 1234, icon: "icon-user", thumbnail: "icon-user" } ]; return [200, types, null]; } diff --git a/src/Umbraco.Web.UI.Client/src/common/services/tree.service.js b/src/Umbraco.Web.UI.Client/src/common/services/tree.service.js index 4365bc017a..a7bf43250f 100644 --- a/src/Umbraco.Web.UI.Client/src/common/services/tree.service.js +++ b/src/Umbraco.Web.UI.Client/src/common/services/tree.service.js @@ -26,7 +26,7 @@ function treeService($q, treeResource, iconHelper, notificationsService, $rootSc treeNodes[i].parent = parentNode; //now, format the icon data - if (treeNodes[i].iconIsClass) { + if (treeNodes[i].iconIsClass === undefined || treeNodes[i].iconIsClass) { var converted = iconHelper.convertFromLegacyTreeNodeIcon(treeNodes[i]); treeNodes[i].cssClass = standardCssClass + " " + converted; if (converted.startsWith('.')) { diff --git a/src/Umbraco.Web.UI.Client/src/common/services/util.service.js b/src/Umbraco.Web.UI.Client/src/common/services/util.service.js index e2bdd5c668..104caee2df 100644 --- a/src/Umbraco.Web.UI.Client/src/common/services/util.service.js +++ b/src/Umbraco.Web.UI.Client/src/common/services/util.service.js @@ -397,6 +397,22 @@ function iconHelper() { ]; return { + + /** Used by the create dialogs for content/media types to format the data so that the thumbnails are styled properly */ + formatContentTypeThumbnails: function (contentTypes) { + for (var i = 0; i < contentTypes.length; i++) { + if (contentTypes[i].thumbnailIsClass === undefined || contentTypes[i].thumbnailIsClass) { + contentTypes[i].cssClass = this.convertFromLegacyIcon(contentTypes[i].thumbnail); + } + else { + contentTypes[i].style = "background-image: url('" + contentTypes[i].thumbnailFilePath + "');height:36px; background-position:4px 0px; background-repeat: no-repeat;background-size: 35px 35px;"; + //we need an 'icon-' class in there for certain styles to work so if it is image based we'll add this + contentTypes[i].cssClass = "custom-file"; + } + } + return contentTypes; + }, + /** If the icon is file based (i.e. it has a file path) */ isFileBasedIcon: function (icon) { //if it doesn't start with a '.' but contains one then we'll assume it's file based diff --git a/src/Umbraco.Web.UI.Client/src/views/content/content.create.controller.js b/src/Umbraco.Web.UI.Client/src/views/content/content.create.controller.js index de85970d71..3c2bde9d1c 100644 --- a/src/Umbraco.Web.UI.Client/src/views/content/content.create.controller.js +++ b/src/Umbraco.Web.UI.Client/src/views/content/content.create.controller.js @@ -1,12 +1,17 @@ -angular.module('umbraco') -.controller("Umbraco.Editors.Content.CreateController", - function ($scope, $routeParams, contentTypeResource, iconHelper) { +/** + * @ngdoc controller + * @name Umbraco.Editors.Content.CreateController + * @function + * + * @description + * The controller for the content creation dialog + */ +function contentCreateController($scope, $routeParams, contentTypeResource, iconHelper) { - contentTypeResource.getAllowedTypes($scope.currentNode.id) - .then(function (data) { - _.each(data, function(item) { - item.icon = iconHelper.convertFromLegacyIcon(item.icon); - }); - $scope.allowedTypes = data; - }); - }); \ No newline at end of file + contentTypeResource.getAllowedTypes($scope.currentNode.id).then(function(data) { + $scope.allowedTypes = iconHelper.formatContentTypeThumbnails(data); + }); + +} + +angular.module('umbraco').controller("Umbraco.Editors.Content.CreateController", contentCreateController); \ No newline at end of file diff --git a/src/Umbraco.Web.UI.Client/src/views/content/content.edit.controller.js b/src/Umbraco.Web.UI.Client/src/views/content/content.edit.controller.js index 62035c79f1..b9feea4f02 100644 --- a/src/Umbraco.Web.UI.Client/src/views/content/content.edit.controller.js +++ b/src/Umbraco.Web.UI.Client/src/views/content/content.edit.controller.js @@ -1,6 +1,6 @@ /** * @ngdoc controller - * @name ContentEditController + * @name Umbraco.Editors.Content.EditController * @function * * @description diff --git a/src/Umbraco.Web.UI.Client/src/views/content/create.html b/src/Umbraco.Web.UI.Client/src/views/content/create.html index a91b4dc4c2..5cd6c5e561 100644 --- a/src/Umbraco.Web.UI.Client/src/views/content/create.html +++ b/src/Umbraco.Web.UI.Client/src/views/content/create.html @@ -8,7 +8,7 @@