mirror of
https://github.com/claunia/marechai.git
synced 2025-12-16 19:14:25 +00:00
Add sound synthesizer details in admin view.
This commit is contained in:
@@ -1,111 +0,0 @@
|
||||
@{
|
||||
/******************************************************************************
|
||||
// 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
|
||||
*******************************************************************************/
|
||||
}
|
||||
@model Marechai.Database.Models.SoundSynth
|
||||
|
||||
@{
|
||||
ViewData["Title"] = "Details";
|
||||
}
|
||||
<h2>Details</h2>
|
||||
<div>
|
||||
<h4>Sound synthetizer</h4>
|
||||
<hr />
|
||||
<dl class="dl-horizontal">
|
||||
<dt>
|
||||
@Html.DisplayNameFor(model => model.Company)
|
||||
</dt>
|
||||
<dd>
|
||||
@Html.DisplayFor(model => model.Company.Name)
|
||||
</dd>
|
||||
<dt>
|
||||
@Html.DisplayNameFor(model => model.Name)
|
||||
</dt>
|
||||
<dd>
|
||||
@Html.DisplayFor(model => model.Name)
|
||||
</dd>
|
||||
<dt>
|
||||
@Html.DisplayNameFor(model => model.ModelCode)
|
||||
</dt>
|
||||
<dd>
|
||||
@Html.DisplayFor(model => model.ModelCode)
|
||||
</dd>
|
||||
<dt>
|
||||
@Html.DisplayNameFor(model => model.Introduced)
|
||||
</dt>
|
||||
<dd>
|
||||
@Html.DisplayFor(model => model.IntroducedView)
|
||||
</dd>
|
||||
<dt>
|
||||
@Html.DisplayNameFor(model => model.Type)
|
||||
</dt>
|
||||
<dd>
|
||||
@Html.DisplayFor(model => model.Type)
|
||||
</dd>
|
||||
<dt>
|
||||
@Html.DisplayNameFor(model => model.Voices)
|
||||
</dt>
|
||||
<dd>
|
||||
@Html.DisplayFor(model => model.Voices)
|
||||
</dd>
|
||||
<dt>
|
||||
@Html.DisplayNameFor(model => model.Frequency)
|
||||
</dt>
|
||||
<dd>
|
||||
@Html.DisplayFor(model => model.Frequency)
|
||||
</dd>
|
||||
<dt>
|
||||
@Html.DisplayNameFor(model => model.Depth)
|
||||
</dt>
|
||||
<dd>
|
||||
@Html.DisplayFor(model => model.Depth)
|
||||
</dd>
|
||||
<dt>
|
||||
@Html.DisplayNameFor(model => model.SquareWave)
|
||||
</dt>
|
||||
<dd>
|
||||
@Html.DisplayFor(model => model.SquareWave)
|
||||
</dd>
|
||||
<dt>
|
||||
@Html.DisplayNameFor(model => model.WhiteNoise)
|
||||
</dt>
|
||||
<dd>
|
||||
@Html.DisplayFor(model => model.WhiteNoise)
|
||||
</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>
|
||||
@@ -118,6 +118,9 @@
|
||||
<Content Update="Pages\Admin\Details\Screen.razor">
|
||||
<ExcludeFromSingleFile>true</ExcludeFromSingleFile>
|
||||
</Content>
|
||||
<Content Update="Pages\Admin\Details\SoundSynth.razor">
|
||||
<ExcludeFromSingleFile>true</ExcludeFromSingleFile>
|
||||
</Content>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<_ContentIncludedByDefault Remove="Areas\Admin\Views\BrowserTests\Delete.cshtml" />
|
||||
|
||||
125
Marechai/Pages/Admin/Details/SoundSynth.razor
Normal file
125
Marechai/Pages/Admin/Details/SoundSynth.razor
Normal file
@@ -0,0 +1,125 @@
|
||||
@{
|
||||
/******************************************************************************
|
||||
// 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/sound_synths/details/{Id:int}"
|
||||
@inherits OwningComponentBase<SoundSynthsService>
|
||||
@inject IStringLocalizer<SoundSynthsService> L
|
||||
@inject CompaniesService CompaniesService
|
||||
@attribute [Authorize(Roles = "UberAdmin, Admin")]
|
||||
<h3>@L["Sound synthesizer details"]</h3>
|
||||
<hr />
|
||||
|
||||
@if (!_loaded)
|
||||
{
|
||||
<p align="center">@L["Loading..."]</p>
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
<div>
|
||||
@if (_editable || _model.CompanyId != null)
|
||||
{
|
||||
<Field>
|
||||
<FieldLabel>@L["Company"]</FieldLabel>
|
||||
<Select Disabled="!_editable" TValue="int?" @bind-SelectedValue="@_model.CompanyId">
|
||||
@foreach (var company in _companies)
|
||||
{
|
||||
<SelectItem TValue="int?" Value="@company.Id">@company.Name</SelectItem>
|
||||
}
|
||||
</Select>
|
||||
</Field>
|
||||
}
|
||||
<Field>
|
||||
<FieldLabel>@L["Name"]</FieldLabel>
|
||||
<TextEdit Disabled="!_editable" @bind-Text="@_model.Name"/>
|
||||
</Field>
|
||||
@if (_editable || _model.ModelCode != null)
|
||||
{
|
||||
<Field>
|
||||
<FieldLabel>@L["Model code"]</FieldLabel>
|
||||
<TextEdit Disabled="!_editable" @bind-Text="@_model.ModelCode"/>
|
||||
</Field>
|
||||
}
|
||||
@if (_editable || _model.Introduced.HasValue)
|
||||
{
|
||||
<Field>
|
||||
<FieldLabel>@L["Introduced"]</FieldLabel>
|
||||
<DateEdit Disabled="!_editable" TValue="DateTime?" @bind-Date="@_model.Introduced"/>
|
||||
</Field>
|
||||
}
|
||||
@if (_editable || _model.Voices.HasValue)
|
||||
{
|
||||
<Field>
|
||||
<FieldLabel>@L["Digitized voices"]</FieldLabel>
|
||||
<NumericEdit Disabled="!_editable" TValue="int?" Decimals="0" @bind-Value="@_model.Voices"/>
|
||||
</Field>
|
||||
}
|
||||
@if (_editable || _model.Frequency.HasValue)
|
||||
{
|
||||
<Field>
|
||||
<FieldLabel>@L["Sample rate (Hz)"]</FieldLabel>
|
||||
<NumericEdit Disabled="!_editable" TValue="double?" Decimals="0" @bind-Value="@_model.Frequency"/>
|
||||
</Field>
|
||||
}
|
||||
@if (_editable || _model.Depth.HasValue)
|
||||
{
|
||||
<Field>
|
||||
<FieldLabel>@L["Sample resolution (bits)"]</FieldLabel>
|
||||
<NumericEdit Disabled="!_editable" TValue="int?" Decimals="0" @bind-Value="@_model.Depth"/>
|
||||
</Field>
|
||||
}
|
||||
@if (_editable || _model.SquareWave.HasValue)
|
||||
{
|
||||
<Field>
|
||||
<FieldLabel>@L["Square wave channels"]</FieldLabel>
|
||||
<NumericEdit Disabled="!_editable" TValue="int?" Decimals="0" @bind-Value="@_model.SquareWave"/>
|
||||
</Field>
|
||||
}
|
||||
@if (_editable || _model.WhiteNoise.HasValue)
|
||||
{
|
||||
<Field>
|
||||
<FieldLabel>@L["White noise channels"]</FieldLabel>
|
||||
<NumericEdit Disabled="!_editable" TValue="int?" Decimals="0" @bind-Value="@_model.WhiteNoise"/>
|
||||
</Field>
|
||||
}
|
||||
@if (_editable || _model.Type.HasValue)
|
||||
{
|
||||
<Field>
|
||||
<FieldLabel>@L["Type"]</FieldLabel>
|
||||
<NumericEdit Disabled="!_editable" TValue="int?" Decimals="0" @bind-Value="@_model.Type"/>
|
||||
</Field>
|
||||
}
|
||||
</div>
|
||||
<div>
|
||||
<span class="btn btn-primary">@L["Edit"]</span>
|
||||
<a href="/admin/sound_synths" class="btn btn-secondary">@L["Back to list"]</a>
|
||||
</div>
|
||||
33
Marechai/Pages/Admin/Details/SoundSynth.razor.cs
Normal file
33
Marechai/Pages/Admin/Details/SoundSynth.razor.cs
Normal file
@@ -0,0 +1,33 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Threading.Tasks;
|
||||
using Marechai.ViewModels;
|
||||
using Microsoft.AspNetCore.Components;
|
||||
|
||||
namespace Marechai.Pages.Admin.Details
|
||||
{
|
||||
public partial class SoundSynth
|
||||
{
|
||||
List<CompanyViewModel> _companies;
|
||||
bool _editable;
|
||||
bool _loaded;
|
||||
Database.Models.SoundSynth _model;
|
||||
[Parameter]
|
||||
public int Id { get; set; }
|
||||
|
||||
protected override async Task OnAfterRenderAsync(bool firstRender)
|
||||
{
|
||||
if(_loaded)
|
||||
return;
|
||||
|
||||
_loaded = true;
|
||||
|
||||
if(Id <= 0)
|
||||
return;
|
||||
|
||||
_companies = await CompaniesService.GetAsync();
|
||||
_model = await Service.GetAsync(Id);
|
||||
|
||||
StateHasChanged();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -87,9 +87,7 @@
|
||||
@item.Type
|
||||
</td>
|
||||
<td>
|
||||
<span class="btn btn-primary">
|
||||
@L["Details"]
|
||||
</span>
|
||||
<a class="btn btn-primary" href="/admin/sound_synths/details/@item.Id">@L["Details"]</a>
|
||||
<span class="btn btn-secondary">
|
||||
@L["Edit"]
|
||||
</span>
|
||||
|
||||
@@ -174,4 +174,32 @@
|
||||
<value>Cancelar</value>
|
||||
<comment>Cancel</comment>
|
||||
</data>
|
||||
<data name="Sound synthesizer details" xml:space="preserve">
|
||||
<value>Detalles de sintetizador de sonido</value>
|
||||
<comment>Sound synthesizer 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="Digitized voices" xml:space="preserve">
|
||||
<value>Voces digitalizadas</value>
|
||||
<comment>Digitized voices</comment>
|
||||
</data>
|
||||
<data name="Sample rate (Hz)" xml:space="preserve">
|
||||
<value>Frecuencia de muestreo (Hz)</value>
|
||||
<comment>Sample rate (Hz)</comment>
|
||||
</data>
|
||||
<data name="Sample resolution (bits)" xml:space="preserve">
|
||||
<value>Resolución de muestreo (bits)</value>
|
||||
<comment>Sample resolution (bits)</comment>
|
||||
</data>
|
||||
<data name="Square wave channels" xml:space="preserve">
|
||||
<value>Canales de onda cuadrada</value>
|
||||
<comment>Square wave channels</comment>
|
||||
</data>
|
||||
<data name="White noise channels" xml:space="preserve">
|
||||
<value>Canales de ruido blanco</value>
|
||||
<comment>White noise channels</comment>
|
||||
</data>
|
||||
</root>
|
||||
@@ -34,6 +34,8 @@ namespace Marechai.Services
|
||||
WhiteNoise = s.WhiteNoise, Type = s.Type
|
||||
}).ToListAsync();
|
||||
|
||||
public async Task<SoundSynth> GetAsync(int id) => await _context.SoundSynths.FindAsync(id);
|
||||
|
||||
public async Task DeleteAsync(int id)
|
||||
{
|
||||
SoundSynth item = await _context.SoundSynths.FindAsync(id);
|
||||
|
||||
Reference in New Issue
Block a user