Added basic and projects admin layouts
This commit is contained in:
@@ -0,0 +1,45 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Net.Http;
|
||||
using System.Threading.Tasks;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using MyWebsite.Models;
|
||||
using Newtonsoft.Json;
|
||||
|
||||
namespace MyWebsite.Controllers
|
||||
{
|
||||
public class AdminController : Controller
|
||||
{
|
||||
public IActionResult Index()
|
||||
{
|
||||
return View();
|
||||
}
|
||||
|
||||
public async Task<IActionResult> Projects(int? id)
|
||||
{
|
||||
if (id == null)
|
||||
return View();
|
||||
else
|
||||
{
|
||||
Project[] projects = JsonConvert.DeserializeObject<Project[]>(await new HttpClient().GetStringAsync($"{Request.Scheme}://{Request.Host}/Projects.json"));
|
||||
|
||||
ViewData["Project"] = projects[id.Value];
|
||||
ViewData["Badges"] = new Dictionary<string, string>
|
||||
{
|
||||
{ "csharp", "C# Programming language" },
|
||||
{ "dotnet", ".NET Framework" },
|
||||
{ "xamarin", "Xamarin Framework" },
|
||||
{ "unity", "Unity Engine" },
|
||||
{ "uwp", "Universal Windows Platform" },
|
||||
{ "windows", "Windows Platform" },
|
||||
{ "win32", "Windows Platform (Win32)" },
|
||||
{ "android", "Android Platform" },
|
||||
{ "ios", "iOS Platform" }
|
||||
};
|
||||
|
||||
return View("Views/Admin/ProjectEditor.cshtml");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
|
||||
@{
|
||||
ViewData["Title"] = "Admin panel";
|
||||
}
|
||||
|
||||
<header>
|
||||
<h1>Administration</h1>
|
||||
<h3><b style="color: red">Note:</b> Any write/read operations in this section will require an admin password</h3>
|
||||
</header>
|
||||
|
||||
<article>
|
||||
<form>
|
||||
<input type="password" placeholder="Password" /><br />
|
||||
<label for="area">Go to section:</label><br />
|
||||
<div class="select-container">
|
||||
<select id="area">
|
||||
<option>Contact links</option>
|
||||
<option>Artworks</option>
|
||||
<option>Projects</option>
|
||||
<option>Resume</option>
|
||||
</select>
|
||||
</div>
|
||||
<button>Proceed</button>
|
||||
</form>
|
||||
</article>
|
||||
|
||||
<link rel="stylesheet" type="text/css" href="~/css/Admin.css" />
|
||||
@@ -0,0 +1,35 @@
|
||||
|
||||
@{
|
||||
ViewData["Title"] = "Project editor";
|
||||
Project project = ViewData["Project"] as Project;
|
||||
}
|
||||
|
||||
<header>
|
||||
<h1>Project editor</h1>
|
||||
<h2>@project.Title</h2>
|
||||
</header>
|
||||
|
||||
<article>
|
||||
<form>
|
||||
<label for="langSelector">Language:</label>
|
||||
<div class="select-container">
|
||||
<select id="langSelector">
|
||||
<option>English</option>
|
||||
<option>Russian</option>
|
||||
</select>
|
||||
</div>
|
||||
|
||||
<label for="title">Title:</label>
|
||||
<input id="title" placeholder="Title" type="text" value="@project.Title"/>
|
||||
|
||||
<label for="description">Description:</label>
|
||||
<textarea id="description" placeholder="Description" type="text">@project.Description</textarea>
|
||||
|
||||
<label for="thumbnail">Thumbnail:</label>
|
||||
<input id="thumbnail" placeholder="Thumbnail" type="file" />
|
||||
|
||||
<button>Submit</button>
|
||||
</form>
|
||||
</article>
|
||||
|
||||
<link rel="stylesheet" type="text/css" href="~/css/Admin.css" />
|
||||
@@ -0,0 +1,7 @@
|
||||
|
||||
@{
|
||||
ViewData["Title"] = "Projects list";
|
||||
}
|
||||
|
||||
<h2>Projects</h2>
|
||||
|
||||
@@ -0,0 +1,62 @@
|
||||
input {
|
||||
padding: 10px;
|
||||
border-radius: 10px;
|
||||
border: 1px solid black;
|
||||
width: 100%;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
select {
|
||||
padding: 10px;
|
||||
border: 1px solid black;
|
||||
border-radius: 10px;
|
||||
width: 100%;
|
||||
-moz-appearance: none; /* Firefox */
|
||||
-webkit-appearance: none; /* Safari and Chrome */
|
||||
}
|
||||
|
||||
button {
|
||||
margin: 10px;
|
||||
border-radius: 10px;
|
||||
border: 0px;
|
||||
padding: 10px 20px;
|
||||
background-color: #343434;
|
||||
color: white;
|
||||
}
|
||||
|
||||
textarea {
|
||||
resize: none;
|
||||
width: 100%;
|
||||
border-radius: 10px;
|
||||
border: 1px solid black;
|
||||
padding: 10px;
|
||||
box-sizing: border-box;
|
||||
height: 200px;
|
||||
font-family: Consolas;
|
||||
}
|
||||
|
||||
.select-container::after {
|
||||
content: '>';
|
||||
transform: rotate(90deg);
|
||||
-webkit-transform: rotate(90deg);
|
||||
-moz-transform: rotate(90deg);
|
||||
-ms-transform: rotate(90deg);
|
||||
right: 11px;
|
||||
top: 11px;
|
||||
position: absolute;
|
||||
pointer-events: none;
|
||||
}
|
||||
|
||||
.select-container {
|
||||
position: relative;
|
||||
}
|
||||
|
||||
form {
|
||||
max-width: 50%;
|
||||
}
|
||||
|
||||
@media only screen and (max-width: 700px) {
|
||||
form {
|
||||
max-width: initial;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user