mirror of
https://github.com/OrchardCMS/Orchard.git
synced 2026-02-09 09:16:41 +08:00
ThemeFilter is wholly responsible for determining if a request is themed. Previously, LayoutAwareViewEngine had some theme business logic which made it impossible to have an un-themed admin controller.
--HG-- branch : dev
This commit is contained in:
@@ -36,8 +36,7 @@ namespace Orchard.Mvc.ViewEngines.ThemeAwareness {
|
||||
return viewResult;
|
||||
}
|
||||
|
||||
// Don't layout the result if it's not an Admin controller and it's disabled
|
||||
if ( !AdminFilter.IsApplied(controllerContext.RequestContext) && !ThemeFilter.IsApplied(controllerContext.RequestContext) ) {
|
||||
if (!ThemeFilter.IsApplied(controllerContext.RequestContext)) {
|
||||
return viewResult;
|
||||
}
|
||||
|
||||
|
||||
@@ -2,13 +2,24 @@ using System.Linq;
|
||||
using System.Web.Mvc;
|
||||
using System.Web.Routing;
|
||||
using Orchard.Mvc.Filters;
|
||||
using Orchard.UI.Admin;
|
||||
|
||||
namespace Orchard.Themes {
|
||||
public class ThemeFilter : FilterProvider, IActionFilter, IResultFilter {
|
||||
public void OnActionExecuting(ActionExecutingContext filterContext) {
|
||||
var attribute = GetThemedAttribute(filterContext.ActionDescriptor);
|
||||
if (attribute != null && attribute.Enabled) {
|
||||
Apply(filterContext.RequestContext);
|
||||
if (AdminFilter.IsApplied(filterContext.RequestContext)) {
|
||||
// admin are themed by default
|
||||
if (attribute == null || attribute.Enabled) {
|
||||
Apply(filterContext.RequestContext);
|
||||
}
|
||||
}
|
||||
else {
|
||||
// non-admin are explicitly themed
|
||||
// Don't layout the result if it's not an Admin controller and it's disabled
|
||||
if (attribute != null && attribute.Enabled) {
|
||||
Apply(filterContext.RequestContext);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user