refactor + add stuff

* solution-wide renames
* added carousel pic (ms luvz linux)
* created carousel helper
* updated project build configurations
This commit is contained in:
surtur 2020-09-24 13:39:44 +02:00
parent c0c2cfe397
commit f8bb1d5fcc
Signed by: wanderer
GPG Key ID: 19CE1EC1D9E0486D
23 changed files with 210 additions and 147 deletions

2
.gitignore vendored
View File

@ -3,3 +3,5 @@ obj/
/packages/ /packages/
riderModule.iml riderModule.iml
/_ReSharper.Caches/ /_ReSharper.Caches/
/node_modules
/wwwroot/node_modules

View File

@ -4,15 +4,19 @@ using System.Diagnostics;
using System.Linq; using System.Linq;
using System.Threading.Tasks; using System.Threading.Tasks;
using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.Mvc;
using pwa_0x01_2._1.Models; using pwt_0x01.Models;
namespace pwa_0x01_2._1.Controllers namespace pwt_0x01.Controllers
{ {
public class HomeController : Controller public class HomeController : Controller
{ {
private IList<Carousel> Carousels = CarouselHelper.GenerateCarousel();
public IActionResult Index() public IActionResult Index()
{ {
return View(); CarouselViewModel carousel = new CarouselViewModel();
carousel.Carousels = Carousels;
return View(carousel);
} }
public IActionResult About() public IActionResult About()

View File

@ -1,7 +1,10 @@
namespace pwa_0x01_2._1.Models namespace pwt_0x01.Models
{ {
public class Carousel public class Carousel
{ {
public string DataTarget { get; set; }
public string ImageSrc { get; set; }
public string ImageAlt { get; set; }
public string CarouselContent { get; set; }
} }
} }

View File

@ -1,7 +1,19 @@
namespace pwa_0x01_2._1.Models using System.Collections.Generic;
namespace pwt_0x01.Models
{ {
public class CarouselHelper public class CarouselHelper
{ {
public static IList<Carousel> GenerateCarousel()
{
IList<Carousel> carousel = new List<Carousel>()
{
new Carousel() {DataTarget = "#myCarousel", ImageSrc = "/images/banner1.svg", ImageAlt = "img1", CarouselContent = "Learn how to build ASP.NET apps that can run anywhere. <a class=\"btn btn-default\" href=\"https://go.microsoft.com/fwlink/?LinkID=525028&clcid=0x409\">Learn More</a>"},
new Carousel() {DataTarget = "#myCarousel", ImageSrc = "/images/banner2.svg", ImageAlt = "img2", CarouselContent = "There are powerful new features in Visual Studio for building modern web apps. <a class=\"btn btn-default\" href=\"https://go.microsoft.com/fwlink/?LinkID=525030&clcid=0x409\">Learn More</a>"},
new Carousel() {DataTarget = "#myCarousel", ImageSrc = "/images/banner3.svg", ImageAlt = "img3", CarouselContent = "Learn how Microsoft's Azure cloud platform allows you to build, deploy, and scale web apps.<a class=\"btn btn-default\" href=\"https://go.microsoft.com/fwlink/?LinkID=525027&clcid=0x409\">Learn More</a>"},
new Carousel() {DataTarget = "#myCarousel", ImageSrc = "/images/ms_loves_linux.jpeg", ImageAlt = "ms loves linux", CarouselContent = "m$ loves linux, reportedly<a class=\"btn btn-default\" href=\"#\">Learn More</a>"}
};
return carousel;
}
} }
} }

View File

@ -1,7 +1,9 @@
namespace pwa_0x01_2._1.Models using System.Collections.Generic;
namespace pwt_0x01.Models
{ {
public class CarouselViewModel public class CarouselViewModel
{ {
public IList<Carousel> Carousels { get; set; }
} }
} }

View File

@ -1,6 +1,6 @@
using System; using System;
namespace pwa_0x01_2._1.Models namespace pwt_0x01.Models
{ {
public class ErrorViewModel public class ErrorViewModel
{ {

View File

@ -8,7 +8,7 @@ using Microsoft.AspNetCore.Hosting;
using Microsoft.Extensions.Configuration; using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.Logging; using Microsoft.Extensions.Logging;
namespace pwa_0x01_2._1 namespace pwt_0x01
{ {
public class Program public class Program
{ {

View File

@ -15,7 +15,7 @@
"ASPNETCORE_ENVIRONMENT": "Development" "ASPNETCORE_ENVIRONMENT": "Development"
} }
}, },
"pwa_0x01_2._1": { "pwt_0x01": {
"commandName": "Project", "commandName": "Project",
"launchBrowser": true, "launchBrowser": true,
"applicationUrl": "https://localhost:5001;http://localhost:5000", "applicationUrl": "https://localhost:5001;http://localhost:5000",

3
README.md Normal file
View File

@ -0,0 +1,3 @@
# pwa-0x01
this repo holds *sawce* for a 0x01 .netcore mvc webapp for PWA lessons

View File

@ -10,7 +10,7 @@ using Microsoft.AspNetCore.Mvc;
using Microsoft.Extensions.Configuration; using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.DependencyInjection;
namespace pwa_0x01_2._1 namespace pwt_0x01
{ {
public class Startup public class Startup
{ {

View File

@ -1,47 +1,40 @@
@{ @using Microsoft.AspNetCore.Razor.Language.Intermediate
@model CarouselViewModel
@{
ViewData["Title"] = "Home Page"; ViewData["Title"] = "Home Page";
} }
<div id="myCarousel" class="carousel slide" data-ride="carousel" data-interval="6000"> <div id="myCarousel" class="carousel slide" data-ride="carousel" data-interval="6000">
<ol class="carousel-indicators"> <ol class="carousel-indicators">
<li data-target="#myCarousel" data-slide-to="0" class="active"></li> @{
<li data-target="#myCarousel" data-slide-to="1"></li> for (int i = 0; i < Model.Carousels.Count; i++)
<li data-target="#myCarousel" data-slide-to="2"></li> {
string class_attribute = "";
if (i == 0)
{
class_attribute = "class = \"active\"";
}
<li data-target="@Model.Carousels[i].DataTarget" data-slide-to="@i" @Html.Raw(class_attribute)></li>
}
}
</ol> </ol>
<div class="carousel-inner" role="listbox"> <div class="carousel-inner" role="listbox">
<div class="item active"> @{
<img src="~/images/banner1.svg" alt="ASP.NET" class="img-responsive" /> for (int i = 0; i < Model.Carousels.Count; i++)
{
string class_div = "item";
if (i == 0)
{
class_div = "item active";
}
<div class="@Html.Raw(class_div)">
<img src="@Model.Carousels[i].ImageSrc" alt="@Model.Carousels[i].ImageAlt" class="img-responsive"/>
<div class="carousel-caption" role="option"> <div class="carousel-caption" role="option">
<p> <p>@Html.Raw(Model.Carousels[i].CarouselContent)</p>
Learn how to build ASP.NET apps that can run anywhere.
<a class="btn btn-default" href="https://go.microsoft.com/fwlink/?LinkID=525028&clcid=0x409">
Learn More
</a>
</p>
</div>
</div>
<div class="item">
<img src="~/images/banner2.svg" alt="Visual Studio" class="img-responsive" />
<div class="carousel-caption" role="option">
<p>
There are powerful new features in Visual Studio for building modern web apps.
<a class="btn btn-default" href="https://go.microsoft.com/fwlink/?LinkID=525030&clcid=0x409">
Learn More
</a>
</p>
</div>
</div>
<div class="item">
<img src="~/images/banner3.svg" alt="Microsoft Azure" class="img-responsive" />
<div class="carousel-caption" role="option">
<p>
Learn how Microsoft's Azure cloud platform allows you to build, deploy, and scale web apps.
<a class="btn btn-default" href="https://go.microsoft.com/fwlink/?LinkID=525027&clcid=0x409">
Learn More
</a>
</p>
</div> </div>
</div> </div>
}
}
</div> </div>
<a class="left carousel-control" href="#myCarousel" role="button" data-slide="prev"> <a class="left carousel-control" href="#myCarousel" role="button" data-slide="prev">
<span class="glyphicon glyphicon-chevron-left" aria-hidden="true"></span> <span class="glyphicon glyphicon-chevron-left" aria-hidden="true"></span>
@ -64,31 +57,61 @@
<div class="col-md-3"> <div class="col-md-3">
<h2>How to</h2> <h2>How to</h2>
<ul> <ul>
<li><a href="https://go.microsoft.com/fwlink/?LinkID=398600">Add a Controller and View</a></li> <li>
<li><a href="https://go.microsoft.com/fwlink/?LinkId=699315">Manage User Secrets using Secret Manager.</a></li> <a href="https://go.microsoft.com/fwlink/?LinkID=398600">Add a Controller and View</a>
<li><a href="https://go.microsoft.com/fwlink/?LinkId=699316">Use logging to log a message.</a></li> </li>
<li><a href="https://go.microsoft.com/fwlink/?LinkId=699317">Add packages using NuGet.</a></li> <li>
<li><a href="https://go.microsoft.com/fwlink/?LinkId=699319">Target development, staging or production environment.</a></li> <a href="https://go.microsoft.com/fwlink/?LinkId=699315">Manage User Secrets using Secret Manager.</a>
</li>
<li>
<a href="https://go.microsoft.com/fwlink/?LinkId=699316">Use logging to log a message.</a>
</li>
<li>
<a href="https://go.microsoft.com/fwlink/?LinkId=699317">Add packages using NuGet.</a>
</li>
<li>
<a href="https://go.microsoft.com/fwlink/?LinkId=699319">Target development, staging or production environment.</a>
</li>
</ul> </ul>
</div> </div>
<div class="col-md-3"> <div class="col-md-3">
<h2>Overview</h2> <h2>Overview</h2>
<ul> <ul>
<li><a href="https://go.microsoft.com/fwlink/?LinkId=518008">Conceptual overview of what is ASP.NET Core</a></li> <li>
<li><a href="https://go.microsoft.com/fwlink/?LinkId=699320">Fundamentals of ASP.NET Core such as Startup and middleware.</a></li> <a href="https://go.microsoft.com/fwlink/?LinkId=518008">Conceptual overview of what is ASP.NET Core</a>
<li><a href="https://go.microsoft.com/fwlink/?LinkId=398602">Working with Data</a></li> </li>
<li><a href="https://go.microsoft.com/fwlink/?LinkId=398603">Security</a></li> <li>
<li><a href="https://go.microsoft.com/fwlink/?LinkID=699321">Client side development</a></li> <a href="https://go.microsoft.com/fwlink/?LinkId=699320">Fundamentals of ASP.NET Core such as Startup and middleware.</a>
<li><a href="https://go.microsoft.com/fwlink/?LinkID=699322">Develop on different platforms</a></li> </li>
<li><a href="https://go.microsoft.com/fwlink/?LinkID=699323">Read more on the documentation site</a></li> <li>
<a href="https://go.microsoft.com/fwlink/?LinkId=398602">Working with Data</a>
</li>
<li>
<a href="https://go.microsoft.com/fwlink/?LinkId=398603">Security</a>
</li>
<li>
<a href="https://go.microsoft.com/fwlink/?LinkID=699321">Client side development</a>
</li>
<li>
<a href="https://go.microsoft.com/fwlink/?LinkID=699322">Develop on different platforms</a>
</li>
<li>
<a href="https://go.microsoft.com/fwlink/?LinkID=699323">Read more on the documentation site</a>
</li>
</ul> </ul>
</div> </div>
<div class="col-md-3"> <div class="col-md-3">
<h2>Run &amp; Deploy</h2> <h2>Run &amp; Deploy</h2>
<ul> <ul>
<li><a href="https://go.microsoft.com/fwlink/?LinkID=517851">Run your app</a></li> <li>
<li><a href="https://go.microsoft.com/fwlink/?LinkID=517853">Run tools such as EF migrations and more</a></li> <a href="https://go.microsoft.com/fwlink/?LinkID=517851">Run your app</a>
<li><a href="https://go.microsoft.com/fwlink/?LinkID=398609">Publish to Microsoft Azure Web Apps</a></li> </li>
<li>
<a href="https://go.microsoft.com/fwlink/?LinkID=517853">Run tools such as EF migrations and more</a>
</li>
<li>
<a href="https://go.microsoft.com/fwlink/?LinkID=398609">Publish to Microsoft Azure Web Apps</a>
</li>
</ul> </ul>
</div> </div>
</div> </div>

View File

@ -17,7 +17,9 @@
<span class="icon-bar"></span> <span class="icon-bar"></span>
<span class="icon-bar"></span> <span class="icon-bar"></span>
</button> </button>
<span class="navbar-brand"><span class="glyphicon glyphicon-info-sign" aria-hidden="true"></span></span> <span class="navbar-brand">
<span class="glyphicon glyphicon-info-sign" aria-hidden="true"></span>
</span>
</div> </div>
<div class="collapse navbar-collapse"> <div class="collapse navbar-collapse">
<p class="navbar-text"> <p class="navbar-text">

View File

@ -3,7 +3,7 @@
<head> <head>
<meta charset="utf-8"/> <meta charset="utf-8"/>
<meta name="viewport" content="width=device-width, initial-scale=1.0"/> <meta name="viewport" content="width=device-width, initial-scale=1.0"/>
<title>@ViewData["Title"] - pwa_0x01_2._1</title> <title>@ViewData["Title"] - pwt_0x01</title>
<environment include="Development"> <environment include="Development">
<link rel="stylesheet" href="~/lib/bootstrap/dist/css/bootstrap.css"/> <link rel="stylesheet" href="~/lib/bootstrap/dist/css/bootstrap.css"/>
@ -30,9 +30,15 @@
</div> </div>
<div class="navbar-collapse collapse"> <div class="navbar-collapse collapse">
<ul class="nav navbar-nav"> <ul class="nav navbar-nav">
<li><a asp-area="" asp-controller="Home" asp-action="Index">Home</a></li> <li>
<li><a asp-area="" asp-controller="Home" asp-action="About">About</a></li> <a asp-area="" asp-controller="Home" asp-action="Index">Home</a>
<li><a asp-area="" asp-controller="Home" asp-action="Contact">Contact</a></li> </li>
<li>
<a asp-area="" asp-controller="Home" asp-action="About">About</a>
</li>
<li>
<a asp-area="" asp-controller="Home" asp-action="Contact">Contact</a>
</li>
</ul> </ul>
</div> </div>
</div> </div>
@ -44,7 +50,7 @@
@RenderBody() @RenderBody()
<hr/> <hr/>
<footer> <footer>
<p>&copy; 2020 - pwa_0x01_2._1</p> <p>&copy; 2020 - pwt_0x01</p>
</footer> </footer>
</div> </div>

View File

@ -1,3 +1,3 @@
@using pwa_0x01_2._1 @using pwt_0x01
@using pwa_0x01_2._1.Models @using pwt_0x01.Models
@addTagHelper *, Microsoft.AspNetCore.Mvc.TagHelpers @addTagHelper *, Microsoft.AspNetCore.Mvc.TagHelpers

View File

@ -2,6 +2,12 @@
<PropertyGroup> <PropertyGroup>
<TargetFramework>netcoreapp2.1</TargetFramework> <TargetFramework>netcoreapp2.1</TargetFramework>
<AssemblyName>pwt-0x01</AssemblyName>
<PackageId>pwt-0x01</PackageId>
<Authors>pwt-0x01</Authors>
<Company>pwt-0x01</Company>
<Product>pwt-0x01</Product>
<RootNamespace>pwt-0x01</RootNamespace>
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>

View File

@ -1,6 +1,6 @@
 
Microsoft Visual Studio Solution File, Format Version 12.00 Microsoft Visual Studio Solution File, Format Version 12.00
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "pwa-0x01-2.1", "pwa-0x01-2.1.csproj", "{1868D01F-5327-4413-B7D7-5C62C66788D0}" Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "pwt-0x01", "pwt-0x01.csproj", "{D3D29829-31FA-4586-AA46-97D9CDD69AF1}"
EndProject EndProject
Global Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution GlobalSection(SolutionConfigurationPlatforms) = preSolution
@ -8,9 +8,9 @@ Global
Release|Any CPU = Release|Any CPU Release|Any CPU = Release|Any CPU
EndGlobalSection EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution GlobalSection(ProjectConfigurationPlatforms) = postSolution
{1868D01F-5327-4413-B7D7-5C62C66788D0}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {D3D29829-31FA-4586-AA46-97D9CDD69AF1}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{1868D01F-5327-4413-B7D7-5C62C66788D0}.Debug|Any CPU.Build.0 = Debug|Any CPU {D3D29829-31FA-4586-AA46-97D9CDD69AF1}.Debug|Any CPU.Build.0 = Debug|Any CPU
{1868D01F-5327-4413-B7D7-5C62C66788D0}.Release|Any CPU.ActiveCfg = Release|Any CPU {D3D29829-31FA-4586-AA46-97D9CDD69AF1}.Release|Any CPU.ActiveCfg = Release|Any CPU
{1868D01F-5327-4413-B7D7-5C62C66788D0}.Release|Any CPU.Build.0 = Release|Any CPU {D3D29829-31FA-4586-AA46-97D9CDD69AF1}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection EndGlobalSection
EndGlobal EndGlobal

Binary file not shown.

After

Width:  |  Height:  |  Size: 31 KiB