--HG--
branch : dev
This commit is contained in:
Andre Rodrigues
2010-11-29 17:37:22 -08:00
23 changed files with 345 additions and 162 deletions

View File

@@ -8,17 +8,24 @@ using Orchard.Core.Routable.Models;
using Orchard.Core.Routable.Services;
using Orchard.Core.Routable.ViewModels;
using Orchard.Localization;
using Orchard.Mvc;
using Orchard.Services;
using Orchard.Utility.Extensions;
namespace Orchard.Core.Routable.Drivers {
public class RoutePartDriver : ContentPartDriver<RoutePart> {
private readonly IOrchardServices _services;
private readonly IRoutableService _routableService;
private readonly IHttpContextAccessor _httpContextAccessor;
private readonly IHomePageProvider _routableHomePageProvider;
public RoutePartDriver(IOrchardServices services, IRoutableService routableService, IEnumerable<IHomePageProvider> homePageProviders) {
public RoutePartDriver(IOrchardServices services,
IRoutableService routableService,
IEnumerable<IHomePageProvider> homePageProviders,
IHttpContextAccessor httpContextAccessor) {
_services = services;
_routableService = routableService;
_httpContextAccessor = httpContextAccessor;
_routableHomePageProvider = homePageProviders.SingleOrDefault(p => p.GetProviderName() == RoutableHomePageProvider.Name);
T = NullLocalizer.Instance;
}
@@ -59,10 +66,9 @@ namespace Orchard.Core.Routable.Drivers {
ContainerId = GetContainerId(part),
};
var containerPath = part.GetContainerPath();
model.DisplayLeadingPath = !string.IsNullOrWhiteSpace(containerPath)
? string.Format("{0}/", containerPath)
: "";
var request = _httpContextAccessor.Current().Request;
var containerUrl = new UriBuilder(request.ToRootUrlString()) { Path = (request.ApplicationPath ?? "").TrimEnd('/') + "/" + (part.GetContainerPath() ?? "") };
model.ContainerAbsoluteUrl = containerUrl.Uri.ToString().TrimEnd('/');
model.PromoteToHomePage = model.Id != 0 && part.Path != null && _routableHomePageProvider != null && _services.WorkContext.CurrentSite.HomePage == _routableHomePageProvider.GetSettingValue(model.Id);
return ContentShape("Parts_Routable_Edit",

View File

@@ -1,5 +1,4 @@
using System;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations;
namespace Orchard.Core.Routable.ViewModels {
public class RoutableEditorViewModel {
@@ -15,6 +14,6 @@ namespace Orchard.Core.Routable.ViewModels {
public int? ContainerId { get; set; }
public bool PromoteToHomePage { get; set; }
public string DisplayLeadingPath { get; set; }
public string ContainerAbsoluteUrl { get; set; }
}
}

View File

@@ -7,7 +7,7 @@
@Html.TextBoxFor(m => m.Title, new { @class = "large text" })
</fieldset>
<fieldset class="permalink">
<label class="sub" for="Slug">@T("Permalink")<br /><span>@Request.ToApplicationRootUrlString()/@Model.DisplayLeadingPath</span></label>
<label class="sub" for="Slug">@T("Permalink")<br /><span>@Model.ContainerAbsoluteUrl/</span></label>
<span>@Html.TextBoxFor(m => m.Slug, new { @class = "text" })</span>
<span class="checkbox-and-label">
@Html.EditorFor(m => m.PromoteToHomePage)

View File

@@ -225,7 +225,14 @@ namespace Orchard.Core.Shapes {
foreach (var context in requiredResources.Where(r =>
(includeLocation.HasValue ? r.Settings.Location == includeLocation.Value : true) &&
(excludeLocation.HasValue ? r.Settings.Location != excludeLocation.Value : true))) {
var condition = context.Settings.Condition;
if (!string.IsNullOrEmpty(condition)) {
html.ViewContext.Writer.WriteLine("<!--[if " + condition + "]>");
}
html.ViewContext.Writer.WriteLine(context.GetTagBuilder(defaultSettings, appPath).ToString(context.Resource.TagRenderMode));
if (!string.IsNullOrEmpty(condition)) {
html.ViewContext.Writer.WriteLine("<![endif]-->");
}
}
}

View File

@@ -44,10 +44,11 @@
}
var dependencies = (from d in feature.Descriptor.Dependencies
select (from f in Model.Features where f.Descriptor.Id == d select f).SingleOrDefault()).Where(f => f != null).OrderBy(f => f.Descriptor.Name);
@* todo: missingDependencies -- show them in a special way. Can be found like this:
var missingDependencies = feature.Descriptor.Dependencies
.Where(d => !Model.Features.Any(f => f.Descriptor.Id == d));
*@
if (showActions) {
showActions = missingDependencies.Count() == 0;
}
<li class="@featureClassName" id="@featureId" title="@T("{0} is {1}", Html.AttributeEncode(featureName), featureState)">
<div class="summary">
<div class="properties">
@@ -61,6 +62,11 @@
"dependency",
"")
</div>}
@if (missingDependencies.Any()) {
<div class="missingdependencies">
<h4>@T("Missing:")</h4>
@Html.UnorderedList(missingDependencies, (s, i) => MvcHtmlString.Create(s), "", "missingdependency", "")
</div>}
</div>
<div class="actions">
@if (showActions) {

View File

@@ -107,6 +107,24 @@
.features .dependencies li:last-child::after {
content:"";
}
.features .missingdependencies {
font-size:.9em;
color:Red;
margin:.44em 0 0;
}
.features .missingdependencies>* {
display:inline;
}
.features .missingdependencies li {
display:inline;
margin-left:.5em;
}
.features .missingdependencies li::after {
content:", ";
}
.features .missingdependencies li:last-child::after {
content:"";
}
.features .feature .actions {
position:absolute;
right:.4em;

View File

@@ -283,7 +283,25 @@ namespace Orchard.Setup.Services {
page.As<RoutePart>().Title = T("Welcome to Orchard!").Text;
page.As<RoutePart>().Path = "";
page.As<RoutePart>().Slug = "";
page.As<BodyPart>().Text = string.Format(CultureInfo.CurrentCulture, "<p>Youve successfully setup your Orchard Site and this is the homepage of your new site. Here are a few things you can look at to get familiar with the application. Once you feel confident you dont need this anymore, you can <a href=\"Admin/Contents/Edit/{0}\">remove this by going into editing mode</a> and replacing it with whatever you want.</p><p>First things first - Youll probably want to <a href=\"Admin/Settings\">manage your settings</a> and configure Orchard to your liking. After that, you can head over to <a href=\"Admin/Themes\">manage themes to change or install new themes</a> and really make it your own. Once youre happy with a look and feel, its time for some content. You can start creating new custom content types or start with some built-in ones by <a href=\"Admin/Pages/Create\">adding a page</a>, <a href=\"Admin/Blogs/Create\">creating a blog</a> or <a href=\"Admin/Navigation\">managing your menus.</a></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. If youre looking to add additional functionality, you can do so by creating your own module or installing a new one that someone has made. Modules are created by other users of Orchard just like you so if you feel up to it, <a href=\"http://www.orchardproject.net/\">please consider participating</a>. XOXO The Orchard Team </p>", page.Id);
page.As<BodyPart>().Text = T(
@"<p>You've successfully setup your Orchard Site and this is the homepage of your new site.
Here are a few things you can look at to get familiar with the application.
Once you feel confident you don't need this anymore, you can
<a href=""Admin/Contents/Edit/{0}"">remove it by going into editing mode</a>
and replacing it with whatever you want.</p>
<p>First things first - You'll probably want to <a href=""Admin/Settings"">manage your settings</a>
and configure Orchard to your liking. After that, you can head over to
<a href=""Admin/Themes"">manage themes to change or install new themes</a>
and really make it your own. Once you're happy with a look and feel, it's time for some content.
You can start creating new custom content types or start from the built-in ones by
<a href=""Admin/Pages/Create"">adding a page</a>, <a href=""Admin/Blogs/Create"">creating a blog</a>
or <a href=""Admin/Navigation"">managing your menus.</a></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. If you're looking to add additional functionality,
you can do so by creating your own module or by installing one that somebody else built.
Modules are created by other users of Orchard just like you so if you feel up to it,
<a href=""http://orchardproject.net/contribution"">please consider participating</a>.</p>
<p>Thanks for using Orchard The Orchard Team </p>", page.Id).Text;
contentManager.Publish(page);
siteSettings.Record.HomePage = "RoutableHomePageProvider;" + page.Id;

View File

@@ -425,7 +425,7 @@ span.message {
border:1px solid #ffea9b;
}
.message-Error {
background:#e68585; /* green */
background:#e68585; /* red */
border:1px solid #990808;
color:#fff;
}.debug.message {
@@ -477,6 +477,8 @@ label input {
}
.hint {
display:block;
font-size:0.923em;
color:#7c7c7c;
}
/* todo: (heskew) try to get .text on stuff like .text-box */
select, textarea, input.text, input.textMedium, input.text-box {
@@ -821,7 +823,7 @@ table.items th, table.items td {
/* Core Modules
----------------------------------------------------------*/
***************************************************************/
/* Routable */
.permalink input.text {
background:transparent;
@@ -897,7 +899,7 @@ fieldset.publish-later-datetime input {
}
/* Fields
----------------------------------------------------------*/
***************************************************************/
/* TextField */
#main .summary p.text-field {
margin:.5em 0;

View File

@@ -143,7 +143,7 @@ aside h6 { font-size: 1em; }
/* Lists */
li ul,
li ol { margin:0 1.5em; }
ul, ol { margin: 0 1.5em 1.5em 1.5em; }
ul, ol { margin: 1.5em; line-height: 1.538em; }
ul { list-style-type: disc; }
ol { list-style-type: decimal; }
@@ -391,6 +391,12 @@ nav ul
.search-results .blog-post .metadata .published { display: inline; margin: 0 6px 0 0; }
.search-results .blog-post .metadata .commentcount { display: inline; }
/* Confirmations */
.message, .validation-summary-errors { margin:10px 0 4px 0; padding:4px; }
.messages a { font-weight:bold; }
.message-Information { background:#e6f1c9; /* green */ border:1px solid #cfe493; color:#062232; }
.message-Warning { background:#fdf5bc; /* yellow */ border:1px solid #ffea9b; }
.critical.message, .validation-summary-errors, .message-Error { background:#e68585; /* red */ border:1px solid #990808; color:#fff; }
/* Secondary

View File

@@ -1 +1 @@
 <div class="credits"><span class="poweredby">@T("Powered by <a href=\"{0}\" title=\"Welcome to the New World Order\" target=\"_blank\">Orchard</a>", "http://www.orchardproject.net")</span> <span class="copyright">@T("&#169; The Theme Machine 2010.")</span></div>
 <div class="credits"><span class="poweredby">@T("Powered by <a href=\"{0}\" target=\"_blank\">Orchard</a>", "http://www.orchardproject.net")</span> <span class="copyright">@T("&#169; The Theme Machine 2010.")</span></div>