refactor: migrate About & Contact pages to SitePageSettings system
Build and Deploy to Kubernetes / build-and-deploy (push) Successful in 6m58s
Build and Deploy to Kubernetes / build-and-deploy (push) Successful in 6m58s
- About.razor: use SitePageSettingsService + GetSettings<AboutSettings>() - About.razor.cs: read values/team from ImageGroups instead of SitePage sections - Contact.razor: use SitePageSettingsService + GetSettings<ContactSettings>() - Contact.razor.cs: read address/phone/email/social from SettingsJson
This commit is contained in:
@@ -5,24 +5,22 @@ namespace FrontOffice.Main.Pages;
|
||||
public partial class About
|
||||
{
|
||||
private bool _loading = true;
|
||||
private SitePageDto? _page;
|
||||
private SitePageSectionDto? _visionSection;
|
||||
private SitePageSectionDto? _missionSection;
|
||||
private List<SitePageSectionDto> _valueSections = new();
|
||||
private List<SitePageSectionDto> _teamSections = new();
|
||||
private PageSettingsDto? _page;
|
||||
private AboutSettings? _settings;
|
||||
private List<PageSettingsImageDto> _valueImages = new();
|
||||
private List<PageSettingsImageDto> _teamImages = new();
|
||||
|
||||
protected override async Task OnInitializedAsync()
|
||||
{
|
||||
try
|
||||
{
|
||||
_page = await SitePageService.GetByKeyAsync("about");
|
||||
_page = await PageSettingsService.GetPageAsync("about");
|
||||
|
||||
if (_page != null)
|
||||
{
|
||||
_visionSection = _page.GetSection("vision");
|
||||
_missionSection = _page.GetSection("mission");
|
||||
_valueSections = _page.GetSections("value-").ToList();
|
||||
_teamSections = _page.GetSections("team-").ToList();
|
||||
_settings = _page.GetSettings<AboutSettings>();
|
||||
_valueImages = _page.GetImages("values");
|
||||
_teamImages = _page.GetImages("team");
|
||||
}
|
||||
}
|
||||
catch
|
||||
@@ -34,4 +32,16 @@ public partial class About
|
||||
_loading = false;
|
||||
}
|
||||
}
|
||||
|
||||
private class AboutSettings
|
||||
{
|
||||
public string? VisionTitle { get; set; }
|
||||
public string? VisionText { get; set; }
|
||||
public string? VisionIcon { get; set; }
|
||||
public string? MissionTitle { get; set; }
|
||||
public string? MissionText { get; set; }
|
||||
public string? MissionIcon { get; set; }
|
||||
public string? ValuesTitle { get; set; }
|
||||
public string? TeamTitle { get; set; }
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user