Merge pull request #3738 from sbwalker/dev
optrimization to eliminate file lookup in Logo control
This commit is contained in:
commit
cf9ef281ce
|
@ -1,24 +1,11 @@
|
||||||
@namespace Oqtane.Themes.Controls
|
@namespace Oqtane.Themes.Controls
|
||||||
@inherits ThemeControlBase
|
@inherits ThemeControlBase
|
||||||
@inject IFileService FileService
|
|
||||||
|
|
||||||
@if (file != null)
|
@if (PageState.Site.LogoFileId != null)
|
||||||
{
|
{
|
||||||
<span class="app-logo">
|
<span class="app-logo">
|
||||||
<a href="@PageState.Alias.Path">
|
<a href="@PageState.Alias.Path">
|
||||||
<img class="img-fluid" src="@file.Url" alt="@PageState.Site.Name" />
|
<img class="img-fluid" src="@Utilities.FileUrl(PageState.Alias, PageState.Site.LogoFileId.Value)" alt="@PageState.Site.Name" />
|
||||||
</a>
|
</a>
|
||||||
</span>
|
</span>
|
||||||
}
|
|
||||||
|
|
||||||
@code {
|
|
||||||
private File file = null;
|
|
||||||
|
|
||||||
protected override async Task OnParametersSetAsync()
|
|
||||||
{
|
|
||||||
if (PageState.Site.LogoFileId != null && file?.FileId != PageState.Site.LogoFileId.Value)
|
|
||||||
{
|
|
||||||
file = await FileService.GetFileAsync(PageState.Site.LogoFileId.Value);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
Loading…
Reference in New Issue
Block a user