Skip to content

v8.0.0

Latest
Compare
Choose a tag to compare
@axunonb axunonb released this 08 Feb 20:53
07de738

Migration from v7.x to v8.0

1. WebAppStartup:

  • Replace CustomMainNavigationNodeBuilder from Demo project with MainNavigationNodeBuilder from League project
  • Add new service TenantContentProvider
  • Remove the reference using League.WebApp.ViewComponents;
services.AddScoped<IMainNavigationNodeBuilder, MainNavigationNodeBuilder>();
services.AddSingleton<ITenantContentProvider, TenantContentProvider>();

2. Migrate razor views to HTML partials together with metadata

  • Source folder: Views\TenantContent\<tenant>
  • Target folder: wwwroot\pages\
    • Home_Index.cshtml => _home.html
    • Info_RuleOfGame.cshtml => _rule-of-game.html
    • Info_News.cshtml => _news.html

3. Add JSON metadata files

  • Every HTML file has a metadata JSON file as a companion
    • Home_Index.cshtml => _home.json
    • Info_RuleOfGame.cshtml => _rule-of-game.json
    • Info_News.cshtml => _news.json
  • The JSON files have the following content, that will be deserialized to League.Models.TenantContent.ContentItems
{
  "Position": 0,
  "PageTitel": "<PageTitel>",
  "Description": "<Content for the HTML meta tag 'Description'>",
  "MenuTitel": "<The titel as show in the menu>",
  "Topic": "<The topic name used in the URL>",
  "IsActive": true,
  "LastModified": "2025-01-02T12:00:00Z",
  "PubDate": "2025-01-02T12:00:00Z"
}

4. Other Changes

  • The TenantContent controller is replaced by the TenantContent controller of the League project,
  • Same for Views\TenantContent\Home.cshtml.
  • _Layout.cshtml: Only the "general contact" is mentioned now, the tenant contact will be displayed as fixed tenant menu item. <a asp-route="@RouteNames.GeneralContact" class="d-inline-block me-4">@Localizer["Contact"]</a>

What's Changed in Detail

1. Move tenant content from razor views to pure html in wwwroot folder

  • Move controller TenantContent from project Demo to League
  • Tenant content html have the same name as the url segment for the topic
    e.g.:
    • pages\otherorg_index.html (info about the tenant)
    • pages\otherorg_news.html (posted news)
    • pages\otherorg_rule-of-game.html (tenant rule of game)
    • pages\Files\otherorg_ball.png (uploaded tenant content files)
  • Include pages folder for League.Demo in the repository

2. Created a tenant content folder /wwwroot/pages

  • HTML content is file _.html
  • Metadata is in file _.json
  • Created new home.html, home.json, news.html, news.json, rule-of-game.html, and rule-of-game.json files with metadata and placeholder content.
  • Added a new home.cshtml view to render tenant content.
  • Simplified footer in _Layout.cshtml by removing tenant-specific logic for the "Contact" link.
  • Updated WebAppStartup to use scoped MainNavigationNodeBuilder and singleton TenantContentProvider

3. Integration

  • Updated WebAppStartup.cs to use MainNavigationNodeBuilder instead of CustomMainNavigationNodeBuilder
  • Deleted CustomMainNavigationNodeBuilder class and related usings.
  • Added class ITenantContentProvider to handle tenant content
  • Added a new ContentItem class in ContentItem.cs to represent a content item for a tenant.
  • Introduced a new interface ITenantContentProvider
  • Implemented ITenantContentProvider interface in TenantContentProvider
  • Added new methods in MainNavigationNodeBuilder to create tenant-specific navigation nodes.
  • Updated TenantContent controller to use ITenantContentProvider and added a new Home action.

4. Migrate to async

  • Updated IMainNavigationNodeBuilder interface to make GetNavigationNodes method asynchronous.
  • Updated MainNavigation component and MainNavigationComponentModelExtensions to use asynchronous methods.
  • Updated Default.cshtml and NavigationNodeChildDropdownPartial.cshtml to use asynchronous methods for CSS class generation.

5. Miscallaneous

  • Updated .gitignore to include pages directory
  • Fix a bug in Axuno.Tools.FileSystem.DelayedFileSystemWatcher when processing directory changes
  • Move view TenantContent.Home.cshtml from Demo to League project

Full Changelog: v7.2.4...v8.0.0