diff --git a/src/Umbraco.Web.UI.Client/src/common/directives/components/content/edit.controller.js b/src/Umbraco.Web.UI.Client/src/common/directives/components/content/edit.controller.js index 826d6b87fc..f2dc0622c7 100644 --- a/src/Umbraco.Web.UI.Client/src/common/directives/components/content/edit.controller.js +++ b/src/Umbraco.Web.UI.Client/src/common/directives/components/content/edit.controller.js @@ -2,7 +2,7 @@ 'use strict'; function ContentEditController($rootScope, $scope, $routeParams, $q, $window, - appState, contentResource, entityResource, navigationService, notificationsService, + appState, contentResource, entityResource, navigationService, notificationsService, contentAppHelper, serverValidationManager, contentEditingHelper, localizationService, formHelper, umbRequestHelper, editorState, $http, eventsService, overlayService, $location, localStorageService, treeService, $exceptionHandler) { @@ -282,7 +282,7 @@ $scope.page.saveButtonStyle = content.trashed || content.isElement || isBlueprint ? "primary" : "info"; // only create the save/publish/preview buttons if the // content app is "Conent" - if ($scope.activeApp && $scope.activeApp.alias !== "umbContent" && $scope.activeApp.alias !== "umbInfo" && $scope.activeApp.alias !== "umbListView") { + if ($scope.activeApp && !contentAppHelper.isContentBasedApp($scope.activeApp)) { $scope.defaultButton = null; $scope.subButtons = null; $scope.page.showSaveButton = false; diff --git a/src/Umbraco.Web.UI.Client/src/common/directives/components/content/umbvariantcontent.directive.js b/src/Umbraco.Web.UI.Client/src/common/directives/components/content/umbvariantcontent.directive.js index eb9971d83a..55e66c5706 100644 --- a/src/Umbraco.Web.UI.Client/src/common/directives/components/content/umbvariantcontent.directive.js +++ b/src/Umbraco.Web.UI.Client/src/common/directives/components/content/umbvariantcontent.directive.js @@ -24,7 +24,7 @@ controller: umbVariantContentController }; - function umbVariantContentController($scope) { + function umbVariantContentController($scope, contentAppHelper) { var unsubscribe = []; @@ -110,7 +110,7 @@ function onAppChanged(activeApp) { // disable the name field if the active content app is not "Content" or "Info" - vm.nameDisabled = (activeApp && activeApp.alias !== "umbContent" && activeApp.alias !== "umbInfo" && activeApp.alias !== "umbListView"); + vm.nameDisabled = (activeApp && !contentAppHelper.isContentBasedApp(activeApp)); } /** diff --git a/src/Umbraco.Web.UI.Client/src/common/services/contentapphelper.service.js b/src/Umbraco.Web.UI.Client/src/common/services/contentapphelper.service.js new file mode 100644 index 0000000000..0b3dc2c6e0 --- /dev/null +++ b/src/Umbraco.Web.UI.Client/src/common/services/contentapphelper.service.js @@ -0,0 +1,35 @@ + +/** +* @ngdoc service +* @name umbraco.services.contentAppHelper +* @description A helper service for content app related functions. +**/ +function contentAppHelper() { + + var service = {}; + + /** + * Default known content based apps. + */ + service.CONTENT_BASED_APPS = [ "umbContent", "umbInfo", "umbListView" ]; + + /** + * @ngdoc method + * @name umbraco.services.contentAppHelper#isContentBasedApp + * @methodOf umbraco.services.contentAppHelper + * + * @param {object} app A content app to check + * + * @description + * Determines whether the supplied content app is a known content based app + * + */ + service.isContentBasedApp = function (app) { + return service.CONTENT_BASED_APPS.indexOf(app.alias) !== -1; + } + + return service; + +} + +angular.module('umbraco.services').factory('contentAppHelper', contentAppHelper);