mirror of
https://github.com/OrchardCMS/Orchard.git
synced 2025-10-15 19:54:57 +08:00
More progress on defining new UI capabilities...
--HG-- branch : dev
This commit is contained in:
@@ -48,7 +48,21 @@ namespace Orchard.Core.Shapes {
|
||||
|
||||
// 'Zone' shapes are built on the Zone base class
|
||||
builder.Describe("Zone")
|
||||
.OnCreating(creating => creating.BaseType = typeof(Zone));
|
||||
.OnCreating(creating => creating.BaseType = typeof (Zone));
|
||||
//.OnDisplaying(displaying => {
|
||||
// var name = displaying.Shape.ZoneName.ToLower();
|
||||
// var zone = displaying.Shape;
|
||||
// zone.Classes.Add("zone-" + name);
|
||||
// zone.Classes.Add("zone");
|
||||
// });
|
||||
|
||||
//builder.Describe("menu")
|
||||
// .OnDisplaying(displaying => {
|
||||
// var name = displaying.Shape.MenuName.ToLower();
|
||||
// var menu = displaying.Shape;
|
||||
// menu.Classes.Add("menu-" + name);
|
||||
// menu.Classes.Add("menu");
|
||||
// });
|
||||
|
||||
// 'List' shapes start with several empty collections
|
||||
builder.Describe("List")
|
||||
@@ -61,14 +75,12 @@ namespace Orchard.Core.Shapes {
|
||||
|
||||
private object CreateZone(ShapeCreatingContext context, string zoneName) {
|
||||
var name = zoneName.ToLower();
|
||||
|
||||
var zone = context.New.Zone();
|
||||
zone.Id = "zone-" + name;
|
||||
zone.Classes.Add("zone");
|
||||
return zone;
|
||||
}
|
||||
|
||||
|
||||
static TagBuilder GetTagBuilder(string tagName, string id, IEnumerable<string> classes, IDictionary<string, string> attributes) {
|
||||
var tagBuilder = new TagBuilder(tagName);
|
||||
tagBuilder.MergeAttributes(attributes, false);
|
||||
|
@@ -139,10 +139,14 @@
|
||||
<Content Include="Themes\TheThemeMachine\Styles\site.css" />
|
||||
<Content Include="Themes\TheThemeMachine\Theme.png" />
|
||||
<Content Include="Themes\TheThemeMachine\Theme.txt" />
|
||||
<None Include="Themes\TheThemeMachine\Views\TempFeatured.cshtml">
|
||||
<SubType>Designer</SubType>
|
||||
</None>
|
||||
<None Include="Themes\TheThemeMachine\Views\Document.cshtml" />
|
||||
<Content Include="Web.config">
|
||||
<SubType>Designer</SubType>
|
||||
</Content>
|
||||
<None Include="Themes\TheThemeMachine\Views\MenuItem.cshtml_" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\Orchard\Orchard.Framework.csproj">
|
||||
@@ -314,7 +318,7 @@
|
||||
<Content Include="Themes\Web.config" />
|
||||
<Content Include="Themes\TheThemeMachine\Views\Items\Content.Blog.cshtml" />
|
||||
<None Include="Themes\TheThemeMachine\Views\Layout.cshtml" />
|
||||
<None Include="Themes\TheThemeMachine\Views\Menu.cshtml">
|
||||
<None Include="Themes\TheThemeMachine\Views\Menu.cshtml_">
|
||||
<SubType>Designer</SubType>
|
||||
</None>
|
||||
</ItemGroup>
|
||||
|
@@ -10,6 +10,9 @@
|
||||
if (Model.Sidebar != null) {
|
||||
Html.AddPageClassNames(new[]{"icanhassidebar"});
|
||||
}
|
||||
|
||||
WorkContext.Layout.Featured.Add(New.TempFeatured(Hello:"bob"));
|
||||
WorkContext.Layout.Featured.Add("just some text in featured");
|
||||
}
|
||||
@Model.TitleFromMenu
|
||||
<div id="layout-wrapper">
|
||||
|
@@ -1,17 +0,0 @@
|
||||
<!-- Model is Model.Menu from the layout (Page.Menu) -->
|
||||
@{
|
||||
Layout.TitleFromMenu = "hi there!";
|
||||
}
|
||||
|
||||
<nav>
|
||||
@{
|
||||
// these should move somewhere else
|
||||
Model.Id = "menu-" + Model.MenuName.ToLower();
|
||||
Model.Classes.Add(Model.Id);
|
||||
Model.Classes.Add("menu");
|
||||
var tag = Html.Resolve<Orchard.DisplayManagement.Shapes.ITagBuilderFactory>().Create(Model, "ul");
|
||||
}
|
||||
@tag.StartElement
|
||||
@DisplayChildren(Model)
|
||||
@tag.EndElement <!-- /@Model.Id -->
|
||||
</nav>
|
10
src/Orchard.Web/Themes/TheThemeMachine/Views/Menu.cshtml_
Normal file
10
src/Orchard.Web/Themes/TheThemeMachine/Views/Menu.cshtml_
Normal file
@@ -0,0 +1,10 @@
|
||||
@{
|
||||
// Model is Model.Menu from the layout (Layout.Menu)
|
||||
var tag = Tag(Model, "ul");
|
||||
}
|
||||
<nav>
|
||||
@tag.StartElement
|
||||
@* see MenuItem shape template *@
|
||||
@DisplayChildren(Model)
|
||||
@tag.EndElement
|
||||
</nav>
|
@@ -0,0 +1,17 @@
|
||||
@{
|
||||
// odd formatting in this file is to cause more attractive results in the output.
|
||||
var items = (IEnumerable<dynamic>)Enumerable.Cast<dynamic>(Model);
|
||||
}
|
||||
@{
|
||||
if (HasText(Model.Text)) {
|
||||
@DisplayChildren(Model)
|
||||
} else {
|
||||
<li><a href="@Model.Href">@Model.Text</a>
|
||||
@if (items.Any()) {
|
||||
<ul>
|
||||
@DisplayChildren(Model)
|
||||
</ul>
|
||||
}
|
||||
</li>
|
||||
}
|
||||
}
|
@@ -0,0 +1 @@
|
||||
<h1>I am temp featured!! Hello, @Model.Hello</h1>
|
Reference in New Issue
Block a user