Added iOS badge, updated project info and transfrerred some js code to C#
This commit is contained in:
@@ -3,6 +3,7 @@ using MyWebsite.Models;
|
|||||||
using Newtonsoft.Json;
|
using Newtonsoft.Json;
|
||||||
using System.Net.Http;
|
using System.Net.Http;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
|
||||||
namespace MyWebsite.Controllers
|
namespace MyWebsite.Controllers
|
||||||
{
|
{
|
||||||
@@ -12,7 +13,19 @@ namespace MyWebsite.Controllers
|
|||||||
{
|
{
|
||||||
Project[] projects = JsonConvert.DeserializeObject<Project[]>(await new HttpClient().GetStringAsync($"{Request.Scheme}://{Request.Host}/Projects.json"));
|
Project[] projects = JsonConvert.DeserializeObject<Project[]>(await new HttpClient().GetStringAsync($"{Request.Scheme}://{Request.Host}/Projects.json"));
|
||||||
|
|
||||||
ViewData["Images"] = projects;
|
ViewData["Projects"] = projects;
|
||||||
|
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();
|
return View();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,4 @@
|
|||||||
|
@{
|
||||||
@{
|
|
||||||
ViewData["Title"] = "My projects";
|
ViewData["Title"] = "My projects";
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -12,23 +11,27 @@
|
|||||||
</header>
|
</header>
|
||||||
|
|
||||||
<article>
|
<article>
|
||||||
@foreach (Project p in ViewData["Images"] as Project[])
|
@foreach (Project p in ViewData["Projects"] as Project[])
|
||||||
{
|
{
|
||||||
<div class="project-item">
|
<div class="project-item">
|
||||||
<div>
|
<div>
|
||||||
<h1>@p.Title</h1>
|
<h1>@p.Title</h1>
|
||||||
<p class="description">@p.Description</p>
|
<p class="description">
|
||||||
|
@foreach(string line in p.Description.Split("<br />"))
|
||||||
|
{
|
||||||
|
@line<br />
|
||||||
|
}
|
||||||
|
</p>
|
||||||
<a href="@(p.Link)" target="_blank">@p.LinkCaption</a>
|
<a href="@(p.Link)" target="_blank">@p.LinkCaption</a>
|
||||||
</div>
|
</div>
|
||||||
<div>
|
<div>
|
||||||
@foreach (string i in p.Badges)
|
@foreach (string i in p.Badges)
|
||||||
{
|
{
|
||||||
<div class="badge @i"></div>
|
<div class="badge @i" title="@((ViewData["Badges"] as dynamic)[i])"></div>
|
||||||
}
|
}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
}
|
}
|
||||||
<script type="text/javascript">UpdateProjects();</script>
|
|
||||||
</article>
|
</article>
|
||||||
|
|
||||||
<link rel="stylesheet" type="text/css" href="~/css/Projects.css" />
|
<link rel="stylesheet" type="text/css" href="~/css/Projects.css" />
|
||||||
@@ -21,7 +21,8 @@
|
|||||||
"csharp",
|
"csharp",
|
||||||
"xamarin",
|
"xamarin",
|
||||||
"uwp",
|
"uwp",
|
||||||
"android"
|
"android",
|
||||||
|
"ios"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
|||||||
Binary file not shown.
|
After Width: | Height: | Size: 4.8 KiB |
@@ -23,49 +23,3 @@ function ToggleImageSize()
|
|||||||
image.style.maxWidth = "none";
|
image.style.maxWidth = "none";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function UpdateProjects()
|
|
||||||
{
|
|
||||||
// Settings badges tooltips
|
|
||||||
var badges = document.getElementsByClassName("badge");
|
|
||||||
for (var i = 0; i < badges.length; i++)
|
|
||||||
{
|
|
||||||
switch (badges[i].classList[1])
|
|
||||||
{
|
|
||||||
case "csharp":
|
|
||||||
badges[i].setAttribute("title", "C# Programming language");
|
|
||||||
break;
|
|
||||||
case "dotnet":
|
|
||||||
badges[i].setAttribute("title", ".NET Framework");
|
|
||||||
break;
|
|
||||||
case "xamarin":
|
|
||||||
badges[i].setAttribute("title", "Xamarin Framework");
|
|
||||||
break;
|
|
||||||
case "unity":
|
|
||||||
badges[i].setAttribute("title", "Unity Engine");
|
|
||||||
break;
|
|
||||||
case "uwp":
|
|
||||||
badges[i].setAttribute("title", "Universal Windows Platform");
|
|
||||||
break;
|
|
||||||
case "windows":
|
|
||||||
badges[i].setAttribute("title", "Windows Platform");
|
|
||||||
break;
|
|
||||||
case "win32":
|
|
||||||
badges[i].setAttribute("title", "Windows Platform (Win32)");
|
|
||||||
break;
|
|
||||||
case "android":
|
|
||||||
badges[i].setAttribute("title", "Android Platform");
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Making projects descriptions multiline
|
|
||||||
var descriptions = document.getElementsByClassName("description");
|
|
||||||
for (var i = 0; i < descriptions.length; i++)
|
|
||||||
{
|
|
||||||
var desc = descriptions[i];
|
|
||||||
var text = desc.innerText;
|
|
||||||
desc.innerText = "";
|
|
||||||
desc.innerHTML = text;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
Reference in New Issue
Block a user