Renaming that which cannot be renamed

--HG--
extra : convert_revision : svn%3A5ff7c347-ad56-4c35-b696-ccb81de16e03/trunk%4044815
This commit is contained in:
loudej
2009-12-31 07:26:19 +00:00
parent 7594a1b656
commit d0e2cc94f2
11 changed files with 174 additions and 0 deletions

View File

@@ -0,0 +1,6 @@
using Orchard.ContentManagement;
namespace Orchard.Tests.ContentManagement.Models {
public class Alpha : ContentPart {
}
}

View File

@@ -0,0 +1,20 @@
using System.Collections.Generic;
using Orchard.ContentManagement;
using Orchard.ContentManagement.Handlers;
using Orchard.ContentManagement.ViewModels;
namespace Orchard.Tests.ContentManagement.Models {
public class AlphaHandler : ContentHandler {
public AlphaHandler() {
OnGetDisplayViewModel<Alpha>((ctx, part) => ctx.AddDisplay(new TemplateViewModel(part) { Position = "3" }));
}
public override IEnumerable<ContentType> GetContentTypes() {
return new[] { new ContentType { Name = "alpha" } };
}
protected override void Activating(ActivatingContentContext context) {
if (context.ContentType == "alpha") {
context.Builder.Weld<Alpha>();
}
}
}
}

View File

@@ -0,0 +1,6 @@
using Orchard.ContentManagement;
namespace Orchard.Tests.ContentManagement.Models {
public class Beta : ContentPart {
}
}

View File

@@ -0,0 +1,20 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Orchard.ContentManagement;
using Orchard.ContentManagement.Handlers;
namespace Orchard.Tests.ContentManagement.Models {
public class BetaHandler : ContentHandler {
public override System.Collections.Generic.IEnumerable<Orchard.ContentManagement.ContentType> GetContentTypes() {
return new[] { new ContentType { Name = "beta" } };
}
protected override void Activating(ActivatingContentContext context) {
if (context.ContentType == "beta") {
context.Builder.Weld<Beta>();
}
}
}
}

View File

@@ -0,0 +1,25 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Orchard.Data;
using Orchard.ContentManagement;
using Orchard.ContentManagement.Handlers;
using Orchard.Tests.ContentManagement.Records;
namespace Orchard.Tests.ContentManagement.Models {
public class Delta : ContentPart<DeltaRecord> {
}
public class DeltaHandler : ContentHandler {
public override System.Collections.Generic.IEnumerable<Orchard.ContentManagement.ContentType> GetContentTypes() {
return new[] { new ContentType { Name = "delta" } };
}
public DeltaHandler(IRepository<DeltaRecord> repository) {
Filters.Add(new ActivatingFilter<Delta>(x => x == "delta"));
Filters.Add(new StorageFilter<DeltaRecord>(repository));
}
}
}

View File

@@ -0,0 +1,23 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Orchard.ContentManagement;
using Orchard.ContentManagement.Handlers;
using Orchard.Data;
using Orchard.Tests.ContentManagement.Records;
namespace Orchard.Tests.ContentManagement.Models {
public class Epsilon : ContentPart<EpsilonRecord> {
}
public class EpsilonHandler : ContentHandler {
public EpsilonHandler(IRepository<EpsilonRecord> repository) {
Filters.Add(new ActivatingFilter<Epsilon>(x => x == "gamma"));
Filters.Add(new StorageVersionFilter<EpsilonRecord>(repository));
}
}
}

View File

@@ -0,0 +1,10 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Orchard.ContentManagement;
namespace Orchard.Tests.ContentManagement.Models {
class Flavored : ContentPart {
}
}

View File

@@ -0,0 +1,15 @@
using Orchard.ContentManagement.Handlers;
using Orchard.ContentManagement.ViewModels;
namespace Orchard.Tests.ContentManagement.Models {
public class FlavoredHandler : ContentHandler {
public FlavoredHandler() {
OnGetDisplayViewModel<Flavored>((ctx, part) => ctx.AddDisplay(new TemplateViewModel(part)));
}
protected override void Activating(ActivatingContentContext context) {
if (context.ContentType == "beta" || context.ContentType == "alpha") {
context.Builder.Weld<Flavored>();
}
}
}
}

View File

@@ -0,0 +1,23 @@
using Orchard.Data;
using Orchard.ContentManagement;
using Orchard.ContentManagement.Handlers;
using Orchard.Tests.ContentManagement.Records;
namespace Orchard.Tests.ContentManagement.Models {
public class Gamma : ContentPart<GammaRecord> {
}
public class GammaHandler : ContentHandler {
public override System.Collections.Generic.IEnumerable<ContentType> GetContentTypes() {
return new[] { new ContentType { Name = "gamma" } };
}
public GammaHandler(IRepository<GammaRecord> repository) {
Filters.Add(new ActivatingFilter<Gamma>(x => x == "gamma"));
Filters.Add(new StorageFilter<GammaRecord>(repository));
}
}
}

View File

@@ -0,0 +1,10 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Orchard.ContentManagement;
namespace Orchard.Tests.ContentManagement.Models {
public class Styled : ContentPart {
}
}

View File

@@ -0,0 +1,16 @@
using Orchard.ContentManagement.Handlers;
using Orchard.ContentManagement.ViewModels;
namespace Orchard.Tests.ContentManagement.Models {
public class StyledHandler : ContentHandler {
public StyledHandler() {
OnGetDisplayViewModel<Styled>((ctx, part) => ctx.AddDisplay(new TemplateViewModel(part) { Position = "10" }));
}
protected override void Activating(ActivatingContentContext context) {
if (context.ContentType == "alpha") {
context.Builder.Weld<Styled>();
}
}
}
}