Fix view when company has an unknown country.

This commit is contained in:
2020-06-07 22:22:26 +01:00
parent 359b7e7d47
commit da282e329d
3 changed files with 20 additions and 13 deletions

View File

@@ -2,7 +2,7 @@
<Project Sdk="Microsoft.NET.Sdk.Web"> <Project Sdk="Microsoft.NET.Sdk.Web">
<PropertyGroup> <PropertyGroup>
<TargetFramework>netcoreapp3.1</TargetFramework> <TargetFramework>netcoreapp3.1</TargetFramework>
<Version>4.0.0.1557</Version> <Version>4.0.0.1569</Version>
<Company>Canary Islands Computer Museum</Company> <Company>Canary Islands Computer Museum</Company>
<Copyright>Copyright © 2003-2020 Natalia Portillo</Copyright> <Copyright>Copyright © 2003-2020 Natalia Portillo</Copyright>
<Product>Canary Islands Computer Museum Website</Product> <Product>Canary Islands Computer Museum Website</Product>

View File

@@ -122,21 +122,28 @@
<tr> <tr>
<th>@L["Country"]</th> <th>@L["Country"]</th>
<td> <td>
<a href="/companies/country/@_company.CountryId"> @if (_company.Country != null)
@if (File.Exists(Path.Combine(Host.WebRootPath, "assets/flags/countries", _company.CountryId + ".svg"))) {
{ <a href="/companies/country/@_company.CountryId">
<picture> @if (File.Exists(Path.Combine(Host.WebRootPath, "assets/flags/countries", _company.CountryId + ".svg")))
<source type="image/svg+xml" srcset="/assets/flags/countries/@(_company.CountryId).svg"> {
<source type="image/webp" srcset="/assets/flags/countries/webp/1x/@(_company.CountryId).webp, <picture>
<source type="image/svg+xml" srcset="/assets/flags/countries/@(_company.CountryId).svg">
<source type="image/webp" srcset="/assets/flags/countries/webp/1x/@(_company.CountryId).webp,
/assets/flags/countries/webp/1x/@(_company.CountryId).webp 2x, /assets/flags/countries/webp/1x/@(_company.CountryId).webp 2x,
/assets/flags/countries/webp/1x/@(_company.CountryId).webp 3x"> /assets/flags/countries/webp/1x/@(_company.CountryId).webp 3x">
<img srcset="/assets/flags/countries/png/1x/@(_company.CountryId).png, <img srcset="/assets/flags/countries/png/1x/@(_company.CountryId).png,
/assets/flags/countries/png/1x/@(_company.CountryId).png 2x, /assets/flags/countries/png/1x/@(_company.CountryId).png 2x,
/assets/flags/countries/png/1x/@(_company.CountryId).webp 3x" src="/assets/flags/countries/png/1x@(_company.CountryId).png" alt="" height="32" /> /assets/flags/countries/png/1x/@(_company.CountryId).webp 3x" src="/assets/flags/countries/png/1x@(_company.CountryId).png" alt="" height="32" />
</picture> </picture>
} }
@L[_company.Country] @L[_company.Country]
</a> </a>
}
else
{
@L["Unknown (country)"]
}
</td> </td>
</tr> </tr>
<tr> <tr>

View File

@@ -1 +1 @@
{"projectId":"db06ff35-f00a-4492-a887-0e2c62d6c2ba","projectName":"Marechai"} {"projectId":"db06ff35-f00a-4492-a887-0e2c62d6c2ba","projectName":"Marechai","neverTrack":false}