Revert "Merge pull request #2508 from umbraco/temp-U4-11076"
This reverts commit4161d244c1, reversing changes made toeea87e411f.
This commit is contained in:
@@ -8,8 +8,6 @@
|
||||
var evts = [];
|
||||
var isInfoTab = false;
|
||||
scope.publishStatus = {};
|
||||
|
||||
scope.disableTemplates = Umbraco.Sys.ServerVariables.features.disabledFeatures.disableTemplates;
|
||||
|
||||
function onInit() {
|
||||
|
||||
|
||||
@@ -171,25 +171,27 @@
|
||||
{{publishStatus.label}}
|
||||
</umb-badge>
|
||||
</umb-control-group>
|
||||
|
||||
|
||||
<umb-control-group data-element="node-info-create-date" label="@template_createdDate">
|
||||
{{node.createDateFormatted}} <localize key="general_by">by</localize> {{ node.owner.name }}
|
||||
</umb-control-group>
|
||||
|
||||
<umb-control-group data-element="node-info-document-type" label="@content_documentType">
|
||||
<umb-node-preview style="max-width: 100%; margin-bottom: 0;"
|
||||
icon="documentType.icon"
|
||||
name="documentType.name"
|
||||
allow-open="allowOpen"
|
||||
on-open="openDocumentType(documentType)">
|
||||
<umb-node-preview
|
||||
style="max-width: 100%; margin-bottom: 0;"
|
||||
icon="documentType.icon"
|
||||
name="documentType.name"
|
||||
allow-open="allowOpen"
|
||||
on-open="openDocumentType(documentType)">
|
||||
</umb-node-preview>
|
||||
</umb-control-group>
|
||||
|
||||
<umb-control-group ng-if="disableTemplates == false" data-element="node-info-template" label="@template_template">
|
||||
<select class="input-block-level"
|
||||
ng-model="node.template"
|
||||
ng-options="key as value for (key, value) in availableTemplates"
|
||||
ng-change="updateTemplate(node.template)">
|
||||
<umb-control-group data-element="node-info-template" label="@template_template">
|
||||
<select
|
||||
class="input-block-level"
|
||||
ng-model="node.template"
|
||||
ng-options="key as value for (key, value) in availableTemplates"
|
||||
ng-change="updateTemplate(node.template)">
|
||||
<option value=""><localize key="general_choose">Choose</localize>...</option>
|
||||
</select>
|
||||
</umb-control-group>
|
||||
@@ -198,7 +200,7 @@
|
||||
<div>{{ node.id }}</div>
|
||||
<small>{{ node.key }}</small>
|
||||
</umb-control-group>
|
||||
|
||||
|
||||
</umb-box-content>
|
||||
</umb-box>
|
||||
</div>
|
||||
|
||||
@@ -14,21 +14,18 @@ function DocumentTypesCreateController($scope, $location, navigationService, con
|
||||
creatingFolder: false,
|
||||
};
|
||||
|
||||
var disableTemplates = Umbraco.Sys.ServerVariables.features.disabledFeatures.disableTemplates;
|
||||
$scope.model.disableTemplates = disableTemplates;
|
||||
|
||||
var node = $scope.dialogOptions.currentNode,
|
||||
localizeCreateFolder = localizationService.localize("defaultdialog_createFolder");
|
||||
|
||||
$scope.showCreateFolder = function () {
|
||||
$scope.showCreateFolder = function() {
|
||||
$scope.model.creatingFolder = true;
|
||||
};
|
||||
|
||||
$scope.createContainer = function () {
|
||||
$scope.createContainer = function() {
|
||||
|
||||
if (formHelper.submitForm({ scope: $scope, formCtrl: this.createFolderForm, statusMessage: localizeCreateFolder })) {
|
||||
if (formHelper.submitForm({scope: $scope, formCtrl: this.createFolderForm, statusMessage: localizeCreateFolder})) {
|
||||
|
||||
contentTypeResource.createContainer(node.id, $scope.model.folderName).then(function (folderId) {
|
||||
contentTypeResource.createContainer(node.id, $scope.model.folderName).then(function(folderId) {
|
||||
|
||||
navigationService.hideMenu();
|
||||
|
||||
@@ -47,7 +44,7 @@ function DocumentTypesCreateController($scope, $location, navigationService, con
|
||||
|
||||
var section = appState.getSectionState("currentSection");
|
||||
|
||||
}, function (err) {
|
||||
}, function(err) {
|
||||
|
||||
$scope.error = err;
|
||||
|
||||
@@ -61,17 +58,14 @@ function DocumentTypesCreateController($scope, $location, navigationService, con
|
||||
}
|
||||
};
|
||||
|
||||
// Disabling logic for creating document type with template if disableTemplates is set to true
|
||||
if (!disableTemplates) {
|
||||
$scope.createDocType = function () {
|
||||
$location.search('create', null);
|
||||
$location.search('notemplate', null);
|
||||
$location.path("/settings/documenttypes/edit/" + node.id).search("create", "true");
|
||||
navigationService.hideMenu();
|
||||
};
|
||||
}
|
||||
$scope.createDocType = function() {
|
||||
$location.search('create', null);
|
||||
$location.search('notemplate', null);
|
||||
$location.path("/settings/documenttypes/edit/" + node.id).search("create", "true");
|
||||
navigationService.hideMenu();
|
||||
};
|
||||
|
||||
$scope.createComponent = function () {
|
||||
$scope.createComponent = function() {
|
||||
$location.search('create', null);
|
||||
$location.search('notemplate', null);
|
||||
$location.path("/settings/documenttypes/edit/" + node.id).search("create", "true").search("notemplate", "true");
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
<h5><localize key="create_createUnder">Create an item under</localize> {{currentNode.name}}</h5>
|
||||
|
||||
<ul class="umb-actions umb-actions-child">
|
||||
<li data-element="action-documentType" ng-hide="model.disableTemplates">
|
||||
<li data-element="action-documentType">
|
||||
<a href="" ng-click="createDocType()" umb-auto-focus>
|
||||
|
||||
<i class="large icon-item-arrangement"></i>
|
||||
@@ -15,14 +15,10 @@
|
||||
</a>
|
||||
</li>
|
||||
<li data-element="action-documentTypeWithoutTemplate">
|
||||
<a href="" ng-click="createComponent()">
|
||||
<i class="large icon-item-arrangement"></i>
|
||||
|
||||
<span class="menu-label">
|
||||
<localize ng-if="model.disableTemplates == false" key="create_documentTypeWithoutTemplate"></localize>
|
||||
<localize ng-if="model.disableTemplates == true" key="content_documentType">Document type></localize>
|
||||
</span>
|
||||
</a>
|
||||
<a href="" ng-click="createComponent()">
|
||||
<i class="large icon-item-arrangement"></i>
|
||||
<span class="menu-label"><localize key="create_documentTypeWithoutTemplate"></localize></span>
|
||||
</a>
|
||||
</li>
|
||||
<li data-element="action-folder" ng-if="model.allowCreateFolder">
|
||||
<a href="" ng-click="showCreateFolder()">
|
||||
@@ -37,7 +33,7 @@
|
||||
<form novalidate name="createFolderForm"
|
||||
ng-submit="createContainer()"
|
||||
val-form-manager>
|
||||
|
||||
|
||||
<div ng-show="error">
|
||||
<h5 class="text-error">{{error.errorMsg}}</h5>
|
||||
<p class="text-error">{{error.data.message}}</p>
|
||||
|
||||
@@ -15,36 +15,6 @@
|
||||
var localizeSaving = localizationService.localize("general_saving");
|
||||
var evts = [];
|
||||
|
||||
var disableTemplates = Umbraco.Sys.ServerVariables.features.disabledFeatures.disableTemplates;
|
||||
|
||||
var buttons = [
|
||||
{
|
||||
"name": localizationService.localize("general_design"),
|
||||
"alias": "design",
|
||||
"icon": "icon-document-dashed-line",
|
||||
"view": "views/documenttypes/views/design/design.html",
|
||||
"active": true
|
||||
},
|
||||
{
|
||||
"name": localizationService.localize("general_listView"),
|
||||
"alias": "listView",
|
||||
"icon": "icon-list",
|
||||
"view": "views/documenttypes/views/listview/listview.html"
|
||||
},
|
||||
{
|
||||
"name": localizationService.localize("general_rights"),
|
||||
"alias": "permissions",
|
||||
"icon": "icon-keychain",
|
||||
"view": "views/documenttypes/views/permissions/permissions.html"
|
||||
},
|
||||
{
|
||||
"name": localizationService.localize("treeHeaders_templates"),
|
||||
"alias": "templates",
|
||||
"icon": "icon-layout",
|
||||
"view": "views/documenttypes/views/templates/templates.html"
|
||||
}
|
||||
];
|
||||
|
||||
vm.save = save;
|
||||
|
||||
vm.currentNode = null;
|
||||
@@ -53,73 +23,97 @@
|
||||
vm.page = {};
|
||||
vm.page.loading = false;
|
||||
vm.page.saveButtonState = "init";
|
||||
vm.page.navigation = [];
|
||||
|
||||
loadButtons();
|
||||
vm.page.navigation = [
|
||||
{
|
||||
"name": localizationService.localize("general_design"),
|
||||
"alias": "design",
|
||||
"icon": "icon-document-dashed-line",
|
||||
"view": "views/documenttypes/views/design/design.html",
|
||||
"active": true
|
||||
},
|
||||
{
|
||||
"name": localizationService.localize("general_listView"),
|
||||
"alias": "listView",
|
||||
"icon": "icon-list",
|
||||
"view": "views/documenttypes/views/listview/listview.html"
|
||||
},
|
||||
{
|
||||
"name": localizationService.localize("general_rights"),
|
||||
"alias": "permissions",
|
||||
"icon": "icon-keychain",
|
||||
"view": "views/documenttypes/views/permissions/permissions.html"
|
||||
},
|
||||
{
|
||||
"name": localizationService.localize("treeHeaders_templates"),
|
||||
"alias": "templates",
|
||||
"icon": "icon-layout",
|
||||
"view": "views/documenttypes/views/templates/templates.html"
|
||||
}
|
||||
];
|
||||
|
||||
vm.page.keyboardShortcutsOverview = [
|
||||
{
|
||||
"name": localizationService.localize("main_sections"),
|
||||
"shortcuts": [
|
||||
{
|
||||
"description": localizationService.localize("shortcuts_navigateSections"),
|
||||
"keys": [{ "key": "1" }, { "key": "4" }],
|
||||
"keyRange": true
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": localizationService.localize("general_design"),
|
||||
"shortcuts": [
|
||||
{
|
||||
"description": localizationService.localize("shortcuts_addTab"),
|
||||
"keys": [{ "key": "alt" }, { "key": "shift" }, { "key": "t" }]
|
||||
},
|
||||
{
|
||||
"description": localizationService.localize("shortcuts_addProperty"),
|
||||
"keys": [{ "key": "alt" }, { "key": "shift" }, { "key": "p" }]
|
||||
},
|
||||
{
|
||||
"description": localizationService.localize("shortcuts_addEditor"),
|
||||
"keys": [{ "key": "alt" }, { "key": "shift" }, { "key": "e" }]
|
||||
},
|
||||
{
|
||||
"description": localizationService.localize("shortcuts_editDataType"),
|
||||
"keys": [{ "key": "alt" }, { "key": "shift" }, { "key": "d" }]
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": localizationService.localize("general_listView"),
|
||||
"shortcuts": [
|
||||
{
|
||||
"description": localizationService.localize("shortcuts_toggleListView"),
|
||||
"keys": [{ "key": "alt" }, { "key": "shift" }, { "key": "l" }]
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": localizationService.localize("general_rights"),
|
||||
"shortcuts": [
|
||||
{
|
||||
"description": localizationService.localize("shortcuts_toggleAllowAsRoot"),
|
||||
"keys": [{ "key": "alt" }, { "key": "shift" }, { "key": "r" }]
|
||||
},
|
||||
{
|
||||
"description": localizationService.localize("shortcuts_addChildNode"),
|
||||
"keys": [{ "key": "alt" }, { "key": "shift" }, { "key": "c" }]
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": localizationService.localize("treeHeaders_templates"),
|
||||
"shortcuts": [
|
||||
{
|
||||
"description": localizationService.localize("shortcuts_addTemplate"),
|
||||
"keys": [{ "key": "alt" }, { "key": "shift" }, { "key": "t" }]
|
||||
}
|
||||
]
|
||||
}
|
||||
{
|
||||
"name": localizationService.localize("main_sections"),
|
||||
"shortcuts": [
|
||||
{
|
||||
"description": localizationService.localize("shortcuts_navigateSections"),
|
||||
"keys": [{ "key": "1" }, { "key": "4" }],
|
||||
"keyRange": true
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": localizationService.localize("general_design"),
|
||||
"shortcuts": [
|
||||
{
|
||||
"description": localizationService.localize("shortcuts_addTab"),
|
||||
"keys": [{ "key": "alt" }, { "key": "shift" }, { "key": "t" }]
|
||||
},
|
||||
{
|
||||
"description": localizationService.localize("shortcuts_addProperty"),
|
||||
"keys": [{ "key": "alt" }, { "key": "shift" }, { "key": "p" }]
|
||||
},
|
||||
{
|
||||
"description": localizationService.localize("shortcuts_addEditor"),
|
||||
"keys": [{ "key": "alt" }, { "key": "shift" }, { "key": "e" }]
|
||||
},
|
||||
{
|
||||
"description": localizationService.localize("shortcuts_editDataType"),
|
||||
"keys": [{ "key": "alt" }, { "key": "shift" }, { "key": "d" }]
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": localizationService.localize("general_listView"),
|
||||
"shortcuts": [
|
||||
{
|
||||
"description": localizationService.localize("shortcuts_toggleListView"),
|
||||
"keys": [{ "key": "alt" }, { "key": "shift" }, { "key": "l" }]
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": localizationService.localize("general_rights"),
|
||||
"shortcuts": [
|
||||
{
|
||||
"description": localizationService.localize("shortcuts_toggleAllowAsRoot"),
|
||||
"keys": [{ "key": "alt" }, { "key": "shift" }, { "key": "r" }]
|
||||
},
|
||||
{
|
||||
"description": localizationService.localize("shortcuts_addChildNode"),
|
||||
"keys": [{ "key": "alt" }, { "key": "shift" }, { "key": "c" }]
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": localizationService.localize("treeHeaders_templates"),
|
||||
"shortcuts": [
|
||||
{
|
||||
"description": localizationService.localize("shortcuts_addTemplate"),
|
||||
"keys": [{ "key": "alt" }, { "key": "shift" }, { "key": "t" }]
|
||||
}
|
||||
]
|
||||
}
|
||||
];
|
||||
|
||||
contentTypeHelper.checkModelsBuilderStatus().then(function (result) {
|
||||
@@ -150,7 +144,7 @@
|
||||
vm.page.saveButtonState = "busy";
|
||||
|
||||
localizationService.localize("modelsBuilder_buildingModels").then(function (headerValue) {
|
||||
localizationService.localize("modelsBuilder_waitingMessage").then(function (msgValue) {
|
||||
localizationService.localize("modelsBuilder_waitingMessage").then(function(msgValue) {
|
||||
notificationsService.info(headerValue, msgValue);
|
||||
});
|
||||
});
|
||||
@@ -161,26 +155,26 @@
|
||||
if (!result.lastError) {
|
||||
|
||||
//re-check model status
|
||||
contentTypeHelper.checkModelsBuilderStatus().then(function (statusResult) {
|
||||
contentTypeHelper.checkModelsBuilderStatus().then(function(statusResult) {
|
||||
vm.page.modelsBuilder = statusResult;
|
||||
});
|
||||
|
||||
//clear and add success
|
||||
vm.page.saveButtonState = "init";
|
||||
localizationService.localize("modelsBuilder_modelsGenerated").then(function (value) {
|
||||
localizationService.localize("modelsBuilder_modelsGenerated").then(function(value) {
|
||||
notificationsService.success(value);
|
||||
});
|
||||
|
||||
} else {
|
||||
vm.page.saveButtonState = "error";
|
||||
localizationService.localize("modelsBuilder_modelsExceptionInUlog").then(function (value) {
|
||||
localizationService.localize("modelsBuilder_modelsExceptionInUlog").then(function(value) {
|
||||
notificationsService.error(value);
|
||||
});
|
||||
}
|
||||
|
||||
}, function () {
|
||||
vm.page.saveButtonState = "error";
|
||||
localizationService.localize("modelsBuilder_modelsGeneratedError").then(function (value) {
|
||||
localizationService.localize("modelsBuilder_modelsGeneratedError").then(function(value) {
|
||||
notificationsService.error(value);
|
||||
});
|
||||
});
|
||||
@@ -195,7 +189,7 @@
|
||||
|
||||
//we are creating so get an empty data type item
|
||||
contentTypeResource.getScaffold($routeParams.id)
|
||||
.then(function (dt) {
|
||||
.then(function(dt) {
|
||||
init(dt);
|
||||
vm.page.loading = false;
|
||||
});
|
||||
@@ -213,26 +207,12 @@
|
||||
});
|
||||
}
|
||||
|
||||
function loadButtons() {
|
||||
|
||||
angular.forEach(buttons,
|
||||
function (val, index) {
|
||||
|
||||
if (disableTemplates === true && val.alias === "templates") {
|
||||
buttons.splice(index, 1);
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
vm.page.navigation = buttons;
|
||||
}
|
||||
|
||||
/* ---------- SAVE ---------- */
|
||||
|
||||
function save() {
|
||||
|
||||
// only save if there is no overlays open
|
||||
if (overlayHelper.getNumberOfOverlays() === 0) {
|
||||
if(overlayHelper.getNumberOfOverlays() === 0) {
|
||||
|
||||
var deferred = $q.defer();
|
||||
|
||||
@@ -253,7 +233,7 @@
|
||||
// we need to rebind... the IDs that have been created!
|
||||
rebindCallback: function (origContentType, savedContentType) {
|
||||
vm.contentType.id = savedContentType.id;
|
||||
vm.contentType.groups.forEach(function (group) {
|
||||
vm.contentType.groups.forEach(function(group) {
|
||||
if (!group.name) return;
|
||||
var k = 0;
|
||||
while (k < savedContentType.groups.length && savedContentType.groups[k].name != group.name)
|
||||
@@ -293,7 +273,7 @@
|
||||
}
|
||||
else {
|
||||
localizationService.localize("speechBubbles_validationFailedHeader").then(function (headerValue) {
|
||||
localizationService.localize("speechBubbles_validationFailedMessage").then(function (msgValue) {
|
||||
localizationService.localize("speechBubbles_validationFailedMessage").then(function(msgValue) {
|
||||
notificationsService.error(headerValue, msgValue);
|
||||
});
|
||||
});
|
||||
@@ -351,7 +331,7 @@
|
||||
function getDataTypeDetails(property) {
|
||||
if (property.propertyState !== "init") {
|
||||
dataTypeResource.getById(property.dataTypeId)
|
||||
.then(function (dataType) {
|
||||
.then(function(dataType) {
|
||||
property.dataTypeIcon = dataType.icon;
|
||||
property.dataTypeName = dataType.name;
|
||||
});
|
||||
@@ -365,7 +345,7 @@
|
||||
});
|
||||
}
|
||||
|
||||
evts.push(eventsService.on("app.refreshEditor", function (name, error) {
|
||||
evts.push(eventsService.on("app.refreshEditor", function(name, error) {
|
||||
loadDocumentType();
|
||||
}));
|
||||
|
||||
|
||||
@@ -13,7 +13,6 @@ using Umbraco.Core;
|
||||
using Umbraco.Core.Configuration;
|
||||
using Umbraco.Core.Configuration.UmbracoSettings;
|
||||
using Umbraco.Core.IO;
|
||||
using Umbraco.Web.Features;
|
||||
using Umbraco.Web.HealthCheck;
|
||||
using Umbraco.Web.Models.ContentEditing;
|
||||
using Umbraco.Web.Mvc;
|
||||
@@ -53,8 +52,7 @@ namespace Umbraco.Web.Editors
|
||||
{"umbracoUrls", new[] {"authenticationApiBaseUrl", "serverVarsJs", "externalLoginsUrl", "currentUserApiBaseUrl"}},
|
||||
{"umbracoSettings", new[] {"allowPasswordReset", "imageFileTypes", "maxFileSize", "loginBackgroundImage"}},
|
||||
{"application", new[] {"applicationPath", "cacheBuster"}},
|
||||
{"isDebuggingEnabled", new string[] { }},
|
||||
{"features", new [] {"disabledFeatures"}}
|
||||
{"isDebuggingEnabled", new string[] { }}
|
||||
};
|
||||
//now do the filtering...
|
||||
var defaults = GetServerVariables();
|
||||
@@ -83,7 +81,7 @@ namespace Umbraco.Web.Editors
|
||||
|
||||
//TODO: This is ultra confusing! this same key is used for different things, when returning the full app when authenticated it is this URL but when not auth'd it's actually the ServerVariables address
|
||||
// so based on compat and how things are currently working we need to replace the serverVarsJs one
|
||||
((Dictionary<string, object>)defaults["umbracoUrls"])["serverVarsJs"] = _urlHelper.Action("ServerVariables", "BackOffice");
|
||||
((Dictionary<string, object>) defaults["umbracoUrls"])["serverVarsJs"] = _urlHelper.Action("ServerVariables", "BackOffice");
|
||||
|
||||
return defaults;
|
||||
}
|
||||
@@ -330,18 +328,6 @@ namespace Umbraco.Web.Editors
|
||||
.ToArray()
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"features", new Dictionary<string,object>
|
||||
{
|
||||
{
|
||||
"disabledFeatures", new Dictionary<string,object>
|
||||
{
|
||||
{ "disableTemplates", true/*FeaturesResolver.Current.Features.Disabled.DisableTemplates*/}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
};
|
||||
return defaultVals;
|
||||
@@ -366,9 +352,9 @@ namespace Umbraco.Web.Editors
|
||||
.ToArray();
|
||||
|
||||
return (from p in pluginTreesWithAttributes
|
||||
let treeAttr = p.attributes.OfType<TreeAttribute>().Single()
|
||||
let pluginAttr = p.attributes.OfType<PluginControllerAttribute>().Single()
|
||||
select new Dictionary<string, string>
|
||||
let treeAttr = p.attributes.OfType<TreeAttribute>().Single()
|
||||
let pluginAttr = p.attributes.OfType<PluginControllerAttribute>().Single()
|
||||
select new Dictionary<string, string>
|
||||
{
|
||||
{"alias", treeAttr.Alias}, {"packageFolder", pluginAttr.AreaName}
|
||||
}).ToArray();
|
||||
|
||||
@@ -20,10 +20,5 @@ namespace Umbraco.Web.Features
|
||||
/// Gets the disabled controllers.
|
||||
/// </summary>
|
||||
public TypeList<UmbracoApiControllerBase> Controllers { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// If true, all references to templates will be removed in the back office and routing
|
||||
/// </summary>
|
||||
public bool DisableTemplates { get; set; }
|
||||
}
|
||||
}
|
||||
|
||||
14
src/Umbraco.Web/Features/EnabledFeatures.cs
Normal file
14
src/Umbraco.Web/Features/EnabledFeatures.cs
Normal file
@@ -0,0 +1,14 @@
|
||||
namespace Umbraco.Web.Features
|
||||
{
|
||||
/// <summary>
|
||||
/// Represents enabled features.
|
||||
/// </summary>
|
||||
internal class EnabledFeatures
|
||||
{
|
||||
/// <summary>
|
||||
/// Specifies if rendering pipeline should ignore HasTemplate check when handling a request.
|
||||
/// <remarks>This is to allow JSON preview of content with no template set.</remarks>
|
||||
/// </summary>
|
||||
public bool RenderNoTemplate { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -14,6 +14,7 @@ namespace Umbraco.Web.Features
|
||||
public UmbracoFeatures()
|
||||
{
|
||||
Disabled = new DisabledFeatures();
|
||||
Enabled = new EnabledFeatures();
|
||||
}
|
||||
|
||||
// note
|
||||
@@ -27,11 +28,16 @@ namespace Umbraco.Web.Features
|
||||
/// Gets the disabled features.
|
||||
/// </summary>
|
||||
public DisabledFeatures Disabled { get; set; }
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Determines whether a controller is enabled.
|
||||
/// Gets the enabled features.
|
||||
/// </summary>
|
||||
public bool IsControllerEnabled(Type feature)
|
||||
public EnabledFeatures Enabled { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Determines whether a feature is enabled.
|
||||
/// </summary>
|
||||
public bool IsEnabled(Type feature)
|
||||
{
|
||||
if (typeof(UmbracoApiControllerBase).IsAssignableFrom(feature))
|
||||
return Disabled.Controllers.Contains(feature) == false;
|
||||
|
||||
@@ -393,12 +393,12 @@ namespace Umbraco.Web.Mvc
|
||||
return GetWebFormsHandler();
|
||||
}
|
||||
|
||||
//Here we need to check if there is no hijacked route and no template assigned,
|
||||
//if this is the case we want to return a blank page, but we'll leave that up to the NoTemplateHandler.
|
||||
//We also check if templates have been disabled since if they are then we're allowed to render even though there's no template,
|
||||
//for example for json rendering in headless.
|
||||
if ((publishedContentRequest.HasTemplate == false && FeaturesResolver.Current.Features.Disabled.DisableTemplates == false)
|
||||
&& routeDef.HasHijackedRoute == false)
|
||||
//here we need to check if there is no hijacked route and no template assigned, if this is the case
|
||||
//we want to return a blank page, but we'll leave that up to the NoTemplateHandler.
|
||||
//we also check if we're allowed to render even though there's no template (json render in headless).
|
||||
if (publishedContentRequest.HasTemplate == false &&
|
||||
routeDef.HasHijackedRoute == false &&
|
||||
FeaturesResolver.Current.Features.Enabled.RenderNoTemplate == false)
|
||||
{
|
||||
publishedContentRequest.UpdateOnMissingTemplate(); // will go 404
|
||||
|
||||
|
||||
@@ -331,6 +331,7 @@
|
||||
<Compile Include="Editors\ParameterSwapControllerActionSelector.cs" />
|
||||
<Compile Include="Editors\CodeFileController.cs" />
|
||||
<Compile Include="Editors\TourController.cs" />
|
||||
<Compile Include="Features\EnabledFeatures.cs" />
|
||||
<Compile Include="Models\BackOfficeTourFilter.cs" />
|
||||
<Compile Include="Models\Mapping\AutoMapperExtensions.cs" />
|
||||
<Compile Include="Models\Mapping\ContentTreeNodeUrlResolver.cs" />
|
||||
|
||||
@@ -17,7 +17,7 @@ namespace Umbraco.Web.WebApi.Filters
|
||||
if (FeaturesResolver.HasCurrent == false) return true;
|
||||
|
||||
var controllerType = actionContext.ControllerContext.ControllerDescriptor.ControllerType;
|
||||
return FeaturesResolver.Current.Features.IsControllerEnabled(controllerType);
|
||||
return FeaturesResolver.Current.Features.IsEnabled(controllerType);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user