Added russian captions support to badges, fixed svg images display on gallery page
This commit is contained in:
@@ -20,13 +20,18 @@
|
||||
<div asp-validation-summary="ModelOnly" class="text-danger"></div>
|
||||
<div>
|
||||
<label asp-for="Name"></label>
|
||||
<input asp-for="Name" type="text"/>
|
||||
<input asp-for="Name" type="text" />
|
||||
<span asp-validation-for="Name" class="text-danger"></span>
|
||||
</div>
|
||||
<div>
|
||||
<label asp-for="Description"></label>
|
||||
<input asp-for="Description" type="text" />
|
||||
<span asp-validation-for="Description" class="text-danger"></span>
|
||||
<label asp-for="EnglishDescription"></label>
|
||||
<input asp-for="EnglishDescription" type="text" />
|
||||
<span asp-validation-for="EnglishDescription" class="text-danger"></span>
|
||||
</div>
|
||||
<div>
|
||||
<label asp-for="RussianDescription"></label>
|
||||
<input asp-for="RussianDescription" type="text" />
|
||||
<span asp-validation-for="RussianDescription" class="text-danger"></span>
|
||||
</div>
|
||||
<div>
|
||||
<label asp-for="Image"></label>
|
||||
@@ -36,36 +41,10 @@
|
||||
</div>
|
||||
<span asp-validation-for="Image" class="text-danger"></span>
|
||||
</div>
|
||||
<div>
|
||||
<label>Preview:</label>
|
||||
<div class="badge" id="preview"></div>
|
||||
</div>
|
||||
<partial name="Preview.cshtml" />
|
||||
|
||||
<input type="submit" value="Create" class="btn" />
|
||||
</form>
|
||||
</article>
|
||||
|
||||
<link type="text/css" rel="stylesheet" href="~/css/Admin.css" />
|
||||
<style type="text/css">
|
||||
.badge {
|
||||
height: 50px;
|
||||
width: 50px;
|
||||
margin: 10px 0px;
|
||||
background-size: contain;
|
||||
}
|
||||
|
||||
.image-selector {
|
||||
display: grid;
|
||||
grid-template-columns: 1fr auto;
|
||||
align-items: center;
|
||||
}
|
||||
</style>
|
||||
|
||||
<script type="text/javascript">
|
||||
UpdatePreview();
|
||||
function UpdatePreview() {
|
||||
var preview = document.getElementById("preview");
|
||||
preview.title = document.getElementById("Description").value;
|
||||
preview.style.backgroundImage = "url(/images/Badges/" + document.getElementById("Image").value + ".png)";
|
||||
}
|
||||
</script>
|
||||
<link type="text/css" rel="stylesheet" href="~/css/Admin.css" />
|
||||
@@ -13,7 +13,8 @@
|
||||
<article>
|
||||
<p class="form-group">
|
||||
<b>@Html.DisplayNameFor(model => model.Name):</b> @Model.Name<br />
|
||||
<b>@Html.DisplayNameFor(model => model.Description):</b> @Model.Description<br />
|
||||
<b>@Html.DisplayNameFor(model => model.EnglishDescription):</b> @Model.EnglishDescription<br />
|
||||
<b>@Html.DisplayNameFor(model => model.RussianDescription):</b> @Model.RussianDescription<br />
|
||||
<b>@Html.DisplayNameFor(model => model.Image):</b> @(Model.Image).png<br />
|
||||
|
||||
<b>Preview:</b>
|
||||
|
||||
@@ -24,9 +24,14 @@
|
||||
<span asp-validation-for="Name" class="text-danger"></span>
|
||||
</div>
|
||||
<div>
|
||||
<label asp-for="Description"></label>
|
||||
<input asp-for="Description" type="text" />
|
||||
<span asp-validation-for="Description" class="text-danger"></span>
|
||||
<label asp-for="EnglishDescription"></label>
|
||||
<input asp-for="EnglishDescription" type="text" />
|
||||
<span asp-validation-for="EnglishDescription" class="text-danger"></span>
|
||||
</div>
|
||||
<div>
|
||||
<label asp-for="RussianDescription"></label>
|
||||
<input asp-for="RussianDescription" type="text" />
|
||||
<span asp-validation-for="RussianDescription" class="text-danger"></span>
|
||||
</div>
|
||||
<div>
|
||||
<label asp-for="Image"></label>
|
||||
@@ -36,36 +41,10 @@
|
||||
</div>
|
||||
<span asp-validation-for="Image" class="text-danger"></span>
|
||||
</div>
|
||||
<div>
|
||||
<label>Preview:</label>
|
||||
<div class="badge" id="preview"></div>
|
||||
</div>
|
||||
<partial name="Preview.cshtml" />
|
||||
|
||||
<input type="submit" value="Save" class="btn" />
|
||||
</form>
|
||||
</article>
|
||||
|
||||
<link type="text/css" rel="stylesheet" href="~/css/Admin.css" />
|
||||
<style type="text/css">
|
||||
.badge {
|
||||
height: 50px;
|
||||
width: 50px;
|
||||
margin: 10px 0px;
|
||||
background-size: contain;
|
||||
}
|
||||
.image-selector {
|
||||
display: grid;
|
||||
grid-template-columns: 1fr auto;
|
||||
align-items: center;
|
||||
}
|
||||
</style>
|
||||
|
||||
<script type="text/javascript">
|
||||
UpdatePreview();
|
||||
function UpdatePreview()
|
||||
{
|
||||
var preview = document.getElementById("preview");
|
||||
preview.title = document.getElementById("Description").value;
|
||||
preview.style.backgroundImage = "url(/images/Badges/" + document.getElementById("Image").value + ".png)";
|
||||
}
|
||||
</script>
|
||||
<link type="text/css" rel="stylesheet" href="~/css/Admin.css" />
|
||||
@@ -20,7 +20,10 @@
|
||||
@Html.DisplayNameFor(model => model.Name)
|
||||
</th>
|
||||
<th>
|
||||
@Html.DisplayNameFor(model => model.Description)
|
||||
@Html.DisplayNameFor(model => model.EnglishDescription)
|
||||
</th>
|
||||
<th>
|
||||
@Html.DisplayNameFor(model => model.RussianDescription)
|
||||
</th>
|
||||
<th>
|
||||
@Html.DisplayNameFor(model => model.Image)
|
||||
@@ -36,7 +39,8 @@
|
||||
<div class="badge" style="background-image: url(/images/Badges/@(item.Image).png)" title="@(item.Description)"></div>
|
||||
</td>
|
||||
<td>@item.Name</td>
|
||||
<td>@item.Description</td>
|
||||
<td>@item.EnglishDescription</td>
|
||||
<td>@item.RussianDescription</td>
|
||||
<td>@item.Image</td>
|
||||
<td>
|
||||
<a asp-action="Edit" asp-route-id="@item.Name">Edit</a> |
|
||||
|
||||
@@ -0,0 +1,29 @@
|
||||
<div>
|
||||
<label>Preview:</label>
|
||||
<div class="badge" id="preview"></div>
|
||||
</div>
|
||||
<style type="text/css">
|
||||
.badge
|
||||
{
|
||||
height: 50px;
|
||||
width: 50px;
|
||||
margin: 10px 0px;
|
||||
background-size: contain;
|
||||
}
|
||||
|
||||
.image-selector
|
||||
{
|
||||
display: grid;
|
||||
grid-template-columns: 1fr auto;
|
||||
align-items: center;
|
||||
}
|
||||
</style>
|
||||
<script type="text/javascript">
|
||||
UpdatePreview();
|
||||
function UpdatePreview()
|
||||
{
|
||||
var preview = document.getElementById("preview");
|
||||
preview.title = document.getElementById("EnglishDescription").value;
|
||||
preview.style.backgroundImage = "url(/images/Badges/" + document.getElementById("Image").value + ".png)";
|
||||
}
|
||||
</script>
|
||||
@@ -16,7 +16,6 @@
|
||||
<b>@Html.DisplayNameFor(model => model.Order):</b> @Model.Order<br />
|
||||
<b>@Html.DisplayNameFor(model => model.EnglishTitle):</b> @Model.EnglishTitle<br />
|
||||
<b>@Html.DisplayNameFor(model => model.RussianTitle):</b> @Model.RussianTitle<br />
|
||||
<b>@Html.DisplayNameFor(model => model.Title):</b> @Model.Title<br />
|
||||
<b>@Html.DisplayNameFor(model => model.Username):</b> @Model.Username<br />
|
||||
<b>@Html.DisplayNameFor(model => model.Url):</b> @Model.Url<br />
|
||||
<b>@Html.DisplayNameFor(model => model.CanContactMe):</b> @Html.DisplayFor(model => model.CanContactMe)<br />
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
using System.ComponentModel;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
using System.Globalization;
|
||||
|
||||
namespace MyWebsite.Models
|
||||
{
|
||||
@@ -10,10 +11,18 @@ namespace MyWebsite.Models
|
||||
[Column(TypeName = "varchar(10)")]
|
||||
[DisplayName("ID")]
|
||||
public string Name { get; set; }
|
||||
[Column(TypeName = "varchar(100)")]
|
||||
[Required]
|
||||
|
||||
[DisplayName("Caption")]
|
||||
public string Description { get; set; }
|
||||
public string Description => CultureInfo.CurrentUICulture.TwoLetterISOLanguageName == "ru" && !string.IsNullOrWhiteSpace(RussianDescription) ? RussianDescription : EnglishDescription;
|
||||
|
||||
[Required]
|
||||
[Column(TypeName = "varchar(50)")]
|
||||
[DisplayName("Caption (en)")]
|
||||
public string EnglishDescription { get; set; }
|
||||
[Column(TypeName = "varchar(50)")]
|
||||
[DisplayName("Caption (ru)")]
|
||||
public string RussianDescription { get; set; }
|
||||
|
||||
[Column(TypeName = "varchar(20)")]
|
||||
[Required]
|
||||
[DisplayName("Image name")]
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
.gallery img
|
||||
{
|
||||
object-fit: cover;
|
||||
max-height: 300px;
|
||||
height: 300px;
|
||||
max-width: 100%;
|
||||
margin: 2px;
|
||||
transition: .25s;
|
||||
@@ -19,7 +19,7 @@
|
||||
{
|
||||
.gallery img
|
||||
{
|
||||
max-height: none;
|
||||
height: initial;
|
||||
}
|
||||
|
||||
.gallery img:hover
|
||||
|
||||
Reference in New Issue
Block a user