diff --git a/Marechai/Areas/Admin/Views/Home/Index.cshtml b/Marechai/Areas/Admin/Views/Home/Index.cshtml index b34433f2..a98849f7 100644 --- a/Marechai/Areas/Admin/Views/Home/Index.cshtml +++ b/Marechai/Areas/Admin/Views/Home/Index.cshtml @@ -42,8 +42,6 @@
Instruction set extensions by processor
- Licenses -
Machine families
Machines diff --git a/Marechai/Areas/Admin/Views/Licenses/Index.cshtml b/Marechai/Areas/Admin/Views/Licenses/Index.cshtml deleted file mode 100644 index cf82d143..00000000 --- a/Marechai/Areas/Admin/Views/Licenses/Index.cshtml +++ /dev/null @@ -1,71 +0,0 @@ -@model IEnumerable - -@{ - ViewData["Title"] = "Index"; -} -

Licenses

-

- - Create new - -

- - - - - - - - - - - - - @foreach (var item in Model) - { - - - - - - - - - } - -
- @Html.DisplayNameFor(model => model.Name) - - @Html.DisplayNameFor(model => model.SPDX) - - @Html.DisplayNameFor(model => model.FsfApproved) - - @Html.DisplayNameFor(model => model.OsiApproved) - - @Html.DisplayNameFor(model => model.Link) -
- @Html.DisplayFor(modelItem => item.Name) - - @Html.DisplayFor(modelItem => item.SPDX) - - @Html.DisplayFor(modelItem => item.FsfApproved) - - @Html.DisplayFor(modelItem => item.OsiApproved) - - @if (item.Link != null) - { - - Link - - } - - - Details - - - Edit - - - Delete - -
\ No newline at end of file diff --git a/Marechai/Marechai.csproj b/Marechai/Marechai.csproj index 3273f604..8e67ce8b 100644 --- a/Marechai/Marechai.csproj +++ b/Marechai/Marechai.csproj @@ -2,7 +2,7 @@ netcoreapp3.1 - 3.0.99.1056 + 3.0.99.1057 Canary Islands Computer Museum Copyright © 2003-2020 Natalia Portillo Canary Islands Computer Museum Website @@ -58,6 +58,9 @@ true + + true + <_ContentIncludedByDefault Remove="Areas\Admin\Views\BrowserTests\Delete.cshtml" /> diff --git a/Marechai/Pages/Admin/Index.razor b/Marechai/Pages/Admin/Index.razor index 8f15de12..c90b798a 100644 --- a/Marechai/Pages/Admin/Index.razor +++ b/Marechai/Pages/Admin/Index.razor @@ -56,6 +56,9 @@
  • @L["Instruction set extensions"]
  • +
  • + @L["Licenses"] +
  • diff --git a/Marechai/Pages/Admin/Licenses.razor b/Marechai/Pages/Admin/Licenses.razor new file mode 100644 index 00000000..b0d92473 --- /dev/null +++ b/Marechai/Pages/Admin/Licenses.razor @@ -0,0 +1,119 @@ +@{ +/****************************************************************************** +// MARECHAI: Master repository of computing history artifacts information +// ---------------------------------------------------------------------------- +// +// Filename : Licenses.razor +// Author(s) : Natalia Portillo +// +// --[ Description ] ---------------------------------------------------------- +// +// List of licenses +// +// --[ License ] -------------------------------------------------------------- +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as +// published by the Free Software Foundation, either version 3 of the +// License, or (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . +// +// ---------------------------------------------------------------------------- +// Copyright © 2003-2020 Natalia Portillo +*******************************************************************************/ +} + +@page "/admin/licenses" +@using Marechai.Database.Models +@inherits OwningComponentBase +@inject IStringLocalizer L +@attribute [Authorize(Roles = "UberAdmin, Admin")] +

    @L["Licenses"]

    +@if (_licenses is null) +{ +

    @L["Loading..."]

    + + return; +} +

    + + @L["Create new"] + +

    + + + + + + + + + + + + + @foreach (var item in _licenses) + { + + + + + + + + + } + +
    + @L["Name"] + + @L["SPDX"] + + @L["Approved by FSF"] + + @L["Approved by OSI"] + + @L["Link"] +
    + @item.Name + + @item.SPDX + + @item.FsfApproved + + @item.OsiApproved + + @if (item.Link != null) + { + + @L["Link"] + + } + + + @L["Details"] + + + @L["Edit"] + + + @L["Delete"] + +
    + +@code +{ + List _licenses; + + protected override async Task OnInitializedAsync() + { + _licenses = await Service.GetAsync(); + } +} \ No newline at end of file diff --git a/Marechai/Resources/Services/AdminService.es.resx b/Marechai/Resources/Services/AdminService.es.resx index 944df9a2..96145b17 100644 --- a/Marechai/Resources/Services/AdminService.es.resx +++ b/Marechai/Resources/Services/AdminService.es.resx @@ -174,4 +174,8 @@ Arquitecturas Instruction sets. + + Licencias + Licenses. + \ No newline at end of file diff --git a/Marechai/Resources/Services/LicensesService.es.resx b/Marechai/Resources/Services/LicensesService.es.resx new file mode 100644 index 00000000..2f510632 --- /dev/null +++ b/Marechai/Resources/Services/LicensesService.es.resx @@ -0,0 +1,165 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + Licencias + Licenses + + + Cargando... + Message that appears while data is being loaded from database + + + Nombre + Name + + + SPDX + SPDX + + + Aprobada por la FSF + Approved by FSF + + + Aprobada por la OSI + Approved by OSI + + + Enlace + Link + + + Crear nueva + Create new + + + Detalles + Details + + + Editar + Edit + + + Eliminar + Delete + + \ No newline at end of file diff --git a/Marechai/Services/LicensesService.cs b/Marechai/Services/LicensesService.cs new file mode 100644 index 00000000..6136cf6a --- /dev/null +++ b/Marechai/Services/LicensesService.cs @@ -0,0 +1,18 @@ +using System.Collections.Generic; +using System.Linq; +using System.Threading.Tasks; +using Marechai.Database.Models; +using Microsoft.EntityFrameworkCore; + +namespace Marechai.Services +{ + public class LicensesService + { + readonly MarechaiContext _context; + + public LicensesService(MarechaiContext context) => _context = context; + + public async Task> GetAsync() => + await _context.Licenses.OrderBy(l => l.Name).Select(l => new License(){FsfApproved = l.FsfApproved, Id= l.Id, Link = l.Link, Name = l.Name, OsiApproved = l.OsiApproved, SPDX = l.SPDX}).ToListAsync(); + } +} \ No newline at end of file diff --git a/Marechai/Services/Register.cs b/Marechai/Services/Register.cs index 5f413550..0c2fcf6f 100644 --- a/Marechai/Services/Register.cs +++ b/Marechai/Services/Register.cs @@ -53,6 +53,7 @@ namespace Marechai.Services services.AddScoped(); services.AddScoped(); services.AddScoped(); + services.AddScoped(); } } } \ No newline at end of file