mirror of
https://github.com/OrchardCMS/Orchard.git
synced 2025-11-28 17:32:44 +08:00
Adding Original Template information
--HG-- branch : dev
This commit is contained in:
@@ -122,17 +122,25 @@ namespace Orchard.DesignerTools.Services {
|
||||
// process ContentItem.Parts specifically
|
||||
if (o is ContentItem && member.Name == "Parts") {
|
||||
foreach (var part in ((ContentItem)o).Parts) {
|
||||
Dump(part, part.PartDefinition.Name);
|
||||
try {
|
||||
Dump(part, part.PartDefinition.Name);
|
||||
}
|
||||
catch{
|
||||
// ignore dump issues
|
||||
}
|
||||
}
|
||||
continue;
|
||||
}
|
||||
|
||||
// process ContentPart.Fields specifically
|
||||
if (o is ContentPart && member.Name == "Fields") {
|
||||
foreach (var field in ((ContentPart)o).Fields) {
|
||||
Dump(field, field.Name);
|
||||
try {
|
||||
Dump(field, field.Name);
|
||||
}
|
||||
catch {
|
||||
// ignore dump issues
|
||||
}
|
||||
}
|
||||
continue;
|
||||
}
|
||||
|
||||
try {
|
||||
|
||||
@@ -99,6 +99,8 @@ namespace Orchard.DesignerTools.Services {
|
||||
}
|
||||
|
||||
shape.Template = null;
|
||||
shape.OriginalTemplate = descriptor.BindingSource;
|
||||
|
||||
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;
|
||||
@@ -116,6 +118,10 @@ namespace Orchard.DesignerTools.Services {
|
||||
shape.Template = descriptor.Bindings.Values.FirstOrDefault().BindingSource;
|
||||
}
|
||||
|
||||
if (shape.OriginalTemplate == null) {
|
||||
shape.OriginalTemplate = descriptor.Bindings.Values.FirstOrDefault().BindingSource;
|
||||
}
|
||||
|
||||
try {
|
||||
if (_webSiteFolder.FileExists(shape.Template)) {
|
||||
shape.TemplateContent = _webSiteFolder.ReadFile(shape.Template);
|
||||
|
||||
@@ -29,17 +29,22 @@
|
||||
<ul class="properties">
|
||||
<li class="sgd-s"><div class="name">Shape</div><div class="value">@Model.ShapeType</div></li>
|
||||
<li class="sgd-t"><div class="name">Template</div><div class="value"><a href="#">@Model.Template</a></div></li>
|
||||
@if(!Model.Template.Equals(Model.OriginalTemplate)) {
|
||||
<li class="sgd-ot"><div class="name">Original Template</div><div class="value">@Model.OriginalTemplate</div></li>
|
||||
}
|
||||
<li class="sgd-d"><div class="name">Display Type</div><div class="value">@(String.IsNullOrEmpty((string)Model.DisplayType) ? T("n/a").Text : Model.DisplayType.ToString())</div></li>
|
||||
<li class="sgd-po"><div class="name">Position</div><div class="value">@(String.IsNullOrEmpty((string)Model.Position) ? T("n/a").Text : Model.Position.ToString())</div></li>
|
||||
<li class="sgd-pl"><div class="name">Placement</div><div class="value">@(String.IsNullOrEmpty((string)Model.PlacementSource) ? T("n/a").Text : Model.PlacementSource.ToString())</div></li>
|
||||
<li class="sgd-a"><div class="name">Alternates (@Model.Alternates.Count)</div>
|
||||
<div class="value"> </div>
|
||||
<ul>
|
||||
@foreach (var alternate in Model.Alternates) {
|
||||
@foreach (var alternate in Model.Alternates)
|
||||
{
|
||||
var formatted = @FormatShapeFilename(alternate, WorkContext.CurrentTheme.Id);
|
||||
<li>
|
||||
<div class="name">
|
||||
@using (Html.BeginFormAntiForgeryPost(Url.Action("Create", "Alternate", new { Area = "Orchard.DesignerTools" }), FormMethod.Post, new { @class = "inline link" })) {
|
||||
@using (Html.BeginFormAntiForgeryPost(Url.Action("Create", "Alternate", new { Area = "Orchard.DesignerTools" }), FormMethod.Post, new { @class = "inline link" }))
|
||||
{
|
||||
@Html.Hidden("Alternate", (string)alternate)
|
||||
@Html.Hidden("Template", (string)Model.Template)
|
||||
@Html.Hidden("ReturnUrl", Context.Request.RawUrl)
|
||||
@@ -54,8 +59,10 @@
|
||||
<li class="sgd-w"><div class="name">Wrappers (@Model.Wrappers.Count)</div>
|
||||
<div class="value"> </div>
|
||||
<ul>
|
||||
@foreach (var wrapper in Model.Wrappers) {
|
||||
if (wrapper != "ShapeTracing_Wrapper") {
|
||||
@foreach (var wrapper in Model.Wrappers)
|
||||
{
|
||||
if (wrapper != "ShapeTracing_Wrapper")
|
||||
{
|
||||
var formatted = @FormatShapeFilename(wrapper, WorkContext.CurrentTheme.Id);
|
||||
<li><div class="name"> </div><div class="value">@formatted</div></li>
|
||||
}
|
||||
@@ -77,12 +84,15 @@
|
||||
|
||||
<div class="template" style="display:none">
|
||||
<div class="shape-tracing-breadcrumb">@Model.Template</div>
|
||||
@if (String.IsNullOrWhiteSpace((string)Model.TemplateContent)) {
|
||||
if (!String.IsNullOrWhiteSpace((string)Model.Template)) {
|
||||
@if (String.IsNullOrWhiteSpace((string)Model.TemplateContent))
|
||||
{
|
||||
if (!String.IsNullOrWhiteSpace((string)Model.Template))
|
||||
{
|
||||
@T("Content not available as coming from source code.")
|
||||
}
|
||||
}
|
||||
else {
|
||||
else
|
||||
{
|
||||
<textarea id="template-@Model.ShapeId" name="template-@Model.ShapeId">@Model.TemplateContent</textarea>
|
||||
}
|
||||
|
||||
|
||||
@@ -25,8 +25,9 @@
|
||||
@{
|
||||
Layout.Zones["Tail"].Add(
|
||||
New.ShapeTracingMeta(
|
||||
ShapeType: Model.Metadata.Type,
|
||||
ShapeType: Model.Metadata.Type,
|
||||
Template: Model.Template,
|
||||
OriginalTemplate: Model.OriginalTemplate,
|
||||
TemplateContent: Model.TemplateContent,
|
||||
DisplayType: Model.Metadata.DisplayType,
|
||||
Position: Model.Metadata.Position,
|
||||
|
||||
Reference in New Issue
Block a user