Show prettyfied ATA IDENTIFY on delete and details.

This commit is contained in:
2019-11-09 21:27:59 +00:00
parent d83f5fa093
commit 77090f12c6
3 changed files with 22 additions and 19 deletions

View File

@@ -1,3 +1,5 @@
@using DiscImageChef.Decoders.ATA
@using DiscImageChef.Server.Core
@model DiscImageChef.CommonTypes.Metadata.Ata
@{
@@ -35,16 +37,11 @@
}
<h3>Are you sure you want to delete this?</h3>
<div>
<h4>Ata</h4>
<h4>ATA IDENTIFY DEVICE / ATAPI IDENTIFY PACKET DEVICE - ID = @Model.Id</h4>
<hr />
<dl class="row">
<dt class="col-sm-2">
@Html.DisplayNameFor(model => model.Identify)
</dt>
<dd class="col-sm-10">
@Html.DisplayFor(model => model.Identify)
</dd>
</dl>
@Html.Raw(Html.EncodedMultiLineText(Identify.Prettify(Model.Identify)))
</div>
<div>
<form asp-action="Delete">
<input type="hidden" asp-for="Id" />
<a asp-action="Index" class="btn btn-primary">Back to List</a>

View File

@@ -1,3 +1,5 @@
@using DiscImageChef.Decoders.ATA
@using DiscImageChef.Server.Core
@model DiscImageChef.CommonTypes.Metadata.Ata
@{
@@ -34,18 +36,10 @@
// ****************************************************************************/
}
<div>
<h4>Ata</h4>
<h4>ATA IDENTIFY DEVICE / ATAPI IDENTIFY PACKET DEVICE - ID = @Model.Id</h4>
<hr />
<dl class="row">
<dt class="col-sm-2">
@Html.DisplayNameFor(model => model.Identify)
</dt>
<dd class="col-sm-10">
@Html.DisplayFor(model => model.Identify)
</dd>
</dl>
@Html.Raw(Html.EncodedMultiLineText(Identify.Prettify(Model.Identify)))
</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>

View File

@@ -0,0 +1,12 @@
using System.Text.RegularExpressions;
using Microsoft.AspNetCore.Mvc.Rendering;
namespace DiscImageChef.Server.Core
{
public static class HtmlHelpers
{
public static string EncodedMultiLineText(this IHtmlHelper<CommonTypes.Metadata.Ata> helper, string text) =>
string.IsNullOrEmpty(text) ? string.Empty
: Regex.Replace(helper.Encode(text), "&#xD;&#xA;|&#xA;|&#xD;", "<br/>");
}
}