Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor tenant-specific content #210

Merged
merged 6 commits into from
Feb 8, 2025
Merged

Refactor tenant-specific content #210

merged 6 commits into from
Feb 8, 2025

Conversation

axunonb
Copy link
Member

@axunonb axunonb commented Feb 1, 2025

Refactor tenant content handling and navigation

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

e.g.:
* tenant-content\OtherOrg\index.html    (info about the tenant)
* tenant-content\OtherOrg\news.html    (posted news)
* tenant-content\OtherOrg\rule-of-game.html   (tenant rule of game)
* tenant-content\OtherOrg\Files\   (future uploaed tenant content files)
@axunonb axunonb force-pushed the pr/tenant-content branch 8 times, most recently from 668ea8b to 802ee63 Compare February 8, 2025 12:50
* Created a tenant content folder `/wwwroot/tenants-content`
* HTML content is file <topic>.html
* Metadata is in file <topic>.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`

* Updated WebAppStartup.cs to use `MainNavigationNodeBuilder` instead of `CustomMainNavigationNodeBuilder `
* Deleted `CustomMainNavigationNodeBuilder` class and related usings.
* Added class `ITenantContentProvider` to handel 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.

* 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.

* Updated .gitignore to include tenants-content directory
Copy link

sonarqubecloud bot commented Feb 8, 2025

@axunonb axunonb added the enhancement New feature or request label Feb 8, 2025
@axunonb axunonb merged commit b37958a into main Feb 8, 2025
5 checks passed
@axunonb axunonb deleted the pr/tenant-content branch February 8, 2025 13:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant