diff --git a/Marechai/Areas/Admin/Views/Licenses/Details.cshtml b/Marechai/Areas/Admin/Views/Licenses/Details.cshtml deleted file mode 100644 index cb352742..00000000 --- a/Marechai/Areas/Admin/Views/Licenses/Details.cshtml +++ /dev/null @@ -1,56 +0,0 @@ -@model Marechai.Database.Models.License - -@{ - ViewData["Title"] = "Details"; -} -

Details

-
-

License

-
-
-
- @Html.DisplayNameFor(model => model.Name) -
-
- @Html.DisplayFor(model => model.Name) -
-
- @Html.DisplayNameFor(model => model.SPDX) -
-
- @Html.DisplayFor(model => model.SPDX) -
-
- @Html.DisplayNameFor(model => model.FsfApproved) -
-
- @Html.DisplayFor(model => model.FsfApproved) -
-
- @Html.DisplayNameFor(model => model.OsiApproved) -
-
- @Html.DisplayFor(model => model.OsiApproved) -
-
- @Html.DisplayNameFor(model => model.Link) -
-
- @Html.DisplayFor(model => model.Link) -
-
- @Html.DisplayNameFor(model => model.Text) -
-
- @Html.DisplayFor(model => model.Text) -
-
-
-
- - Edit - - - Back to List - -
\ No newline at end of file diff --git a/Marechai/Marechai.csproj b/Marechai/Marechai.csproj index 830ed0ac..ebc85a4c 100644 --- a/Marechai/Marechai.csproj +++ b/Marechai/Marechai.csproj @@ -2,7 +2,7 @@ netcoreapp3.1 - 3.0.99.1179 + 3.0.99.1182 Canary Islands Computer Museum Copyright © 2003-2020 Natalia Portillo Canary Islands Computer Museum Website @@ -100,6 +100,9 @@ true + + true + <_ContentIncludedByDefault Remove="Areas\Admin\Views\BrowserTests\Delete.cshtml" /> diff --git a/Marechai/Pages/Admin/Details/License.razor b/Marechai/Pages/Admin/Details/License.razor new file mode 100644 index 00000000..f1c926e1 --- /dev/null +++ b/Marechai/Pages/Admin/Details/License.razor @@ -0,0 +1,79 @@ +@{ +/****************************************************************************** +// MARECHAI: Master repository of computing history artifacts information +// ---------------------------------------------------------------------------- +// +// Filename : Details.cshtml +// Author(s) : Natalia Portillo +// +// --[ Description ] ---------------------------------------------------------- +// +// Admin view details +// +// --[ 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/details/{Id:int}" +@inherits OwningComponentBase +@inject IStringLocalizer L +@attribute [Authorize(Roles = "UberAdmin, Admin")] +

@L["License details"]

+
+ +@if (!_loaded) +{ +

@L["Loading..."]

+ + return; +} + +
+ + @L["Name"] + + + + @L["SPDX identifier"] + + + + @L["FSF approved"] + + + + @L["OSI approved"] + + + + @L["License text link"] + + + @if (_editable || _model.Text != null) + { + + @L["License text"] + + + } +
+
+ @L["Edit"] + @L["Back to list"] +
\ No newline at end of file diff --git a/Marechai/Pages/Admin/Details/License.razor.cs b/Marechai/Pages/Admin/Details/License.razor.cs new file mode 100644 index 00000000..13a21854 --- /dev/null +++ b/Marechai/Pages/Admin/Details/License.razor.cs @@ -0,0 +1,29 @@ +using System.Threading.Tasks; +using Microsoft.AspNetCore.Components; + +namespace Marechai.Pages.Admin.Details +{ + public partial class License + { + bool _editable; + bool _loaded; + Database.Models.License _model; + [Parameter] + public int Id { get; set; } + + protected override async Task OnAfterRenderAsync(bool firstRender) + { + if(_loaded) + return; + + _loaded = true; + + if(Id <= 0) + return; + + _model = await Service.GetAsync(Id); + + StateHasChanged(); + } + } +} \ No newline at end of file diff --git a/Marechai/Pages/Admin/Licenses.razor b/Marechai/Pages/Admin/Licenses.razor index ca3eadf6..f16f69b5 100644 --- a/Marechai/Pages/Admin/Licenses.razor +++ b/Marechai/Pages/Admin/Licenses.razor @@ -92,9 +92,7 @@ } - - @L["Details"] - + @L["Details"] @L["Edit"] diff --git a/Marechai/Resources/Services/LicensesService.es.resx b/Marechai/Resources/Services/LicensesService.es.resx index 1a273acb..f03d4b0a 100644 --- a/Marechai/Resources/Services/LicensesService.es.resx +++ b/Marechai/Resources/Services/LicensesService.es.resx @@ -174,4 +174,32 @@ Cancelar Cancel + + Detalles de licencia + License details + + + Volver a la lista + Back to list + + + Identificator SPDX + SPDX identifier + + + Aprobada por la FSF + FSF approved + + + Aprobada por la OSI + OSI approved + + + Enlace al texto de la licencia + License text link + + + Texto de la licencia + License text + \ No newline at end of file diff --git a/Marechai/Services/LicensesService.cs b/Marechai/Services/LicensesService.cs index 1999974c..d52a82b9 100644 --- a/Marechai/Services/LicensesService.cs +++ b/Marechai/Services/LicensesService.cs @@ -19,6 +19,8 @@ namespace Marechai.Services OsiApproved = l.OsiApproved, SPDX = l.SPDX }).ToListAsync(); + public async Task GetAsync(int id) => await _context.Licenses.FindAsync(id); + public async Task DeleteAsync(int id) { License item = await _context.Licenses.FindAsync(id);