Use company logos again.

This commit is contained in:
2018-08-07 21:48:53 +01:00
parent 31f6cb7744
commit 786cd53d7d
7 changed files with 17 additions and 32 deletions

View File

@@ -32,7 +32,6 @@ using System.Linq;
using Cicm.Database.Models; using Cicm.Database.Models;
using Microsoft.AspNetCore.Hosting; using Microsoft.AspNetCore.Hosting;
using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.Mvc;
using Microsoft.EntityFrameworkCore;
namespace cicm_web.Controllers namespace cicm_web.Controllers
{ {
@@ -69,9 +68,6 @@ namespace cicm_web.Controllers
if(company == null) return Index(); if(company == null) return Index();
ViewBag.LastLogo = company.CompanyLogos.OrderByDescending(l => l.Year).FirstOrDefault();
ViewBag.CompanyLogos = company.CompanyLogos.OrderByDescending(l => l.Year).ToList();
return View(company); return View(company);
} }

View File

@@ -32,7 +32,7 @@
ViewData["Title"] = "Companies"; ViewData["Title"] = "Companies";
} }
@using System.IO @using System.IO
@using Company = Cicm.Database.Models.Company @using Cicm.Database.Models
@model Cicm.Database.Models.Company[] @model Cicm.Database.Models.Company[]
<p align="center"> <p align="center">
@@ -68,7 +68,6 @@
<a asp-controller="Company" <a asp-controller="Company"
asp-action="View" asp-action="View"
asp-route-id="@company.Id"> asp-route-id="@company.Id">
@* TODO
@if(company.LastLogo != null && File.Exists(System.IO.Path.Combine(ViewBag.WebRootPath, "assets/logos", company.LastLogo.Guid + ".svg"))) @if(company.LastLogo != null && File.Exists(System.IO.Path.Combine(ViewBag.WebRootPath, "assets/logos", company.LastLogo.Guid + ".svg")))
{ {
<picture> <picture>
@@ -88,7 +87,6 @@
style="max-height: 32px; max-width: 128px" /> style="max-height: 32px; max-width: 128px" />
</picture> </picture>
} }
*@
@company.Name @company.Name
</a> </a>
<br /> <br />

View File

@@ -31,7 +31,8 @@
ViewData["Title"] = "Companies"; ViewData["Title"] = "Companies";
} }
@using Company = Cicm.Database.Models.Company @using System.IO
@using Cicm.Database.Models
@model Cicm.Database.Models.Company[] @model Cicm.Database.Models.Company[]
<p>Search results:</p> <p>Search results:</p>
@@ -51,7 +52,6 @@
<a asp-controller="Company" <a asp-controller="Company"
asp-action="View" asp-action="View"
asp-route-id="@company.Id"> asp-route-id="@company.Id">
@*
@if(company.LastLogo != null && File.Exists(System.IO.Path.Combine(ViewBag.WebRootPath, "assets/logos", company.LastLogo.Guid + ".svg"))) @if(company.LastLogo != null && File.Exists(System.IO.Path.Combine(ViewBag.WebRootPath, "assets/logos", company.LastLogo.Guid + ".svg")))
{ {
<picture> <picture>
@@ -71,7 +71,6 @@
style="max-height: 32px; max-width: 128px" /> style="max-height: 32px; max-width: 128px" />
</picture> </picture>
} }
*@
@company.Name @company.Name
</a> </a>
<br /> <br />

View File

@@ -31,7 +31,8 @@
ViewData["Title"] = "Companies"; ViewData["Title"] = "Companies";
} }
@using Company = Cicm.Database.Models.Company @using System.IO
@using Cicm.Database.Models
@model Cicm.Database.Models.Company[] @model Cicm.Database.Models.Company[]
<p align="center"> <p align="center">
@@ -44,7 +45,6 @@
<a asp-controller="Company" <a asp-controller="Company"
asp-action="View" asp-action="View"
asp-route-id="@company.Id"> asp-route-id="@company.Id">
@* TODO
@if(company.LastLogo != null && File.Exists(System.IO.Path.Combine(ViewBag.WebRootPath, "assets/logos", company.LastLogo.Guid + ".svg"))) @if(company.LastLogo != null && File.Exists(System.IO.Path.Combine(ViewBag.WebRootPath, "assets/logos", company.LastLogo.Guid + ".svg")))
{ {
<picture> <picture>
@@ -63,9 +63,7 @@
width="auto" width="auto"
style="max-height: 32px; max-width: 128px" /> style="max-height: 32px; max-width: 128px" />
</picture> </picture>
} }
*@
@company.Name @company.Name
</a> </a>
<br /> <br />

View File

@@ -34,26 +34,25 @@
@using System.IO @using System.IO
@using Cicm.Database @using Cicm.Database
@using Cicm.Database.Models @using Cicm.Database.Models
@using Machine = Cicm.Database.Models.Machine
@model Cicm.Database.Models.Company @model Cicm.Database.Models.Company
@if(Model != null) @if(Model != null)
{ {
<div class="container-fluid"> <div class="container-fluid">
<p align=center> <p align=center>
@if(ViewBag.LastLogo != null && File.Exists(System.IO.Path.Combine(ViewBag.WebRootPath, "assets/logos", ViewBag.LastLogo.Guid + ".svg"))) @if(Model.LastLogo != null && File.Exists(System.IO.Path.Combine(ViewBag.WebRootPath, "assets/logos", Model.LastLogo.Guid + ".svg")))
{ {
<picture> <picture>
<source type="image/svg+xml" <source type="image/svg+xml"
srcset="/assets/logos/@(ViewBag.LastLogo.Guid).svg"> srcset="/assets/logos/@(Model.LastLogo.Guid).svg">
<source type="image/webp" <source type="image/webp"
srcset="/assets/logos/webp/1x/@(ViewBag.LastLogo.Guid).webp, srcset="/assets/logos/webp/1x/@(Model.LastLogo.Guid).webp,
/assets/logos/webp/1x/@(ViewBag.LastLogo.Guid).webp 2x, /assets/logos/webp/1x/@(Model.LastLogo.Guid).webp 2x,
/assets/logos/webp/1x/@(ViewBag.LastLogo.Guid).webp 3x"> /assets/logos/webp/1x/@(Model.LastLogo.Guid).webp 3x">
<img srcset="/assets/logos/png/1x/@(ViewBag.LastLogo.Guid).png, <img srcset="/assets/logos/png/1x/@(Model.LastLogo.Guid).png,
/assets/logos/png/1x/@(ViewBag.LastLogo.Guid).png 2x, /assets/logos/png/1x/@(Model.LastLogo.Guid).png 2x,
/assets/logos/png/1x/@(ViewBag.LastLogo.Guid).webp 3x" /assets/logos/png/1x/@(Model.LastLogo.Guid).webp 3x"
src="/assets/logos/png/1x@(ViewBag.LastLogo.Guid).png") src="/assets/logos/png/1x@(Model.LastLogo.Guid).png")
alt="" alt=""
height="auto" height="auto"
width="auto" width="auto"
@@ -65,7 +64,7 @@
@{ @{
string carrouselActive = "active"; string carrouselActive = "active";
} }
@if(ViewBag.Logos != null && ViewBag.Logos.Length > 1) @if(Model.Logos != null && Model.Logos.Count > 1)
{ {
<div class="col-3"> <div class="col-3">
<div class="carousel slide" <div class="carousel slide"
@@ -74,7 +73,7 @@
<div class="carousel-inner"> <div class="carousel-inner">
@foreach(CompanyLogo logo in ViewBag.Logos) @foreach(CompanyLogo logo in Model.Logos)
{ {
if(File.Exists(System.IO.Path.Combine(ViewBag.WebRootPath, "assets/logos", logo.Guid + ".svg"))) if(File.Exists(System.IO.Path.Combine(ViewBag.WebRootPath, "assets/logos", logo.Guid + ".svg")))
{ {

View File

@@ -34,11 +34,7 @@
@using System.IO @using System.IO
@using Cicm.Database @using Cicm.Database
@using Cicm.Database.Models @using Cicm.Database.Models
@using MemoryByMachine = Cicm.Database.Models.MemoryByMachine
@using SoundByMachine = Cicm.Database.Models.SoundByMachine
@using StorageByMachine = Cicm.Database.Models.StorageByMachine
@model Cicm.Database.Models.Machine @model Cicm.Database.Models.Machine
@* TODO
<p align="center"> <p align="center">
@if(Model.Company.LastLogo != null && File.Exists(System.IO.Path.Combine(ViewBag.WebRootPath, "assets/logos", Model.Company.LastLogo.Guid + ".svg"))) @if(Model.Company.LastLogo != null && File.Exists(System.IO.Path.Combine(ViewBag.WebRootPath, "assets/logos", Model.Company.LastLogo.Guid + ".svg")))
{ {
@@ -60,7 +56,6 @@
</picture> </picture>
} }
</p> </p>
*@
@{ int counter = 0; } @{ int counter = 0; }

View File

@@ -2,7 +2,7 @@
<Project Sdk="Microsoft.NET.Sdk.Web"> <Project Sdk="Microsoft.NET.Sdk.Web">
<PropertyGroup> <PropertyGroup>
<TargetFramework>netcoreapp2.0</TargetFramework> <TargetFramework>netcoreapp2.0</TargetFramework>
<Version>3.0.99.302</Version> <Version>3.0.99.304</Version>
<Company>Canary Islands Computer Museum</Company> <Company>Canary Islands Computer Museum</Company>
<Copyright>Copyright © 2003-2018 Natalia Portillo</Copyright> <Copyright>Copyright © 2003-2018 Natalia Portillo</Copyright>
<Product>Canary Islands Computer Museum Website</Product> <Product>Canary Islands Computer Museum Website</Product>