-
Notifications
You must be signed in to change notification settings - Fork 35
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
b7fdb7d
commit 587e970
Showing
24 changed files
with
183 additions
and
143 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
using Microsoft.Extensions.DependencyInjection; | ||
using Our.Umbraco.Meganav.PublishedContent; | ||
using Our.Umbraco.Meganav.ValueReferences; | ||
using Umbraco.Cms.Core.Composing; | ||
using Umbraco.Cms.Core.DependencyInjection; | ||
|
||
namespace Our.Umbraco.Meganav.Composing | ||
{ | ||
public class MeganavComposer : IComposer | ||
{ | ||
public void Compose(IUmbracoBuilder builder) | ||
{ | ||
builder.Services.AddTransient<PublishedElementFactory>(); | ||
|
||
builder.DataValueReferenceFactories().Append<MeganavValueReferenceFactory>(); | ||
} | ||
} | ||
} |
37 changes: 37 additions & 0 deletions
37
src/Our.Umbraco.Meganav/Migrations/LegacyDataTypeChangingHandler.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
using System.Linq; | ||
using Umbraco.Cms.Core.Events; | ||
using Umbraco.Cms.Core.Notifications; | ||
using Umbraco.Cms.Core.Services; | ||
using Umbraco.Extensions; | ||
|
||
namespace Our.Umbraco.Meganav.Migrations | ||
{ | ||
internal class LegacyDataTypeChangingHandler : INotificationHandler<DataTypeSavingNotification> | ||
{ | ||
private readonly IDataTypeService _dataTypeService; | ||
private readonly LegacyValueMigrator _legacyValueMigrator; | ||
|
||
public LegacyDataTypeChangingHandler(IDataTypeService dataTypeService, LegacyValueMigrator legacyValueMigrator) | ||
{ | ||
_dataTypeService = dataTypeService; | ||
_legacyValueMigrator = legacyValueMigrator; | ||
} | ||
|
||
public void Handle(DataTypeSavingNotification notification) | ||
{ | ||
var dataTypes = notification.SavedEntities | ||
.Where(x => x.EditorAlias == Constants.PropertyEditorAlias) | ||
.Where(x => | ||
{ | ||
var existingEntity = _dataTypeService.GetDataType(x.Id); | ||
|
||
return existingEntity != null && LegacyEditors.Aliases.Any(existingEntity.EditorAlias.InvariantContains); | ||
}); | ||
|
||
foreach (var dataType in dataTypes) | ||
{ | ||
_legacyValueMigrator.MigrateContentValues(dataType); | ||
} | ||
} | ||
} | ||
} |
47 changes: 0 additions & 47 deletions
47
src/Our.Umbraco.Meganav/Migrations/LegacyMigrationComponent.cs
This file was deleted.
Oops, something went wrong.
14 changes: 8 additions & 6 deletions
14
src/Our.Umbraco.Meganav/Migrations/LegacyMigrationComposer.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,17 @@ | ||
using Umbraco.Core; | ||
using Umbraco.Core.Composing; | ||
using Microsoft.Extensions.DependencyInjection; | ||
using Umbraco.Cms.Core.Composing; | ||
using Umbraco.Cms.Core.DependencyInjection; | ||
using Umbraco.Cms.Core.Notifications; | ||
|
||
namespace Our.Umbraco.Meganav.Migrations | ||
{ | ||
public class LegacyMigrationComposer : IUserComposer | ||
public class LegacyMigrationComposer : IComposer | ||
{ | ||
public void Compose(Composition composition) | ||
public void Compose(IUmbracoBuilder builder) | ||
{ | ||
composition.Register<LegacyValueMigrator>(); | ||
builder.Services.AddTransient<LegacyValueMigrator>(); | ||
|
||
composition.Components().Append<LegacyMigrationComponent>(); | ||
builder.AddNotificationHandler<DataTypeSavingNotification, LegacyDataTypeChangingHandler>(); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
src/Our.Umbraco.Meganav/PropertyEditors/MeganavConfiguration.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
8 changes: 7 additions & 1 deletion
8
src/Our.Umbraco.Meganav/PropertyEditors/MeganavConfigurationEditor.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,15 @@ | ||
using Umbraco.Core.PropertyEditors; | ||
using Umbraco.Cms.Core.IO; | ||
using Umbraco.Cms.Core.PropertyEditors; | ||
using Umbraco.Cms.Core.Services; | ||
|
||
namespace Our.Umbraco.Meganav.PropertyEditors | ||
{ | ||
internal class MeganavConfigurationEditor : ConfigurationEditor<MeganavConfiguration> | ||
{ | ||
public MeganavConfigurationEditor(IIOHelper ioHelper) | ||
: base(ioHelper) | ||
{ | ||
|
||
} | ||
} | ||
} |
18 changes: 9 additions & 9 deletions
18
src/Our.Umbraco.Meganav/PropertyEditors/MeganavPropertyEditor.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,22 +1,22 @@ | ||
using Umbraco.Core.Logging; | ||
using Umbraco.Core.PropertyEditors; | ||
using Umbraco.Core.Services; | ||
using Umbraco.Cms.Core.IO; | ||
using Umbraco.Cms.Core.Models; | ||
using Umbraco.Cms.Core.PropertyEditors; | ||
|
||
namespace Our.Umbraco.Meganav.PropertyEditors | ||
{ | ||
[DataEditor(Constants.PropertyEditorAlias, Constants.PropertyEditorName, Group = "pickers")] | ||
internal class MeganavPropertyEditor : DataEditor | ||
{ | ||
private readonly IContentService _contentService; | ||
private readonly IIOHelper _ioHelper; | ||
|
||
public MeganavPropertyEditor(IContentService contentService, ILogger logger) | ||
: base(logger, EditorType.PropertyValue) | ||
public MeganavPropertyEditor(IDataValueEditorFactory dataValueEditorFactory, IIOHelper ioHelper) | ||
: base(dataValueEditorFactory, EditorType.PropertyValue) | ||
{ | ||
_contentService = contentService; | ||
_ioHelper = ioHelper; | ||
} | ||
|
||
protected override IConfigurationEditor CreateConfigurationEditor() => new MeganavConfigurationEditor(); | ||
protected override IConfigurationEditor CreateConfigurationEditor() => new MeganavConfigurationEditor(_ioHelper); | ||
|
||
protected override IDataValueEditor CreateValueEditor() => new MeganavValueEditor(_contentService); | ||
protected override IDataValueEditor CreateValueEditor() => DataValueEditorFactory.Create<MeganavValueEditor>(); | ||
} | ||
} |
Oops, something went wrong.