This commit is contained in:
Daniel Stolt 2013-10-19 20:46:21 +02:00
commit 30f9d28fbc
7 changed files with 24 additions and 19 deletions

View File

@ -15,14 +15,6 @@ namespace Orchard.Core.Navigation.Handlers {
_contentManager = contentManager;
}
protected override void GetItemMetadata(GetContentItemMetadataContext context) {
if(context.ContentItem.ContentType != "Menu") {
return;
}
context.Metadata.Identity.Add("name", context.ContentItem.As<TitlePart>().Title);
}
protected override void Removing(RemoveContentContext context) {
if (context.ContentItem.ContentType != "Menu") {
return;

View File

@ -190,5 +190,13 @@ namespace Orchard.Core.Navigation {
return 5;
}
public int UpdateFrom5() {
ContentDefinitionManager.AlterTypeDefinition("Menu", cfg => cfg
.WithPart("IdentityPart")
);
return 6;
}
}
}

View File

@ -148,6 +148,10 @@
<Project>{9916839C-39FC-4CEB-A5AF-89CA7E87119F}</Project>
<Name>Orchard.Core</Name>
</ProjectReference>
<ProjectReference Include="..\Orchard.Autoroute\Orchard.Autoroute.csproj">
<Project>{66fccd76-2761-47e3-8d11-b45d0001ddaa}</Project>
<Name>Orchard.Autoroute</Name>
</ProjectReference>
<ProjectReference Include="..\Orchard.ContentPicker\Orchard.ContentPicker.csproj">
<Project>{f301ef7d-f19c-4d83-aa94-cb64f29c037d}</Project>
<Name>Orchard.ContentPicker</Name>

View File

@ -1,6 +1,7 @@
using System.Collections.Generic;
using System.Linq;
using JetBrains.Annotations;
using Orchard.Autoroute.Models;
using Orchard.Blogs.Models;
using Orchard.Blogs.Routing;
using Orchard.ContentManagement;
@ -19,7 +20,7 @@ namespace Orchard.Blogs.Services {
}
public BlogPart Get(string path) {
return _contentManager.Query<BlogPart>().List().FirstOrDefault(rr => rr.As<IAliasAspect>().Path == path);
return _contentManager.Query<AutoroutePart, AutoroutePartRecord>().Where(r => r.DisplayAlias == path).ForPart<BlogPart>().Slice(0, 1).FirstOrDefault();
}
public ContentItem Get(int id, VersionOptions versionOptions) {

View File

@ -30,7 +30,7 @@ namespace Orchard.Comments.Controllers {
return this.RedirectLocal(returnUrl, "~/");
var comment = Services.ContentManager.New<CommentPart>("Comment");
Services.ContentManager.Create(comment);
Services.ContentManager.Create(comment, VersionOptions.Draft);
var editorShape = Services.ContentManager.UpdateEditor(comment, this);

View File

@ -13,11 +13,9 @@ namespace Orchard.Roles.Handlers {
_userRolesRepository = userRolesRepository;
Filters.Add(new ActivatingFilter<UserRolesPart>("User"));
OnLoaded<UserRolesPart>((context, userRoles) => {
userRoles.Roles = _userRolesRepository
.Fetch(x => x.UserId == context.ContentItem.Id)
.Select(x => x.Role.Name).ToList();
});
OnInitialized<UserRolesPart>((context, userRoles) => userRoles._roles.Loader(value => _userRolesRepository
.Fetch(x => x.UserId == context.ContentItem.Id)
.Select(x => x.Role.Name).ToList()));
}
}
}

View File

@ -1,12 +1,14 @@
using System.Collections.Generic;
using Orchard.ContentManagement;
using Orchard.ContentManagement.Utilities;
namespace Orchard.Roles.Models {
public class UserRolesPart : ContentPart, IUserRoles {
public UserRolesPart() {
Roles = new List<string>();
}
public IList<string> Roles { get; set; }
internal LazyField<IList<string>> _roles = new LazyField<IList<string>>();
public IList<string> Roles {
get { return _roles.Value; }
}
}
}