diff --git a/src/Orchard.Web/Core/Common/Extensions/CommonMetaDataExtensions.cs b/src/Orchard.Web/Core/Common/Extensions/CommonMetaDataExtensions.cs
new file mode 100644
index 000000000..e2239064a
--- /dev/null
+++ b/src/Orchard.Web/Core/Common/Extensions/CommonMetaDataExtensions.cs
@@ -0,0 +1,17 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Web;
+using Orchard.ContentManagement.MetaData.Builders;
+
+namespace Orchard.ContentManagement.MetaData {
+ public static class CommonMetaDataExtensions {
+ ///
+ /// Adds IdentityPart to the content type.
+ ///
+ /// The ContentTypeDefinitionBuilder object on which this method is called.
+ public static ContentTypeDefinitionBuilder WithIdentity(this ContentTypeDefinitionBuilder builder) {
+ return builder.WithPart("IdentityPart");
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/Orchard.Web/Core/Containers/Migrations.cs b/src/Orchard.Web/Core/Containers/Migrations.cs
index 7c8ee0577..d159c2a68 100644
--- a/src/Orchard.Web/Core/Containers/Migrations.cs
+++ b/src/Orchard.Web/Core/Containers/Migrations.cs
@@ -38,6 +38,7 @@ namespace Orchard.Core.Containers {
.WithPart("CommonPart")
.WithPart("WidgetPart")
.WithPart("ContainerWidgetPart")
+ .WithIdentity()
.WithSetting("Stereotype", "Widget"));
ContentDefinitionManager.AlterPartDefinition("ContainerPart", part => part
@@ -48,7 +49,7 @@ namespace Orchard.Core.Containers {
.Attachable()
.WithDescription("Allows your content item to be contained by a content item that has the ContainerPart attached."));
- return 6;
+ return 7;
}
public int UpdateFrom1() {
@@ -123,5 +124,12 @@ namespace Orchard.Core.Containers {
return 6;
}
+
+ public int UpdateFrom6() {
+ ContentDefinitionManager.AlterTypeDefinition("ContainerWidget", type => type
+ .WithIdentity());
+
+ return 7;
+ }
}
}
\ No newline at end of file
diff --git a/src/Orchard.Web/Core/Navigation/Migrations.cs b/src/Orchard.Web/Core/Navigation/Migrations.cs
index 48f891805..861c11004 100644
--- a/src/Orchard.Web/Core/Navigation/Migrations.cs
+++ b/src/Orchard.Web/Core/Navigation/Migrations.cs
@@ -20,7 +20,7 @@ namespace Orchard.Core.Navigation {
ContentDefinitionManager.AlterTypeDefinition("MenuItem", cfg => cfg
.WithPart("MenuPart")
- .WithPart("IdentityPart")
+ .WithIdentity()
.WithPart("CommonPart")
.DisplayedAs("Custom Link")
.WithSetting("Description", "Represents a simple custom link with a text and an url.")
@@ -34,7 +34,7 @@ namespace Orchard.Core.Navigation {
ContentDefinitionManager.AlterTypeDefinition("MenuWidget", cfg => cfg
.WithPart("CommonPart")
- .WithPart("IdentityPart")
+ .WithIdentity()
.WithPart("WidgetPart")
.WithPart("MenuWidgetPart")
.WithSetting("Stereotype", "Widget")
@@ -52,7 +52,7 @@ namespace Orchard.Core.Navigation {
.WithPart("MenuPart")
.WithPart("BodyPart")
.WithPart("CommonPart")
- .WithPart("IdentityPart")
+ .WithIdentity()
.DisplayedAs("Html Menu Item")
.WithSetting("Description", "Renders some custom HTML in the menu.")
.WithSetting("BodyPartSettings.FlavorDefault", "html")
@@ -92,7 +92,7 @@ namespace Orchard.Core.Navigation {
ContentDefinitionManager.AlterTypeDefinition("MenuItem", cfg => cfg
.WithPart("MenuPart")
.WithPart("CommonPart")
- .WithPart("IdentityPart")
+ .WithIdentity()
.DisplayedAs("Custom Link")
.WithSetting("Description", "Represents a simple custom link with a text and an url.")
.WithSetting("Stereotype", "MenuItem") // because we declare a new stereotype, the Shape MenuItem_Edit is needed
@@ -115,7 +115,7 @@ namespace Orchard.Core.Navigation {
ContentDefinitionManager.AlterTypeDefinition("MenuWidget", cfg => cfg
.WithPart("CommonPart")
- .WithPart("IdentityPart")
+ .WithIdentity()
.WithPart("WidgetPart")
.WithPart("MenuWidgetPart")
.WithSetting("Stereotype", "Widget")
@@ -130,7 +130,7 @@ namespace Orchard.Core.Navigation {
.WithPart("MenuPart")
.WithPart("BodyPart")
.WithPart("CommonPart")
- .WithPart("IdentityPart")
+ .WithIdentity()
.DisplayedAs("Html Menu Item")
.WithSetting("Description", "Renders some custom HTML in the menu.")
.WithSetting("BodyPartSettings.FlavorDefault", "html")
@@ -172,7 +172,7 @@ namespace Orchard.Core.Navigation {
public int UpdateFrom5() {
ContentDefinitionManager.AlterTypeDefinition("Menu", cfg => cfg
- .WithPart("IdentityPart")
+ .WithIdentity()
);
return 6;
diff --git a/src/Orchard.Web/Core/Orchard.Core.csproj b/src/Orchard.Web/Core/Orchard.Core.csproj
index 3d02d80bf..4477bb0ec 100644
--- a/src/Orchard.Web/Core/Orchard.Core.csproj
+++ b/src/Orchard.Web/Core/Orchard.Core.csproj
@@ -95,6 +95,7 @@
+
diff --git a/src/Orchard.Web/Modules/Orchard.Autoroute/Services/HomeAliasService.cs b/src/Orchard.Web/Modules/Orchard.Autoroute/Services/HomeAliasService.cs
index f11ba7dd3..b833ede2a 100644
--- a/src/Orchard.Web/Modules/Orchard.Autoroute/Services/HomeAliasService.cs
+++ b/src/Orchard.Web/Modules/Orchard.Autoroute/Services/HomeAliasService.cs
@@ -31,6 +31,10 @@ namespace Orchard.Autoroute.Services {
public IContent GetHomePage(VersionOptions version = null) {
var homePageRoute = GetHomeRoute();
+
+ if (homePageRoute == null)
+ return null;
+
var alias = LookupAlias(homePageRoute);
if (alias == null)
@@ -74,4 +78,4 @@ namespace Orchard.Autoroute.Services {
return alias != null ? alias.Path : null;
}
}
-}
\ No newline at end of file
+}
diff --git a/src/Orchard.Web/Modules/Orchard.Azure.MediaServices/Migrations.cs b/src/Orchard.Web/Modules/Orchard.Azure.MediaServices/Migrations.cs
index 97580b798..57067be36 100644
--- a/src/Orchard.Web/Modules/Orchard.Azure.MediaServices/Migrations.cs
+++ b/src/Orchard.Web/Modules/Orchard.Azure.MediaServices/Migrations.cs
@@ -66,7 +66,7 @@ namespace Orchard.Azure.MediaServices {
ContentDefinitionManager.AlterTypeDefinition("CloudVideo", type => type
.WithPart("CommonPart")
- .WithPart("IdentityPart")
+ .WithIdentity()
.WithPart("MediaPart")
.WithPart("TitlePart")
.WithPart("PublishLaterPart")
diff --git a/src/Orchard.Web/Modules/Orchard.Blogs/Migrations.cs b/src/Orchard.Web/Modules/Orchard.Blogs/Migrations.cs
index e4b00a464..60e0fcb54 100644
--- a/src/Orchard.Web/Modules/Orchard.Blogs/Migrations.cs
+++ b/src/Orchard.Web/Modules/Orchard.Blogs/Migrations.cs
@@ -80,7 +80,7 @@ namespace Orchard.Blogs {
.WithPart("CommonPart")
.WithPart("WidgetPart")
.WithSetting("Stereotype", "Widget")
- .WithPart("IdentityPart")
+ .WithIdentity()
);
return 7;
@@ -134,12 +134,12 @@ namespace Orchard.Blogs {
public int UpdateFrom6() {
ContentDefinitionManager.AlterTypeDefinition("RecentBlogPosts",
cfg => cfg
- .WithPart("IdentityPart")
+ .WithIdentity()
);
ContentDefinitionManager.AlterTypeDefinition("BlogArchives",
cfg => cfg
- .WithPart("IdentityPart")
+ .WithIdentity()
);
return 7;
diff --git a/src/Orchard.Web/Modules/Orchard.Comments/Migrations.cs b/src/Orchard.Web/Modules/Orchard.Comments/Migrations.cs
index 379c77d2c..9d6de0ece 100644
--- a/src/Orchard.Web/Modules/Orchard.Comments/Migrations.cs
+++ b/src/Orchard.Web/Modules/Orchard.Comments/Migrations.cs
@@ -56,7 +56,7 @@ namespace Orchard.Comments {
p => p
.WithSetting("OwnerEditorSettings.ShowOwnerEditor", "false")
.WithSetting("DateEditorSettings.ShowDateEditor", "false"))
- .WithPart("IdentityPart")
+ .WithIdentity()
);
ContentDefinitionManager.AlterTypeDefinition("Blog",
@@ -82,7 +82,7 @@ namespace Orchard.Comments {
}
public int UpdateFrom1() {
- ContentDefinitionManager.AlterTypeDefinition("Comment", cfg => cfg.WithPart("IdentityPart"));
+ ContentDefinitionManager.AlterTypeDefinition("Comment", cfg => cfg.WithIdentity());
return 2;
}
diff --git a/src/Orchard.Web/Modules/Orchard.ContentPicker/Migrations.cs b/src/Orchard.Web/Modules/Orchard.ContentPicker/Migrations.cs
index 405fcc978..91b73fabb 100644
--- a/src/Orchard.Web/Modules/Orchard.ContentPicker/Migrations.cs
+++ b/src/Orchard.Web/Modules/Orchard.ContentPicker/Migrations.cs
@@ -16,7 +16,7 @@ namespace Orchard.ContentPicker {
ContentDefinitionManager.AlterTypeDefinition("ContentMenuItem", cfg => cfg
.WithPart("MenuPart")
.WithPart("CommonPart")
- .WithPart("IdentityPart")
+ .WithIdentity()
.WithPart("ContentMenuItemPart")
.DisplayedAs("Content Menu Item")
.WithSetting("Description", "Adds a Content Item to the menu.")
diff --git a/src/Orchard.Web/Modules/Orchard.CustomForms/Migrations.cs b/src/Orchard.Web/Modules/Orchard.CustomForms/Migrations.cs
index f3d75d9c1..dad45d608 100644
--- a/src/Orchard.Web/Modules/Orchard.CustomForms/Migrations.cs
+++ b/src/Orchard.Web/Modules/Orchard.CustomForms/Migrations.cs
@@ -37,7 +37,7 @@ namespace Orchard.CustomForms {
cfg => cfg
.WithPart("WidgetPart")
.WithPart("CommonPart")
- .WithPart("IdentityPart")
+ .WithIdentity()
.WithPart("CustomFormPart")
.WithSetting("Stereotype", "Widget")
);
diff --git a/src/Orchard.Web/Modules/Orchard.Dashboards/Migrations.cs b/src/Orchard.Web/Modules/Orchard.Dashboards/Migrations.cs
index 97bf38c37..7ce3a0711 100644
--- a/src/Orchard.Web/Modules/Orchard.Dashboards/Migrations.cs
+++ b/src/Orchard.Web/Modules/Orchard.Dashboards/Migrations.cs
@@ -7,7 +7,7 @@ namespace Orchard.Dashboards {
public int Create() {
ContentDefinitionManager.AlterTypeDefinition("Dashboard", type => type
.WithPart("CommonPart")
- .WithPart("IdentityPart")
+ .WithIdentity()
.WithPart("TitlePart")
.WithPart("LayoutPart", p => p
.WithSetting("LayoutTypePartSettings.DefaultLayoutData", DefaultDashboardSelector.DefaultLayout)));
diff --git a/src/Orchard.Web/Modules/Orchard.DynamicForms/Migrations.cs b/src/Orchard.Web/Modules/Orchard.DynamicForms/Migrations.cs
index cc20cd75a..03a434b58 100644
--- a/src/Orchard.Web/Modules/Orchard.DynamicForms/Migrations.cs
+++ b/src/Orchard.Web/Modules/Orchard.DynamicForms/Migrations.cs
@@ -108,7 +108,7 @@ namespace Orchard.DynamicForms {
public int UpdateFrom2() {
ContentDefinitionManager.AlterTypeDefinition("FormWidget", type => type
- .WithPart("IdentityPart"));
+ .WithIdentity());
return 3;
}
diff --git a/src/Orchard.Web/Modules/Orchard.Layouts/Helpers/TagBuilderExtensions.cs b/src/Orchard.Web/Modules/Orchard.Layouts/Helpers/TagBuilderExtensions.cs
index 8b68d9f7e..e8b8675a0 100644
--- a/src/Orchard.Web/Modules/Orchard.Layouts/Helpers/TagBuilderExtensions.cs
+++ b/src/Orchard.Web/Modules/Orchard.Layouts/Helpers/TagBuilderExtensions.cs
@@ -1,5 +1,6 @@
-using System;
+using System;
using System.Collections.Generic;
+using System.Linq;
using System.Text.RegularExpressions;
using Orchard.DisplayManagement.Shapes;
using Orchard.Layouts.Framework.Elements;
@@ -37,11 +38,17 @@ namespace Orchard.Layouts.Helpers {
attributes["style"] = Regex.Replace(tokenize(), @"(?:\r\n|[\r\n])", "");
}
+ IList classes = shape.Classes;
+
if (!String.IsNullOrWhiteSpace(htmlClass)) {
var tokenize = (Func)shape.TokenizeHtmlClass;
- attributes["class"] = tokenize();
+ var cssClass = tokenize();
+ classes.Add(cssClass);
}
+ if(classes.Any())
+ attributes["class"] = String.Join(" ", classes);
+
return attributes;
}
@@ -51,4 +58,4 @@ namespace Orchard.Layouts.Helpers {
}
}
}
-}
\ No newline at end of file
+}
diff --git a/src/Orchard.Web/Modules/Orchard.Layouts/Migrations.cs b/src/Orchard.Web/Modules/Orchard.Layouts/Migrations.cs
index 746120763..0261358fc 100644
--- a/src/Orchard.Web/Modules/Orchard.Layouts/Migrations.cs
+++ b/src/Orchard.Web/Modules/Orchard.Layouts/Migrations.cs
@@ -29,7 +29,7 @@ namespace Orchard.Layouts {
.WithSetting("OwnerEditorSettings.ShowOwnerEditor", "false")
.WithSetting("DateEditorSettings.ShowDateEditor", "false"))
.WithPart("TitlePart")
- .WithPart("IdentityPart")
+ .WithIdentity()
.WithPart("LayoutPart", p => p
.WithSetting("LayoutTypePartSettings.IsTemplate", "True"))
.DisplayedAs("Layout")
@@ -39,7 +39,7 @@ namespace Orchard.Layouts {
.WithPart("CommonPart", p => p
.WithSetting("OwnerEditorSettings.ShowOwnerEditor", "false")
.WithSetting("DateEditorSettings.ShowDateEditor", "false"))
- .WithPart("IdentityPart")
+ .WithIdentity()
.WithPart("WidgetPart")
.WithPart("LayoutPart")
.WithSetting("Stereotype", "Widget")
@@ -72,7 +72,7 @@ namespace Orchard.Layouts {
public int UpdateFrom2() {
ContentDefinitionManager.AlterTypeDefinition("Layout", type => type
- .WithPart("IdentityPart"));
+ .WithIdentity());
return 3;
}
@@ -83,7 +83,7 @@ namespace Orchard.Layouts {
.WithSetting("OwnerEditorSettings.ShowOwnerEditor", "false")
.WithSetting("DateEditorSettings.ShowDateEditor", "false"))
.WithPart("WidgetPart")
- .WithPart("IdentityPart")
+ .WithIdentity()
.WithPart("ElementWrapperPart", p => p
.WithSetting("ElementWrapperPartSettings.ElementTypeName", elementTypeName))
.WithSetting("Stereotype", "Widget")
diff --git a/src/Orchard.Web/Modules/Orchard.Layouts/Services/LayoutModelMapper.cs b/src/Orchard.Web/Modules/Orchard.Layouts/Services/LayoutModelMapper.cs
index 8d05c73f2..e5dafd564 100644
--- a/src/Orchard.Web/Modules/Orchard.Layouts/Services/LayoutModelMapper.cs
+++ b/src/Orchard.Web/Modules/Orchard.Layouts/Services/LayoutModelMapper.cs
@@ -20,7 +20,7 @@ namespace Orchard.Layouts.Services {
public object ToEditorModel(string layoutData, DescribeElementsContext describeContext) {
var elements = _serializer.Deserialize(layoutData, describeContext);
- var canvas = elements.FirstOrDefault(x => x is Canvas) ?? new Canvas();
+ var canvas = elements.FirstOrDefault(x => x is Canvas) ?? _elementManager.ActivateElement