Files
mixtape/zero.Debug/TestData/TestPlugin.cs
T

61 lines
3.3 KiB
C#
Raw Normal View History

2020-09-10 16:12:06 +02:00
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
2020-05-13 14:06:11 +02:00
using System.Collections.Generic;
using zero.Commerce.Options;
2020-05-13 14:06:11 +02:00
using zero.Core.Options;
using zero.Core.Plugins;
2020-10-06 16:00:27 +02:00
using zero.Debug.Sync;
2020-05-13 14:06:11 +02:00
using zero.Debug.TestData;
namespace zero.TestData
{
2020-05-12 15:22:39 +02:00
public class TestPlugin : IZeroPlugin
{
2020-05-19 10:57:35 +02:00
public void Configure(IZeroPluginOptions plugin, IZeroOptions zero)
{
2020-05-19 10:57:35 +02:00
plugin.Name = "Test Plugin";
2020-08-20 15:11:41 +02:00
//ISection spaceSection = zero.Sections.GetAllItems().FirstOrDefault(x => x.Alias == Constants.Sections.Spaces);
//zero.Sections.Remove(spaceSection);
2020-07-06 15:58:31 +02:00
2020-09-01 12:20:20 +02:00
zero.Spaces.Add<TeamMemberSpace>();
zero.Spaces.AddList<News>("news", "News", "Articles about the company", "fth-edit");
zero.Spaces.AddSeparator();
zero.Spaces.AddEditor<SocialContent>("social", "Social", "Links to social media", "fth-twitter");
zero.Features.Add(TestFeatures.Wishlist, "Wishlist", "Frontend wishlist for logged-in users");
zero.Features.Add(TestFeatures.SocialShopping, "Social shopping", "Integrate products into social media portals");
2020-05-13 14:06:11 +02:00
2020-05-19 15:53:01 +02:00
zero.Pages.Add<NewsPage>("news", "News", "News about the company", "fth-file-text");
zero.Pages.Add<ContentPage>("content", "Page", "Page consisting of modules", "fth-box", allowAsRoot: true, allowAllChildrenTypes: true);
zero.Pages.Add<ContentPage>("root", "Homepage", "Entry point for the website", "fth-home", allowAsRoot: true, allowAllChildrenTypes: true, onlyAtRoot: true);
2020-05-19 15:53:01 +02:00
zero.Pages.Add<RedirectPage>("redirect", "Redirect", "Redirect to another page or an external URL", "fth-external-link", allowAsRoot: true, allowedChildrenTypes: new List<string>() { "content", "redirect" });
2020-08-19 11:22:45 +02:00
zero.Modules.Add<RichtextModule>("richtext", "Richtext", "Simple richtext block editor", "fth-align-left", "Texts");
zero.Modules.Add<HeadlineModule>("headline", "Headline", "Headline with optional subline", "fth-underline", "Texts");
zero.Modules.Add<TextWithImageModule>("textWithImage", "Text with image", "Short textblock with image", "fth-layers", "Texts", new List<string>() { "root" });
zero.Modules.Add<GalleryModule>("gallery", "Gallery", "Image gallery grid", "fth-image", "Media");
2020-08-20 14:35:08 +02:00
zero.Modules.Add<DownloadModule>("download", "Downloads", "List containing downloads", "fth-download", "Misc");
zero.Modules.Add<OffsetModule>("offset", "Offset", "Offset between two modules", "fth-code", "Misc");
2020-09-01 15:23:21 +02:00
zero.Modules.Add<NestedModule>("nested", "Nested", "Add nested modules", "fth-layers", "Misc");
}
2020-05-18 15:55:43 +02:00
2020-09-10 16:12:06 +02:00
public void ConfigureServices(IServiceCollection services, IConfiguration configuration)
2020-05-18 15:55:43 +02:00
{
2020-10-06 16:00:27 +02:00
services.AddHostedService<TestPluginStartup>();
services.Configure<ZeroCommerceOptions>(opts =>
{
opts.Documents.Add<InvoiceDocument>();
2020-09-16 15:51:01 +02:00
opts.Documents.Add<PrintDocument>();
2020-10-02 11:01:03 +02:00
opts.ChannelFeatures.Add("channel.printingMail", "Printing mail", "Send printing mail when order contains labels");
opts.ChannelFeatures.Add("channel.altFrontend", "Alternative header", "Render a simplified header in the frontend");
});
2020-10-06 16:00:27 +02:00
services.AddTransient<CountryBlueprintHandler>(); // TODO auto-register handlers
2020-10-06 16:06:48 +02:00
services.AddTransient<PropertyBlueprintHandler>();
2020-05-18 15:55:43 +02:00
services.AddTransient<ITestService, TestService>();
}
}
}