mirror of
https://github.com/claunia/marechai.git
synced 2025-12-16 19:14:25 +00:00
Add license details in admin view.
This commit is contained in:
@@ -1,56 +0,0 @@
|
|||||||
@model Marechai.Database.Models.License
|
|
||||||
|
|
||||||
@{
|
|
||||||
ViewData["Title"] = "Details";
|
|
||||||
}
|
|
||||||
<h1>Details</h1>
|
|
||||||
<div>
|
|
||||||
<h4>License</h4>
|
|
||||||
<hr />
|
|
||||||
<dl class="row">
|
|
||||||
<dt class="col-sm-2">
|
|
||||||
@Html.DisplayNameFor(model => model.Name)
|
|
||||||
</dt>
|
|
||||||
<dd class="col-sm-10">
|
|
||||||
@Html.DisplayFor(model => model.Name)
|
|
||||||
</dd>
|
|
||||||
<dt class="col-sm-2">
|
|
||||||
@Html.DisplayNameFor(model => model.SPDX)
|
|
||||||
</dt>
|
|
||||||
<dd class="col-sm-10">
|
|
||||||
@Html.DisplayFor(model => model.SPDX)
|
|
||||||
</dd>
|
|
||||||
<dt class="col-sm-2">
|
|
||||||
@Html.DisplayNameFor(model => model.FsfApproved)
|
|
||||||
</dt>
|
|
||||||
<dd class="col-sm-10">
|
|
||||||
@Html.DisplayFor(model => model.FsfApproved)
|
|
||||||
</dd>
|
|
||||||
<dt class="col-sm-2">
|
|
||||||
@Html.DisplayNameFor(model => model.OsiApproved)
|
|
||||||
</dt>
|
|
||||||
<dd class="col-sm-10">
|
|
||||||
@Html.DisplayFor(model => model.OsiApproved)
|
|
||||||
</dd>
|
|
||||||
<dt class="col-sm-2">
|
|
||||||
@Html.DisplayNameFor(model => model.Link)
|
|
||||||
</dt>
|
|
||||||
<dd class="col-sm-10">
|
|
||||||
@Html.DisplayFor(model => model.Link)
|
|
||||||
</dd>
|
|
||||||
<dt class="col-sm-2">
|
|
||||||
@Html.DisplayNameFor(model => model.Text)
|
|
||||||
</dt>
|
|
||||||
<dd class="col-sm-10">
|
|
||||||
@Html.DisplayFor(model => model.Text)
|
|
||||||
</dd>
|
|
||||||
</dl>
|
|
||||||
</div>
|
|
||||||
<div>
|
|
||||||
<a asp-action="Edit" asp-route-id="@Model.Id" class="btn btn-primary">
|
|
||||||
Edit
|
|
||||||
</a>
|
|
||||||
<a asp-action="Index" class="btn btn-secondary">
|
|
||||||
Back to List
|
|
||||||
</a>
|
|
||||||
</div>
|
|
||||||
@@ -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>3.0.99.1179</Version>
|
<Version>3.0.99.1182</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>
|
||||||
@@ -100,6 +100,9 @@
|
|||||||
<Content Update="Pages\Admin\Details\InstructionSet.razor">
|
<Content Update="Pages\Admin\Details\InstructionSet.razor">
|
||||||
<ExcludeFromSingleFile>true</ExcludeFromSingleFile>
|
<ExcludeFromSingleFile>true</ExcludeFromSingleFile>
|
||||||
</Content>
|
</Content>
|
||||||
|
<Content Update="Pages\Admin\Details\License.razor">
|
||||||
|
<ExcludeFromSingleFile>true</ExcludeFromSingleFile>
|
||||||
|
</Content>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<_ContentIncludedByDefault Remove="Areas\Admin\Views\BrowserTests\Delete.cshtml" />
|
<_ContentIncludedByDefault Remove="Areas\Admin\Views\BrowserTests\Delete.cshtml" />
|
||||||
|
|||||||
79
Marechai/Pages/Admin/Details/License.razor
Normal file
79
Marechai/Pages/Admin/Details/License.razor
Normal file
@@ -0,0 +1,79 @@
|
|||||||
|
@{
|
||||||
|
/******************************************************************************
|
||||||
|
// MARECHAI: Master repository of computing history artifacts information
|
||||||
|
// ----------------------------------------------------------------------------
|
||||||
|
//
|
||||||
|
// Filename : Details.cshtml
|
||||||
|
// Author(s) : Natalia Portillo <claunia@claunia.com>
|
||||||
|
//
|
||||||
|
// --[ 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 <http://www.gnu.org/licenses/>.
|
||||||
|
//
|
||||||
|
// ----------------------------------------------------------------------------
|
||||||
|
// Copyright © 2003-2020 Natalia Portillo
|
||||||
|
*******************************************************************************/
|
||||||
|
}
|
||||||
|
|
||||||
|
@page "/admin/licenses/details/{Id:int}"
|
||||||
|
@inherits OwningComponentBase<LicensesService>
|
||||||
|
@inject IStringLocalizer<LicensesService> L
|
||||||
|
@attribute [Authorize(Roles = "UberAdmin, Admin")]
|
||||||
|
<h3>@L["License details"]</h3>
|
||||||
|
<hr />
|
||||||
|
|
||||||
|
@if (!_loaded)
|
||||||
|
{
|
||||||
|
<p align="center">@L["Loading..."]</p>
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
<div>
|
||||||
|
<Field>
|
||||||
|
<FieldLabel>@L["Name"]</FieldLabel>
|
||||||
|
<TextEdit ReadOnly="!_editable" @bind-Text="@_model.Name"/>
|
||||||
|
</Field>
|
||||||
|
<Field>
|
||||||
|
<FieldLabel>@L["SPDX identifier"]</FieldLabel>
|
||||||
|
<TextEdit ReadOnly="!_editable" @bind-Text="@_model.SPDX"/>
|
||||||
|
</Field>
|
||||||
|
<Field>
|
||||||
|
<FieldLabel>@L["FSF approved"]</FieldLabel>
|
||||||
|
<Check TValue="bool" Disabled="!_editable" @bind-Checked="@_model.FsfApproved"/>
|
||||||
|
</Field>
|
||||||
|
<Field>
|
||||||
|
<FieldLabel>@L["OSI approved"]</FieldLabel>
|
||||||
|
<Check TValue="bool" Disabled="!_editable" @bind-Checked="@_model.OsiApproved"/>
|
||||||
|
</Field>
|
||||||
|
<Field>
|
||||||
|
<FieldLabel>@L["License text link"]</FieldLabel>
|
||||||
|
<TextEdit ReadOnly="!_editable" @bind-Text="@_model.Link"/>
|
||||||
|
</Field>
|
||||||
|
@if (_editable || _model.Text != null)
|
||||||
|
{
|
||||||
|
<Field>
|
||||||
|
<FieldLabel>@L["License text"]</FieldLabel>
|
||||||
|
<MemoEdit Rows="200" Plaintext="true" ReadOnly="!_editable" @bind-Text="@_model.Text" />
|
||||||
|
</Field>
|
||||||
|
}
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
<span class="btn btn-primary">@L["Edit"]</span>
|
||||||
|
<a href="/admin/licenses" class="btn btn-secondary">@L["Back to list"]</a>
|
||||||
|
</div>
|
||||||
29
Marechai/Pages/Admin/Details/License.razor.cs
Normal file
29
Marechai/Pages/Admin/Details/License.razor.cs
Normal file
@@ -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();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -92,9 +92,7 @@
|
|||||||
}
|
}
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<span class="btn btn-primary">
|
<a class="btn btn-primary" href="/admin/licenses/details/@item.Id">@L["Details"]</a>
|
||||||
@L["Details"]
|
|
||||||
</span>
|
|
||||||
<span class="btn btn-secondary">
|
<span class="btn btn-secondary">
|
||||||
@L["Edit"]
|
@L["Edit"]
|
||||||
</span>
|
</span>
|
||||||
|
|||||||
@@ -174,4 +174,32 @@
|
|||||||
<value>Cancelar</value>
|
<value>Cancelar</value>
|
||||||
<comment>Cancel</comment>
|
<comment>Cancel</comment>
|
||||||
</data>
|
</data>
|
||||||
|
<data name="License details" xml:space="preserve">
|
||||||
|
<value>Detalles de licencia</value>
|
||||||
|
<comment>License details</comment>
|
||||||
|
</data>
|
||||||
|
<data name="Back to list" xml:space="preserve">
|
||||||
|
<value>Volver a la lista</value>
|
||||||
|
<comment>Back to list</comment>
|
||||||
|
</data>
|
||||||
|
<data name="SPDX identifier" xml:space="preserve">
|
||||||
|
<value>Identificator SPDX</value>
|
||||||
|
<comment>SPDX identifier</comment>
|
||||||
|
</data>
|
||||||
|
<data name="FSF approved" xml:space="preserve">
|
||||||
|
<value>Aprobada por la FSF</value>
|
||||||
|
<comment>FSF approved</comment>
|
||||||
|
</data>
|
||||||
|
<data name="OSI approved" xml:space="preserve">
|
||||||
|
<value>Aprobada por la OSI</value>
|
||||||
|
<comment>OSI approved</comment>
|
||||||
|
</data>
|
||||||
|
<data name="License text link" xml:space="preserve">
|
||||||
|
<value>Enlace al texto de la licencia</value>
|
||||||
|
<comment>License text link</comment>
|
||||||
|
</data>
|
||||||
|
<data name="License text" xml:space="preserve">
|
||||||
|
<value>Texto de la licencia</value>
|
||||||
|
<comment>License text</comment>
|
||||||
|
</data>
|
||||||
</root>
|
</root>
|
||||||
@@ -19,6 +19,8 @@ namespace Marechai.Services
|
|||||||
OsiApproved = l.OsiApproved, SPDX = l.SPDX
|
OsiApproved = l.OsiApproved, SPDX = l.SPDX
|
||||||
}).ToListAsync();
|
}).ToListAsync();
|
||||||
|
|
||||||
|
public async Task<License> GetAsync(int id) => await _context.Licenses.FindAsync(id);
|
||||||
|
|
||||||
public async Task DeleteAsync(int id)
|
public async Task DeleteAsync(int id)
|
||||||
{
|
{
|
||||||
License item = await _context.Licenses.FindAsync(id);
|
License item = await _context.Licenses.FindAsync(id);
|
||||||
|
|||||||
Reference in New Issue
Block a user