mirror of
https://github.com/OrchardCMS/Orchard.git
synced 2025-10-15 19:54:57 +08:00
Changing AddOnXxx to OnXxx in the content provider. Starting to hook up BodyAspect.
--HG-- extra : convert_revision : svn%3A5ff7c347-ad56-4c35-b696-ccb81de16e03/trunk%4042764
This commit is contained in:
@@ -1,8 +1,7 @@
|
||||
using Orchard.Core.Common.Records;
|
||||
using Orchard.Models;
|
||||
|
||||
namespace Orchard.Core.Common.Models {
|
||||
public class BodyAspect : ContentPart {
|
||||
public string Body { get; set; }
|
||||
public string Format { get; set; }
|
||||
public class BodyAspect : ContentPart<BodyRecord> {
|
||||
}
|
||||
}
|
||||
|
@@ -1,7 +1,18 @@
|
||||
using System;
|
||||
using Orchard.Core.Common.Models;
|
||||
using Orchard.Core.Common.Records;
|
||||
using Orchard.Data;
|
||||
using Orchard.Models.Driver;
|
||||
|
||||
namespace Orchard.Core.Common.Providers {
|
||||
public class BodyAspectProvider : ContentProvider {
|
||||
public BodyAspectProvider(IRepository<BodyRecord> bodyRepository) {
|
||||
Filters.Add(new StorageFilter<BodyRecord>(bodyRepository));
|
||||
OnGetEditors<BodyAspect>();
|
||||
}
|
||||
|
||||
private void OnGetEditors<TPart>() {
|
||||
|
||||
}
|
||||
}
|
||||
}
|
@@ -23,9 +23,9 @@ namespace Orchard.Core.Common.Providers {
|
||||
_authenticationService = authenticationService;
|
||||
_contentManager = contentManager;
|
||||
|
||||
AddOnActivated<CommonAspect>(PropertySetHandlers);
|
||||
AddOnCreating<CommonAspect>(DefaultTimestampsAndOwner);
|
||||
AddOnLoaded<CommonAspect>(LazyLoadHandlers);
|
||||
OnActivated<CommonAspect>(PropertySetHandlers);
|
||||
OnCreating<CommonAspect>(DefaultTimestampsAndOwner);
|
||||
OnLoaded<CommonAspect>(LazyLoadHandlers);
|
||||
Filters.Add(new StorageFilter<CommonRecord>(repository));
|
||||
}
|
||||
|
||||
|
@@ -9,7 +9,7 @@ namespace Orchard.Blogs.Models {
|
||||
|
||||
public Blog Blog { get; set; }
|
||||
public string Title { get { return this.As<RoutableAspect>().Title; } }
|
||||
public string Body { get { return this.As<BodyAspect>().Body; } }
|
||||
public string Body { get { return this.As<BodyAspect>().Record.Body; } }
|
||||
public string Slug { get { return this.As<RoutableAspect>().Slug; } }
|
||||
public IUser Creator { get { return this.As<CommonAspect>().OwnerField.Value; } }
|
||||
public DateTime? Published { get { return Record.Published; } }
|
||||
|
@@ -16,7 +16,7 @@ namespace Orchard.Blogs.Models {
|
||||
Filters.Add(new ActivatingFilter<RoutableAspect>("blogpost"));
|
||||
Filters.Add(new ActivatingFilter<BodyAspect>("blogpost"));
|
||||
Filters.Add(new StorageFilter<BlogPostRecord>(repository));
|
||||
AddOnLoaded<BlogPost>((context, bp) => bp.Blog = contentManager.Get<Blog>(bp.Record.Blog.Id));
|
||||
OnLoaded<BlogPost>((context, bp) => bp.Blog = contentManager.Get<Blog>(bp.Record.Blog.Id));
|
||||
}
|
||||
}
|
||||
}
|
@@ -23,7 +23,7 @@ namespace Orchard.Comments.Models {
|
||||
Filters.Add(new ActivatingFilter<CommentSettings>("site"));
|
||||
Filters.Add(new StorageFilter<CommentSettingsRecord>(_commentSettingsRepository) { AutomaticallyCreateMissingRecord = true });
|
||||
Filters.Add(new TemplateFilterForRecord<CommentSettingsRecord>("CommentSettings"));
|
||||
AddOnActivated<CommentSettings>(DefaultSettings);
|
||||
OnActivated<CommentSettings>(DefaultSettings);
|
||||
}
|
||||
|
||||
private static void DefaultSettings(ActivatedContentContext context, CommentSettings settings) {
|
||||
|
@@ -16,7 +16,7 @@ namespace Orchard.Media.Models {
|
||||
public MediaSettingsProvider(IRepository<MediaSettingsRecord> repository) {
|
||||
Filters.Add(new ActivatingFilter<MediaSettings>("site"));
|
||||
Filters.Add(new StorageFilter<MediaSettingsRecord>(repository) { AutomaticallyCreateMissingRecord = true });
|
||||
AddOnActivated<MediaSettings>(DefaultSettings);
|
||||
OnActivated<MediaSettings>(DefaultSettings);
|
||||
}
|
||||
|
||||
private static void DefaultSettings(ActivatedContentContext context, MediaSettings settings) {
|
||||
|
@@ -22,7 +22,7 @@ namespace Orchard.Roles.Models {
|
||||
_notifier = notifier;
|
||||
|
||||
Filters.Add(new ActivatingFilter<UserRoles>("user"));
|
||||
AddOnLoaded<UserRoles>((context, userRoles) => {
|
||||
OnLoaded<UserRoles>((context, userRoles) => {
|
||||
userRoles.Roles = _userRolesRepository
|
||||
.Fetch(x => x.UserId == context.ContentItem.Id)
|
||||
.Select(x => x.Role.Name).ToList();
|
||||
|
@@ -16,7 +16,7 @@ namespace Orchard.Tags.Models {
|
||||
Filters.Add(new ActivatingFilter<TagSettings>("site"));
|
||||
Filters.Add(new StorageFilter<TagSettingsRecord>(repository) { AutomaticallyCreateMissingRecord = true });
|
||||
Filters.Add(new TemplateFilterForRecord<TagSettingsRecord>("TagSettings"));
|
||||
AddOnActivated<TagSettings>(DefaultSettings);
|
||||
OnActivated<TagSettings>(DefaultSettings);
|
||||
}
|
||||
|
||||
private static void DefaultSettings(ActivatedContentContext context, TagSettings settings) {
|
||||
|
Reference in New Issue
Block a user