-
Notifications
You must be signed in to change notification settings - Fork 0
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
Showing
15 changed files
with
193 additions
and
50 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
89 changes: 89 additions & 0 deletions
89
...Umbraco.Community.BackOfficeOrganiser/Composing/BackofficeOrganiserNotificationHandler.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,89 @@ | ||
using Microsoft.Extensions.Options; | ||
using Umbraco.Cms.Core.Events; | ||
using Umbraco.Cms.Core.Notifications; | ||
using Umbraco.Community.BackOfficeOrganiser.Models; | ||
using Umbraco.Community.BackOfficeOrganiser.Organisers.ContentTypes; | ||
using Umbraco.Community.BackOfficeOrganiser.Organisers.DataTypes; | ||
using Umbraco.Community.BackOfficeOrganiser.Organisers.MediaTypes; | ||
using Umbraco.Community.BackOfficeOrganiser.Organisers.MemberTypes; | ||
|
||
namespace Umbraco.Community.BackOfficeOrganiser.Composing; | ||
|
||
public class BackofficeOrganiserNotificationHandler : | ||
INotificationHandler<DataTypeSavedNotification>, | ||
INotificationHandler<ContentTypeSavedNotification>, | ||
INotificationHandler<MemberTypeSavedNotification>, | ||
INotificationHandler<MediaTypeSavedNotification> | ||
{ | ||
private readonly ContentTypeOrganiser _contentTypeOrganiser; | ||
private readonly DataTypeOrganiser _dataTypeOrganiser; | ||
private readonly MediaTypeOrganiser _mediaTypeOrganiser; | ||
private readonly MemberTypeOrganiser _memberTypeOrganiser; | ||
private readonly BackOfficeOrganiserOptions _options; | ||
|
||
public BackofficeOrganiserNotificationHandler( | ||
DataTypeOrganiser dataTypeOrganiser, | ||
ContentTypeOrganiser contentTypeOrganiser, | ||
MediaTypeOrganiser mediaTypeOrganiser, | ||
MemberTypeOrganiser memberTypeOrganiser, | ||
IOptions<BackOfficeOrganiserOptions> options) | ||
{ | ||
_dataTypeOrganiser = dataTypeOrganiser; | ||
_contentTypeOrganiser = contentTypeOrganiser; | ||
_mediaTypeOrganiser = mediaTypeOrganiser; | ||
_memberTypeOrganiser = memberTypeOrganiser; | ||
_options = options.Value; | ||
} | ||
|
||
public void Handle(ContentTypeSavedNotification notification) | ||
{ | ||
if (!_options.ContentTypes.OrganiseOnSave) | ||
{ | ||
return; | ||
} | ||
|
||
foreach (var item in notification.SavedEntities) | ||
{ | ||
_contentTypeOrganiser.Organise(item); | ||
} | ||
} | ||
|
||
public void Handle(DataTypeSavedNotification notification) | ||
{ | ||
if (!_options.DataTypes.OrganiseOnSave) | ||
{ | ||
return; | ||
} | ||
|
||
foreach (var dataType in notification.SavedEntities) | ||
{ | ||
_dataTypeOrganiser.Organise(dataType); | ||
} | ||
} | ||
|
||
public void Handle(MediaTypeSavedNotification notification) | ||
{ | ||
if (!_options.MediaTypes.OrganiseOnSave) | ||
{ | ||
return; | ||
} | ||
|
||
foreach (var item in notification.SavedEntities) | ||
{ | ||
_mediaTypeOrganiser.Organise(item); | ||
} | ||
} | ||
|
||
public void Handle(MemberTypeSavedNotification notification) | ||
{ | ||
if (!_options.MemberTypes.OrganiseOnSave) | ||
{ | ||
return; | ||
} | ||
|
||
foreach (var item in notification.SavedEntities) | ||
{ | ||
_memberTypeOrganiser.Organise(item); | ||
} | ||
} | ||
} |
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
6 changes: 6 additions & 0 deletions
6
src/Umbraco.Community.BackOfficeOrganiser/Models/ContentTypeOptions.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,6 @@ | ||
namespace Umbraco.Community.BackOfficeOrganiser.Models; | ||
|
||
public class ContentTypeOptions | ||
{ | ||
public bool OrganiseOnSave { get; set; } = true; | ||
} |
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
6 changes: 6 additions & 0 deletions
6
src/Umbraco.Community.BackOfficeOrganiser/Models/MediaTypeOptions.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,6 @@ | ||
namespace Umbraco.Community.BackOfficeOrganiser.Models; | ||
|
||
public class MediaTypeOptions | ||
{ | ||
public bool OrganiseOnSave { get; set; } = true; | ||
} |
6 changes: 6 additions & 0 deletions
6
src/Umbraco.Community.BackOfficeOrganiser/Models/MemberTypeOptions.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,6 @@ | ||
namespace Umbraco.Community.BackOfficeOrganiser.Models; | ||
|
||
public class MemberTypeOptions | ||
{ | ||
public bool OrganiseOnSave { get; set; } = true; | ||
} |
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
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