HasTags -> TagsPart

- updating part names to conform to a <name>Part convention

--HG--
branch : dev
rename : src/Orchard.Web/Modules/Orchard.Tags/Drivers/HasTagsDriver.cs => src/Orchard.Web/Modules/Orchard.Tags/Drivers/TagsPartDriver.cs
rename : src/Orchard.Web/Modules/Orchard.Tags/Handlers/HasTagsHandler.cs => src/Orchard.Web/Modules/Orchard.Tags/Handlers/TagsPartHandler.cs
rename : src/Orchard.Web/Modules/Orchard.Tags/Models/HasTags.cs => src/Orchard.Web/Modules/Orchard.Tags/Models/TagsPart.cs
This commit is contained in:
Nathan Heskew
2010-07-22 23:06:44 -07:00
parent 284732f0af
commit 5c801e50fa
8 changed files with 20 additions and 20 deletions

View File

@@ -25,7 +25,7 @@ namespace Orchard.Tags.DataMigrations {
return 1; return 1;
} }
public int UpdateFrom1() { public int UpdateFrom1() {
ContentDefinitionManager.AlterPartDefinition(typeof(HasTags).Name, cfg => cfg ContentDefinitionManager.AlterPartDefinition(typeof(TagsPart).Name, cfg => cfg
.WithLocation(new Dictionary<string, ContentLocation> { .WithLocation(new Dictionary<string, ContentLocation> {
{"Default", new ContentLocation { Zone = "primary", Position = "49" }}, {"Default", new ContentLocation { Zone = "primary", Position = "49" }},
{"Editor", new ContentLocation { Zone = "primary", Position = "9" }}, {"Editor", new ContentLocation { Zone = "primary", Position = "9" }},

View File

@@ -11,11 +11,11 @@ using Orchard.Tags.ViewModels;
namespace Orchard.Tags.Drivers { namespace Orchard.Tags.Drivers {
[UsedImplicitly] [UsedImplicitly]
public class HasTagsDriver : ContentPartDriver<HasTags> { public class TagsPartDriver : ContentPartDriver<TagsPart> {
private readonly ITagService _tagService; private readonly ITagService _tagService;
private readonly IAuthorizationService _authorizationService; private readonly IAuthorizationService _authorizationService;
public HasTagsDriver(ITagService tagService, public TagsPartDriver(ITagService tagService,
IAuthorizationService authorizationService) { IAuthorizationService authorizationService) {
_tagService = tagService; _tagService = tagService;
_authorizationService = authorizationService; _authorizationService = authorizationService;
@@ -23,11 +23,11 @@ namespace Orchard.Tags.Drivers {
public virtual IUser CurrentUser { get; set; } public virtual IUser CurrentUser { get; set; }
protected override DriverResult Display(HasTags part, string displayType) { protected override DriverResult Display(TagsPart part, string displayType) {
return ContentPartTemplate(part, "Parts/Tags.ShowTags").Location(part.GetLocation(displayType)); return ContentPartTemplate(part, "Parts/Tags.ShowTags").Location(part.GetLocation(displayType));
} }
protected override DriverResult Editor(HasTags part) { protected override DriverResult Editor(TagsPart part) {
if (!_authorizationService.TryCheckAccess(Permissions.ApplyTag, CurrentUser, part)) if (!_authorizationService.TryCheckAccess(Permissions.ApplyTag, CurrentUser, part))
return null; return null;
@@ -37,7 +37,7 @@ namespace Orchard.Tags.Drivers {
return ContentPartTemplate(model, "Parts/Tags.EditTags").Location(part.GetLocation("Editor")); return ContentPartTemplate(model, "Parts/Tags.EditTags").Location(part.GetLocation("Editor"));
} }
protected override DriverResult Editor(HasTags part, IUpdateModel updater) { protected override DriverResult Editor(TagsPart part, IUpdateModel updater) {
if (!_authorizationService.TryCheckAccess(Permissions.ApplyTag, CurrentUser, part)) if (!_authorizationService.TryCheckAccess(Permissions.ApplyTag, CurrentUser, part))
return null; return null;

View File

@@ -8,10 +8,10 @@ using Orchard.Tags.Models;
namespace Orchard.Tags.Handlers { namespace Orchard.Tags.Handlers {
[UsedImplicitly] [UsedImplicitly]
public class HasTagsHandler : ContentHandler { public class TagsPartHandler : ContentHandler {
public HasTagsHandler(IRepository<Tag> tagsRepository, IRepository<TagsContentItems> tagsContentItemsRepository) { public TagsPartHandler(IRepository<Tag> tagsRepository, IRepository<TagsContentItems> tagsContentItemsRepository) {
OnLoading<HasTags>((context, tags) => { OnLoading<TagsPart>((context, tags) => {
// provide names of all tags on demand // provide names of all tags on demand
tags._allTags.Loader(list => tagsRepository.Table.ToList()); tags._allTags.Loader(list => tagsRepository.Table.ToList());
@@ -28,11 +28,11 @@ namespace Orchard.Tags.Handlers {
}); });
OnRemoved<HasTags>((context, ht) => { OnRemoved<TagsPart>((context, tags) => {
tagsContentItemsRepository.Flush(); tagsContentItemsRepository.Flush();
HasTags tags = context.ContentItem.As<HasTags>(); TagsPart tagsPart = context.ContentItem.As<TagsPart>();
foreach (var tag in tags.CurrentTags) { foreach (var tag in tagsPart.CurrentTags) {
if (!tagsContentItemsRepository.Fetch(x => x.ContentItemId == context.ContentItem.Id).Any()) { if (!tagsContentItemsRepository.Fetch(x => x.ContentItemId == context.ContentItem.Id).Any()) {
tagsRepository.Delete(tag); tagsRepository.Delete(tag);
} }

View File

@@ -3,8 +3,8 @@ using Orchard.ContentManagement;
using Orchard.ContentManagement.Utilities; using Orchard.ContentManagement.Utilities;
namespace Orchard.Tags.Models { namespace Orchard.Tags.Models {
public class HasTags : ContentPart { public class TagsPart : ContentPart {
public HasTags() { public TagsPart() {
AllTags = new List<Tag>(); AllTags = new List<Tag>();
CurrentTags = new List<Tag>(); CurrentTags = new List<Tag>();
} }

View File

@@ -72,11 +72,11 @@
<Compile Include="Services\ITagService.cs" /> <Compile Include="Services\ITagService.cs" />
<Compile Include="ViewModels\EditTagsViewModel.cs" /> <Compile Include="ViewModels\EditTagsViewModel.cs" />
<Compile Include="Controllers\HomeController.cs" /> <Compile Include="Controllers\HomeController.cs" />
<Compile Include="Drivers\HasTagsDriver.cs" /> <Compile Include="Drivers\TagsPartDriver.cs" />
<Compile Include="Helpers\TagHelpers.cs" /> <Compile Include="Helpers\TagHelpers.cs" />
<Compile Include="Models\HasTags.cs" /> <Compile Include="Models\TagsPart.cs" />
<Compile Include="Models\Tag.cs" /> <Compile Include="Models\Tag.cs" />
<Compile Include="Handlers\HasTagsHandler.cs" /> <Compile Include="Handlers\TagsPartHandler.cs" />
<Compile Include="Permissions.cs" /> <Compile Include="Permissions.cs" />
<Compile Include="Properties\AssemblyInfo.cs" /> <Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="Routes.cs" /> <Compile Include="Routes.cs" />

View File

@@ -1,4 +1,4 @@
<%@ Control Language="C#" Inherits="Orchard.Mvc.ViewUserControl<HasTags>" %> <%@ Control Language="C#" Inherits="Orchard.Mvc.ViewUserControl<TagsPart>" %>
<%@ Import Namespace="Orchard.Tags.Models" %> <%@ Import Namespace="Orchard.Tags.Models" %>
<% if (Model.CurrentTags.Count > 0) { %> <% if (Model.CurrentTags.Count > 0) { %>
<p class="tags"> <p class="tags">

View File

@@ -1,4 +1,4 @@
<%@ Control Language="C#" Inherits="Orchard.Mvc.ViewUserControl<HasTags>" %> <%@ Control Language="C#" Inherits="Orchard.Mvc.ViewUserControl<TagsPart>" %>
<%@ Import Namespace="Orchard.Tags.Models" %> <%@ Import Namespace="Orchard.Tags.Models" %>
<% if (Model.CurrentTags.Count > 0) { %> <% if (Model.CurrentTags.Count > 0) { %>
<p class="tags group"> <p class="tags group">

View File

@@ -1,4 +1,4 @@
<%@ Control Language="C#" Inherits="Orchard.Mvc.ViewUserControl<HasTags>" %> <%@ Control Language="C#" Inherits="Orchard.Mvc.ViewUserControl<TagsPart>" %>
<%@ Import Namespace="Orchard.Tags.Models" %> <%@ Import Namespace="Orchard.Tags.Models" %>
<% if (Model.CurrentTags.Count > 0) { %> <% if (Model.CurrentTags.Count > 0) { %>
<p class="tags group"> <p class="tags group">