#5847: Fixed CssClasses import/export.

This commit is contained in:
Sipke Schoorstra
2015-09-24 14:03:29 +01:00
parent 145c8037b0
commit 0ad1ef3098

View File

@@ -80,30 +80,15 @@ namespace Orchard.Widgets.Drivers {
return; return;
} }
var title = context.Attribute(part.PartDefinition.Name, "Title"); context.ImportAttribute(part.PartDefinition.Name, "Title", x => part.Title = x);
if (title != null) { context.ImportAttribute(part.PartDefinition.Name, "Position", x => part.Position = x);
part.Title = title; context.ImportAttribute(part.PartDefinition.Name, "Zone", x => part.Zone = x);
} context.ImportAttribute(part.PartDefinition.Name, "Name", x => part.Name = x);
context.ImportAttribute(part.PartDefinition.Name, "Title", x => {
var position = context.Attribute(part.PartDefinition.Name, "Position"); if (!String.IsNullOrWhiteSpace(x))
if (position != null) { part.Title = x;
part.Position = position; });
} context.ImportAttribute(part.PartDefinition.Name, "CssClasses", x => part.CssClasses = x);
var zone = context.Attribute(part.PartDefinition.Name, "Zone");
if (zone != null) {
part.Zone = zone;
}
var renderTitle = context.Attribute(part.PartDefinition.Name, "RenderTitle");
if (!string.IsNullOrWhiteSpace(renderTitle)) {
part.RenderTitle = Convert.ToBoolean(renderTitle);
}
var name = context.Attribute(part.PartDefinition.Name, "Name");
if (name != null) {
part.Name = name;
}
} }
protected override void Exporting(WidgetPart part, ContentManagement.Handlers.ExportContentContext context) { protected override void Exporting(WidgetPart part, ContentManagement.Handlers.ExportContentContext context) {
@@ -112,6 +97,7 @@ namespace Orchard.Widgets.Drivers {
context.Element(part.PartDefinition.Name).SetAttributeValue("Zone", part.Zone); context.Element(part.PartDefinition.Name).SetAttributeValue("Zone", part.Zone);
context.Element(part.PartDefinition.Name).SetAttributeValue("RenderTitle", part.RenderTitle); context.Element(part.PartDefinition.Name).SetAttributeValue("RenderTitle", part.RenderTitle);
context.Element(part.PartDefinition.Name).SetAttributeValue("Name", part.Name); context.Element(part.PartDefinition.Name).SetAttributeValue("Name", part.Name);
context.Element(part.PartDefinition.Name).SetAttributeValue("CssClasses", part.CssClasses);
} }
} }
} }