mirror of
https://github.com/OrchardCMS/Orchard.git
synced 2026-02-09 09:16:41 +08:00
Fixing alternates management in shape tracing
--HG-- branch : dev
This commit is contained in:
@@ -36,7 +36,7 @@ namespace Orchard.DesignerTools.Controllers
|
||||
var alternateFilename = Server.MapPath(Path.Combine(currentTheme.Location, currentTheme.Id, "Views", alternate));
|
||||
|
||||
// use same extension as template, or ".cshtml" if it's a code template))
|
||||
if (System.IO.File.Exists(template)) {
|
||||
if (_webSiteFolder.FileExists(template)) {
|
||||
alternateFilename += Path.GetExtension(template);
|
||||
|
||||
using (var stream = System.IO.File.Create(alternateFilename)) {
|
||||
|
||||
@@ -97,7 +97,23 @@ namespace Orchard.DesignerTools.Services {
|
||||
context.Shape._Dump = sw.ToString();
|
||||
}
|
||||
|
||||
shape.Template = descriptor.Bindings.Values.FirstOrDefault().BindingSource;
|
||||
shape.Template = null;
|
||||
foreach (var extension in new[] { ".cshtml", ".aspx" }) {
|
||||
foreach (var alternate in shapeMetadata.Alternates.Reverse()) {
|
||||
var alternateFilename = currentTheme.Location + "/" + currentTheme.Id + "/Views/" + alternate.Replace("__", "-").Replace("_", ".") + extension;
|
||||
if (_webSiteFolder.FileExists(alternateFilename)) {
|
||||
shape.Template = alternateFilename;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(shape.Template == null) {
|
||||
shape.Template = descriptor.BindingSource;
|
||||
}
|
||||
|
||||
if(shape.Template == null) {
|
||||
shape.Template = descriptor.Bindings.Values.FirstOrDefault().BindingSource;
|
||||
}
|
||||
|
||||
try {
|
||||
if (_webSiteFolder.FileExists(shape.Template)) {
|
||||
|
||||
Reference in New Issue
Block a user