mirror of
https://github.com/OrchardCMS/Orchard.git
synced 2025-11-28 17:32:44 +08:00
Merge
--HG-- branch : dev
This commit is contained in:
@@ -68,7 +68,6 @@
|
||||
<Content Include="Scripts\CodeMirror\htmlmixed.js" />
|
||||
<Content Include="Scripts\CodeMirror\javascript.js" />
|
||||
<Content Include="Scripts\CodeMirror\razor.js" />
|
||||
<Content Include="Scripts\_orchard-designertools-shapetracing.js" />
|
||||
<Content Include="Styles\CodeMirror\codemirror.css" />
|
||||
<Content Include="Styles\CodeMirror\razor.css" />
|
||||
<Content Include="Styles\CodeMirror\css.css" />
|
||||
|
||||
@@ -1,111 +0,0 @@
|
||||
(function ($) {
|
||||
$(function () {
|
||||
$("<div id='debug-control'><ul><li id='debug-shapes'>Shapes</li><li id='debug-zones'>Zones</li></ul><div id='debug-control-toggle'>»</div></div>")
|
||||
.appendTo("body");
|
||||
$("#debug-shapes").click(function () {
|
||||
var _this = $(this);
|
||||
$("html").toggleClass(_this.attr("id"));
|
||||
$(this).toggleClass("debug-active");
|
||||
});
|
||||
$("#debug-zones").click(function () {
|
||||
var _this = $(this);
|
||||
$("html").toggleClass(_this.attr("id"));
|
||||
$(this).toggleClass("debug-active");
|
||||
|
||||
if ($(this).hasClass("debug-active")) {
|
||||
|
||||
// renders the zone name in each zone
|
||||
$(".zone").each(function () {
|
||||
var classes = $(this).attr("class").split(' ');
|
||||
|
||||
for (i = 0; i < classes.length; i++) {
|
||||
if (classes[i].indexOf("zone-") === 0) {
|
||||
$(this).append('<div class="zone-name">' + classes[i].substr(classes[i].indexOf("-") + 1) + '</div>');
|
||||
}
|
||||
}
|
||||
|
||||
});
|
||||
}
|
||||
else {
|
||||
$(".zone-name").remove();
|
||||
}
|
||||
|
||||
});
|
||||
$("#debug-control-toggle").click(function () {
|
||||
var _this = $(this), open = "debug-open";
|
||||
if (_this.is("." + open)) {
|
||||
_this.prev().hide("fast", function () { _this.removeClass(open).html("»"); });
|
||||
} else {
|
||||
_this.prev().show("fast", function () { _this.addClass(open).html("«"); });
|
||||
}
|
||||
});
|
||||
|
||||
$("div.shape-tracing.wrapper").click(function (e) {
|
||||
var _this = $(this);
|
||||
var classes = $(this).attr("class").split(' ');
|
||||
e.stopPropagation();
|
||||
for (i = 0; i < classes.length; i++) {
|
||||
if (classes[i].indexOf("shapeId-") === 0) {
|
||||
var shapeId = classes[i].substr(classes[i].indexOf("-") + 1);
|
||||
$("div.shape-tracing.wrapper").toggleClass('selected', false);
|
||||
_this.toggleClass('selected', true);
|
||||
$("div.shape-tracing.meta").toggle(false);
|
||||
$("div.shape-tracing.meta.shapeId-" + shapeId).toggle(true);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
/* tabs */
|
||||
function bindTab(selector) {
|
||||
$('li' + selector).click(function () {
|
||||
var _this = $(this);
|
||||
|
||||
// toggle the selected class on the tab li
|
||||
_this.parent().children('li').toggleClass('selected', false);
|
||||
_this.toggleClass('selected', true);
|
||||
|
||||
// hide all tabs and display the selected one
|
||||
var wrapper = _this.parent().parent().first();
|
||||
wrapper.children('.content').children().toggle(false);
|
||||
wrapper.children('.content').children('div' + selector).toggle(true);
|
||||
|
||||
if (wrapper.children('.content').children('div' + selector).children('.CodeMirror').length == 0) {
|
||||
var textArea = wrapper.children('.content').children('div' + selector).children('textarea').get(0);
|
||||
if (textArea) {
|
||||
CodeMirror.fromTextArea(textArea, { mode: "razor", tabMode: "indent", height: "100%", readOnly : true });
|
||||
}
|
||||
}
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
var glyph = $("<span class=\"expando-glyph-container closed\"><span class=\"expando-glyph\"></span>​</span>");
|
||||
$('div.model div.type').prev().prepend(glyph);
|
||||
|
||||
$('div.model ul ul').toggle(false);
|
||||
|
||||
$('span.expando-glyph-container').click(function () {
|
||||
var __this = $(this);
|
||||
|
||||
if (__this.hasClass("closed") || __this.hasClass("closing")) {
|
||||
__this.parent().parent().parent().children('ul').slideDown(300, function () { __this.removeClass("opening").removeClass("closed").addClass("open"); });
|
||||
__this.addClass("opening");
|
||||
}
|
||||
else {
|
||||
__this.parent().parent().parent().children('ul').slideUp(300, function () { __this.removeClass("closing").removeClass("open").addClass("closed"); });
|
||||
__this.addClass("closing");
|
||||
}
|
||||
|
||||
return false;
|
||||
});
|
||||
|
||||
bindTab('.shape');
|
||||
bindTab('.model');
|
||||
bindTab('.placement');
|
||||
bindTab('.templates');
|
||||
bindTab('.source');
|
||||
bindTab('.html');
|
||||
|
||||
|
||||
});
|
||||
})(jQuery);
|
||||
@@ -1,5 +1,8 @@
|
||||
jQuery(document).ready(function ($) {
|
||||
$(function () {
|
||||
// default shape window height when first opened
|
||||
var defaultHeight = 200;
|
||||
|
||||
// append the shape tracing window container at the end of the document
|
||||
$('<div id="shape-tracing-container"> ' +
|
||||
'<div id="shape-tracing-resize-handle" ></div>' +
|
||||
@@ -67,7 +70,7 @@
|
||||
var _this = $(this);
|
||||
_this.toggleClass('expanded');
|
||||
if (_this.hasClass('expanded')) {
|
||||
shapeTracingContainer.height(Math.max(previousSize, 100, shapeTracingContainer.height()));
|
||||
shapeTracingContainer.height(Math.max(previousSize, defaultHeight, shapeTracingContainer.height()));
|
||||
enableShapeTracing();
|
||||
}
|
||||
else {
|
||||
|
||||
@@ -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