2021-02-18 11:06:02 +01:00
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
|
using Umbraco.Cms.Core.Models;
|
|
|
|
|
|
using Umbraco.Cms.Core.Models.ContentEditing;
|
|
|
|
|
|
using Umbraco.Cms.Core.Models.Membership;
|
2018-09-20 17:22:39 +02:00
|
|
|
|
|
2021-02-18 11:06:02 +01:00
|
|
|
|
namespace Umbraco.Cms.Core.ContentApps
|
2018-09-20 17:22:39 +02:00
|
|
|
|
{
|
2018-12-06 10:02:23 +01:00
|
|
|
|
public class ContentInfoContentAppFactory : IContentAppFactory
|
2018-09-20 17:22:39 +02:00
|
|
|
|
{
|
2018-09-21 09:42:36 +02:00
|
|
|
|
// see note on ContentApp
|
|
|
|
|
|
private const int Weight = +100;
|
|
|
|
|
|
|
2021-12-16 13:44:20 +01:00
|
|
|
|
private ContentApp? _contentApp;
|
|
|
|
|
|
private ContentApp? _mediaApp;
|
|
|
|
|
|
private ContentApp? _memberApp;
|
2018-09-20 17:22:39 +02:00
|
|
|
|
|
2021-12-16 13:44:20 +01:00
|
|
|
|
public ContentApp? GetContentAppFor(object o, IEnumerable<IReadOnlyUserGroup> userGroups)
|
2018-09-20 17:22:39 +02:00
|
|
|
|
{
|
|
|
|
|
|
switch (o)
|
|
|
|
|
|
{
|
|
|
|
|
|
case IContent _:
|
2021-12-16 13:44:20 +01:00
|
|
|
|
return _contentApp ??= new ContentApp
|
2018-09-20 17:22:39 +02:00
|
|
|
|
{
|
|
|
|
|
|
Alias = "umbInfo",
|
|
|
|
|
|
Name = "Info",
|
|
|
|
|
|
Icon = "icon-info",
|
2018-09-21 09:42:36 +02:00
|
|
|
|
View = "views/content/apps/info/info.html",
|
|
|
|
|
|
Weight = Weight
|
2021-12-16 13:44:20 +01:00
|
|
|
|
};
|
2018-09-20 17:22:39 +02:00
|
|
|
|
|
|
|
|
|
|
case IMedia _:
|
2021-12-16 13:44:20 +01:00
|
|
|
|
return _mediaApp ??= new ContentApp
|
2018-09-20 17:22:39 +02:00
|
|
|
|
{
|
|
|
|
|
|
Alias = "umbInfo",
|
|
|
|
|
|
Name = "Info",
|
|
|
|
|
|
Icon = "icon-info",
|
2018-09-21 09:42:36 +02:00
|
|
|
|
View = "views/media/apps/info/info.html",
|
|
|
|
|
|
Weight = Weight
|
2021-12-16 13:44:20 +01:00
|
|
|
|
};
|
2019-12-18 10:43:41 +01:00
|
|
|
|
case IMember _:
|
2021-12-16 13:44:20 +01:00
|
|
|
|
return _memberApp ??= new ContentApp
|
2019-12-18 10:43:41 +01:00
|
|
|
|
{
|
|
|
|
|
|
Alias = "umbInfo",
|
|
|
|
|
|
Name = "Info",
|
|
|
|
|
|
Icon = "icon-info",
|
|
|
|
|
|
View = "views/member/apps/info/info.html",
|
|
|
|
|
|
Weight = Weight
|
2021-12-16 13:44:20 +01:00
|
|
|
|
};
|
2018-09-20 17:22:39 +02:00
|
|
|
|
|
|
|
|
|
|
default:
|
2020-06-19 19:10:16 +02:00
|
|
|
|
return null;
|
2018-09-20 17:22:39 +02:00
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|