mirror of
https://github.com/OrchardCMS/Orchard.git
synced 2025-10-14 10:54:50 +08:00
Changing the default theme to TheThemeMachine, adding some more content widgets @ startup (for lack of a better place ATM - distro or some filler content scheme) and some shape templates
--HG-- branch : dev
This commit is contained in:
@@ -1,8 +1,5 @@
|
||||
using System;
|
||||
using Orchard.ContentManagement;
|
||||
using Orchard.ContentManagement;
|
||||
using Orchard.DisplayManagement.Descriptors;
|
||||
using Orchard.DisplayManagement.Implementation;
|
||||
using Orchard.UI.Zones;
|
||||
|
||||
namespace Orchard.Core.Contents {
|
||||
public class Shapes : IShapeTableProvider {
|
||||
|
@@ -1,10 +1,10 @@
|
||||
@{
|
||||
// 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");
|
||||
// Model is Model.Menu from the layout (Layout.Menu)
|
||||
var tag = Tag(Model, "ul");
|
||||
}
|
||||
@tag.StartElement
|
||||
@DisplayChildren(Model)
|
||||
@tag.EndElement <!-- /@Model.Id -->
|
||||
<nav>
|
||||
@tag.StartElement
|
||||
@* see MenuItem shape template *@
|
||||
@DisplayChildren(Model)
|
||||
@tag.EndElement
|
||||
</nav>
|
@@ -181,7 +181,7 @@ namespace Orchard.Setup.Services {
|
||||
|
||||
// set site theme
|
||||
var themeService = environment.Resolve<IThemeService>();
|
||||
themeService.SetSiteTheme("Classic");
|
||||
themeService.SetSiteTheme("TheThemeMachine");
|
||||
|
||||
// add default culture
|
||||
var cultureManager = environment.Resolve<ICultureManager>();
|
||||
@@ -217,19 +217,41 @@ namespace Orchard.Setup.Services {
|
||||
|
||||
|
||||
// add a layer for the homepage
|
||||
var layer = contentManager.Create("Layer");
|
||||
layer.As<LayerPart>().Name = "TheHomepage";
|
||||
layer.As<LayerPart>().LayerRule = "url \"~/\"";
|
||||
contentManager.Publish(layer);
|
||||
|
||||
var homepageLayer = contentManager.Create("Layer");
|
||||
homepageLayer.As<LayerPart>().Name = "TheHomepage";
|
||||
homepageLayer.As<LayerPart>().LayerRule = "url \"~/\"";
|
||||
contentManager.Publish(homepageLayer);
|
||||
|
||||
// create an html widget with the homepage layer as its container
|
||||
var htmlWidget = contentManager.Create("HtmlWidget");
|
||||
htmlWidget.As<WidgetPart>().LayerPart = layer.As<LayerPart>();
|
||||
htmlWidget.As<WidgetPart>().LayerPart = homepageLayer.As<LayerPart>();
|
||||
htmlWidget.As<WidgetPart>().Title = T("Welcome to Orchard!").Text;
|
||||
htmlWidget.As<WidgetPart>().Zone = "Content";
|
||||
htmlWidget.As<WidgetPart>().Position = "5";
|
||||
htmlWidget.As<BodyPart>().Text = "<p>Welcome to Orchard!</p><p>Congratulations, you've successfully set-up your Orchard site.</p><p>This is the home page of your new site. We've taken the liberty to write here about a few things you could look at next in order to get familiar with the application. Once you feel confident you don't need this anymore, just click <a href=\"Admin/Pages/Edit/3\">Edit</a> to go into edit mode and replace this with whatever you want on your home page to make it your own.</p><p>One thing you could do (but you don't have to) is go into <a href=\"Admin/Settings\">Manage Settings</a> (follow the <a href=\"Admin\">Admin</a> link and then look for it under \"Settings\" in the menu on the left) and check that everything is configured the way you want.</p><p>You probably want to make the site your own. One of the ways you can do that is by clicking <a href=\"Admin/Themes\">Manage Themes</a> in the admin menu. A theme is a packaged look and feel that affects the whole site.</p><p>Next, you can start playing with the content types that we installed. For example, go ahead and click <a href=\"Admin/Pages/Create\">Add New Page</a> in the admin menu and create an \"about\" page. Then, add it to the navigation menu by going to <a href=\"Admin/Navigation\">Manage Menu</a>. You can also click <a href=\"Admin/Blogs/Create\">Add New Blog</a> and start posting by clicking \"Add New Post\".</p><p>Finally, Orchard has been designed to be extended. It comes with a few built-in modules such as pages and blogs or themes. You can install new themes by going to <a href=\"Admin/Themes\">Manage Themes</a> and clicking <a href=\"Admin/Themes/Install\">Install a new Theme</a>. Like for themes, modules are created by other users of Orchard just like you so if you feel up to it, please <a href=\"http://www.orchardproject.net/\">consider participating</a>.</p><p>--The Orchard Crew</p>";
|
||||
htmlWidget.As<BodyPart>().Text = "<p>Congratulations, you've successfully set-up your Orchard site.</p><p>This is the home page of your new site. We've taken the liberty to write here about a few things you could look at next in order to get familiar with the application. Once you feel confident you don't need this anymore, just click <a href=\"Admin/Pages/Edit/3\">Edit</a> to go into edit mode and replace this with whatever you want on your home page to make it your own.</p><p>One thing you could do (but you don't have to) is go into <a href=\"Admin/Settings\">Manage Settings</a> (follow the <a href=\"Admin\">Admin</a> link and then look for it under \"Settings\" in the menu on the left) and check that everything is configured the way you want.</p><p>You probably want to make the site your own. One of the ways you can do that is by clicking <a href=\"Admin/Themes\">Manage Themes</a> in the admin menu. A theme is a packaged look and feel that affects the whole site.</p><p>Next, you can start playing with the content types that we installed. For example, go ahead and click <a href=\"Admin/Pages/Create\">Add New Page</a> in the admin menu and create an \"about\" page. Then, add it to the navigation menu by going to <a href=\"Admin/Navigation\">Manage Menu</a>. You can also click <a href=\"Admin/Blogs/Create\">Add New Blog</a> and start posting by clicking \"Add New Post\".</p><p>Finally, Orchard has been designed to be extended. It comes with a few built-in modules such as pages and blogs or themes. You can install new themes by going to <a href=\"Admin/Themes\">Manage Themes</a> and clicking <a href=\"Admin/Themes/Install\">Install a new Theme</a>. Like for themes, modules are created by other users of Orchard just like you so if you feel up to it, please <a href=\"http://www.orchardproject.net/\">consider participating</a>.</p><p>--The Orchard Crew</p>";
|
||||
contentManager.Publish(htmlWidget);
|
||||
// and three more for the third aside...really need this elsewhere...
|
||||
var asideHtmlWidget = contentManager.Create("HtmlWidget");
|
||||
asideHtmlWidget.As<WidgetPart>().LayerPart = homepageLayer.As<LayerPart>();
|
||||
asideHtmlWidget.As<WidgetPart>().Title = T("First Leader Aside").Text;
|
||||
asideHtmlWidget.As<WidgetPart>().Zone = "AsideThird";
|
||||
asideHtmlWidget.As<WidgetPart>().Position = "4";
|
||||
asideHtmlWidget.As<BodyPart>().Text = "<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Curabitur a nibh ut tortor dapibus vestibulum. Aliquam vel sem nibh. Suspendisse vel condimentum tellus.</p>";
|
||||
contentManager.Publish(asideHtmlWidget);
|
||||
var asideHtmlWidget1 = contentManager.Create("HtmlWidget");
|
||||
asideHtmlWidget1.As<WidgetPart>().LayerPart = homepageLayer.As<LayerPart>();
|
||||
asideHtmlWidget1.As<WidgetPart>().Title = T("Second Leader Aside").Text;
|
||||
asideHtmlWidget1.As<WidgetPart>().Zone = "AsideThird";
|
||||
asideHtmlWidget1.As<WidgetPart>().Position = "5";
|
||||
asideHtmlWidget1.As<BodyPart>().Text = "<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Curabitur a nibh ut tortor dapibus vestibulum. Aliquam vel sem nibh. Suspendisse vel condimentum tellus.</p>";
|
||||
contentManager.Publish(asideHtmlWidget1);
|
||||
var asideHtmlWidget2 = contentManager.Create("HtmlWidget");
|
||||
asideHtmlWidget2.As<WidgetPart>().LayerPart = homepageLayer.As<LayerPart>();
|
||||
asideHtmlWidget2.As<WidgetPart>().Title = T("Third Leader Aside").Text;
|
||||
asideHtmlWidget2.As<WidgetPart>().Zone = "AsideThird";
|
||||
asideHtmlWidget2.As<WidgetPart>().Position = "6";
|
||||
asideHtmlWidget2.As<BodyPart>().Text = "<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Curabitur a nibh ut tortor dapibus vestibulum. Aliquam vel sem nibh. Suspendisse vel condimentum tellus.</p>";
|
||||
contentManager.Publish(asideHtmlWidget2);
|
||||
|
||||
// create the home page as a WidgetPage
|
||||
var page = contentManager.Create("WidgetPage", VersionOptions.Draft);
|
||||
|
@@ -85,6 +85,7 @@
|
||||
<Compile Include="RuleEngine\UrlRuleProvider.cs" />
|
||||
<Compile Include="Services\IWidgetsService.cs" />
|
||||
<Compile Include="Services\WidgetsService.cs" />
|
||||
<Compile Include="Shapes.cs" />
|
||||
<Compile Include="ViewModels\WidgetsIndexViewModel.cs" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
@@ -118,6 +119,7 @@
|
||||
<None Include="Views\EditorTemplates\Parts\Widgets.LayerPart.cshtml" />
|
||||
<None Include="Views\EditorTemplates\Parts\Widgets.WidgetBagPart.cshtml" />
|
||||
<Content Include="Views\Items_Widget.cshtml" />
|
||||
<Content Include="Views\Items\Content-WidgetPage.cshtml" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
|
||||
<Import Project="$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v10.0\WebApplications\Microsoft.WebApplication.targets" />
|
||||
|
21
src/Orchard.Web/Modules/Orchard.Widgets/Shapes.cs
Normal file
21
src/Orchard.Web/Modules/Orchard.Widgets/Shapes.cs
Normal file
@@ -0,0 +1,21 @@
|
||||
using Orchard.ContentManagement;
|
||||
using Orchard.DisplayManagement.Descriptors;
|
||||
using Orchard.Widgets.Models;
|
||||
|
||||
namespace Orchard.Widgets {
|
||||
public class Shapes : IShapeTableProvider {
|
||||
public void Discover(ShapeTableBuilder builder) {
|
||||
builder.Describe("Items_Widget")
|
||||
.OnDisplaying(displaying => {
|
||||
ContentItem contentItem = displaying.Shape.ContentItem;
|
||||
if (contentItem != null) {
|
||||
var zoneName = contentItem.As<WidgetPart>().Zone;
|
||||
displaying.ShapeMetadata.Alternates.Add("Items_Widget__" + contentItem.ContentType);
|
||||
displaying.ShapeMetadata.Alternates.Add("Items_Widget__" + zoneName);
|
||||
//...would like...
|
||||
//displaying.ShapeMetadata.Alternates.Add("Items_Widget__" + zoneName + "__" + contentItem.ContentType);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
@@ -0,0 +1,10 @@
|
||||
@if(Model.Content != null) {
|
||||
<article>
|
||||
@if(Model.Header != null) {
|
||||
<header>
|
||||
@Display(Model.Header)
|
||||
</header>
|
||||
}
|
||||
@Display(Model.Content)
|
||||
</article>
|
||||
}
|
@@ -1,2 +1,2 @@
|
||||
@Display(Model.Header)
|
||||
@Display(Model.Content)
|
||||
@Display(Model.Content)
|
@@ -141,12 +141,10 @@
|
||||
<Content Include="Themes\TheThemeMachine\Theme.png" />
|
||||
<Content Include="Themes\TheThemeMachine\Theme.txt" />
|
||||
<None Include="Themes\Classic\App_Data\Localization\fr-FR\orchard.theme.po" />
|
||||
<None Include="Themes\TheThemeMachine\Views\AsideThird.cshtml" />
|
||||
<None Include="Themes\TheThemeMachine\Views\_Document.cshtml" />
|
||||
<Content Include="Themes\TheThemeMachine\Views\Items_Widget-HtmlWidget.cshtml" />
|
||||
<Content Include="Web.config">
|
||||
<SubType>Designer</SubType>
|
||||
</Content>
|
||||
<None Include="Themes\TheThemeMachine\Views\MenuItem.cshtml" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\Orchard\Orchard.Framework.csproj">
|
||||
@@ -317,10 +315,8 @@
|
||||
<Content Include="Themes\TheAdmin\Views\Header.cshtml" />
|
||||
<Content Include="Themes\Web.config" />
|
||||
<Content Include="Themes\TheThemeMachine\Views\Items\Content.Blog.cshtml" />
|
||||
<Content Include="Themes\TheThemeMachine\Views\Items_Widget-Content.cshtml" />
|
||||
<None Include="Themes\TheThemeMachine\Views\Layout.cshtml" />
|
||||
<None Include="Themes\TheThemeMachine\Views\Menu.cshtml">
|
||||
<SubType>Designer</SubType>
|
||||
</None>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Folder Include="App_Data\" />
|
||||
|
@@ -1,14 +0,0 @@
|
||||
<div>
|
||||
<h1>First Leader Aside</h1>
|
||||
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Curabitur a nibh ut tortor dapibus vestibulum. Aliquam vel sem nibh. Suspendisse vel condimentum tellus.</p>
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<h1>Second Leader Aside</h1>
|
||||
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Curabitur a nibh ut tortor dapibus vestibulum. Aliquam vel sem nibh. Suspendisse vel condimentum tellus.</p>
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<h1>Third Leader Aside</h1>
|
||||
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Curabitur a nibh ut tortor dapibus vestibulum. Aliquam vel sem nibh. Suspendisse vel condimentum tellus.</p>
|
||||
</div>
|
@@ -0,0 +1,17 @@
|
||||
@using Orchard.ContentManagement;
|
||||
@using Orchard.Widgets.Models;
|
||||
@{
|
||||
var title = ((IContent)Model.ContentItem).As<WidgetPart>().Title;
|
||||
}
|
||||
<article>
|
||||
<header>
|
||||
<h1>@title</h1>
|
||||
@Display(Model.Header)
|
||||
</header>
|
||||
@Display(Model.Content)
|
||||
@if(Model.Footer != null) {
|
||||
<footer>
|
||||
@Display(Model.Footer)
|
||||
</footer>
|
||||
}
|
||||
</article>
|
@@ -0,0 +1,11 @@
|
||||
@using Orchard.ContentManagement;
|
||||
@using Orchard.Widgets.Models;
|
||||
@{
|
||||
var title = ((IContent)Model.ContentItem).As<WidgetPart>().Title;
|
||||
}
|
||||
<div>
|
||||
<h1>@title</h1>
|
||||
@Display(Model.Header)
|
||||
@Display(Model.Content)
|
||||
@Display(Model.Footer)
|
||||
</div>
|
@@ -43,71 +43,54 @@
|
||||
@using(Capture(branding => WorkContext.Layout.Header.Add(branding) )) {
|
||||
<h1 id="branding"><a href="@homeUrl">@WorkContext.CurrentSite.SiteName</a></h1>
|
||||
}
|
||||
|
||||
<header id="layout-header">
|
||||
@if(Model.Header != null) {
|
||||
<div id="header">
|
||||
@Zone(Model.Header)
|
||||
</div>
|
||||
}
|
||||
</header>
|
||||
|
||||
|
||||
@if(Model.Navigation != null) {
|
||||
<div id="navigation" class="group">
|
||||
@Zone(Model.Navigation)
|
||||
</div>
|
||||
}
|
||||
|
||||
|
||||
@if(Model.Header != null) {
|
||||
<header id="layout-header">
|
||||
<div id="header">
|
||||
@Zone(Model.Header)
|
||||
</div>
|
||||
</header>
|
||||
}
|
||||
@if(Model.Navigation != null) {
|
||||
<div id="navigation" class="group">
|
||||
@Zone(Model.Navigation)
|
||||
</div>
|
||||
}
|
||||
<div id="layout-content" class="group">
|
||||
@if(Model.Messages != null) {
|
||||
<div id="messages">
|
||||
@Zone(Model.Messages)
|
||||
</div>
|
||||
}
|
||||
|
||||
@if(Model.AsideSecond != null) {
|
||||
<aside class="aside second">
|
||||
@Zone(Model.AsideSecond)
|
||||
</aside>
|
||||
}
|
||||
|
||||
@* the model content for the page is in the Content zone @ the default position (nothing, zero, zilch) *@
|
||||
@if(Model.Content != null) {
|
||||
<div id="content" class="group">
|
||||
@Zone(Model.Content)
|
||||
</div>
|
||||
}
|
||||
|
||||
|
||||
@if(Model.AsideFirst != null) {
|
||||
<aside class="aside first">
|
||||
@Zone(Model.AsideFirst)
|
||||
</aside>
|
||||
|
||||
@* Create a zone and only show it on the home page. *@
|
||||
|
||||
@if (Request.Path == "/OrchardLocal") {
|
||||
WorkContext.Layout.AsideThird.Add(New.AsideThird());
|
||||
}
|
||||
}
|
||||
@if(Model.AsideThird != null) {
|
||||
<aside class="aside third group">
|
||||
@Zone(Model.AsideThird)
|
||||
</aside>
|
||||
}
|
||||
|
||||
</div>
|
||||
|
||||
@if(Model.Footer != null) {
|
||||
<footer id="layout-footer" class="group">
|
||||
@Zone(Model.Footer)
|
||||
</footer>
|
||||
}
|
||||
else {
|
||||
<footer id="layout-footer" class="group">
|
||||
Powered by Orchard © The Theme Machine 2010. @Display.User()
|
||||
</footer>
|
||||
@* span -> p (?) *@
|
||||
@using(Capture(pbo => WorkContext.Layout.Footer.Add(pbo) )) {
|
||||
<span>Powered by Orchard © The Theme Machine 2010.</span>
|
||||
}
|
||||
@if(Model.Footer != null) {
|
||||
<footer id="layout-footer" class="group">
|
||||
@Zone(Model.Footer)
|
||||
@Display.User()
|
||||
</footer>
|
||||
}
|
||||
|
||||
@tag.EndElement
|
@@ -1,10 +0,0 @@
|
||||
@{
|
||||
// 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>
|
@@ -1,22 +0,0 @@
|
||||
@{
|
||||
// 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 {
|
||||
if (Model.Href.TrimEnd('/').ToUpperInvariant() == Request.Path.TrimEnd('/').ToUpperInvariant()) {
|
||||
Model.Classes.Add("current");
|
||||
}
|
||||
var tag = Tag(Model, "li");
|
||||
@tag.StartElement
|
||||
<a href="@Model.Href">@Model.Text</a>
|
||||
if (items.Any()) {
|
||||
<ul>
|
||||
@DisplayChildren(Model)
|
||||
</ul>
|
||||
}
|
||||
@tag.EndElement
|
||||
}
|
||||
}
|
@@ -1,21 +0,0 @@
|
||||
@using Orchard.Mvc.Html;
|
||||
@using Orchard.UI.Resources;
|
||||
@{
|
||||
RegisterLink(new LinkEntry {Type = "image/x-icon", Rel = "shortcut icon", Href = Url.Content("~/modules/orchard.themes/Content/orchard.ico")});
|
||||
//todo: (heskew) get conditions (as in conditional comments) hooked up for script tags too
|
||||
Script.Include("html5.js").AtLocation(ResourceLocation.Head);
|
||||
}
|
||||
<!DOCTYPE html>
|
||||
<html lang="en" class="static @Html.ClassForPage()">
|
||||
<head>
|
||||
<meta charset="utf-8" />
|
||||
<title>@Model.Title</title>
|
||||
@Display(Model.Head)
|
||||
<script>(function(d){d.className="dyn"+d.className.substring(6,d.className.length);})(document.documentElement);</script>
|
||||
</head>
|
||||
<body>
|
||||
@* Layout (template) is in the Body zone @ the default position (nothing, zero, zilch) *@
|
||||
@Display(Model.Body)
|
||||
@Display(Model.Tail)
|
||||
</body>
|
||||
</html>
|
Reference in New Issue
Block a user