Skip to content

Commit

Permalink
Merge pull request #26 from rbrands/users/rbrands/2020-06-09Finetuning
Browse files Browse the repository at this point in the history
Users/rbrands/2020 06 09 finetuning
  • Loading branch information
rbrands authored Jun 10, 2020
2 parents 375aebd + be0492b commit ed33c09
Show file tree
Hide file tree
Showing 4 changed files with 184 additions and 72 deletions.
142 changes: 138 additions & 4 deletions Pages/Index.cshtml
Original file line number Diff line number Diff line change
@@ -1,10 +1,144 @@
@page
@using System.Security.Claims
@using robert_brands_com.Models
@model IndexModel
@{
ViewData["Title"] = "Home page";
ViewData["Title"] = "Robert Brands";
}

<div class="text-center">
<h1 class="display-4">Welcome</h1>
<p>Learn about <a href="https://docs.microsoft.com/aspnet/core">building Web apps with ASP.NET Core</a>.</p>
<div class="container">
<div class="row">
<div class="col-md-12">
<div id="fotoCarousel" class="carousel slide" data-ride="carousel" data-interval="5000">
<ol class="carousel-indicators">
@for (int i = 0; i < Model.PhotoList.Count(); ++i)
{
<li data-target="#fotoCarousel" data-slide-to="@i" class="@(i == 0 ? "active" : "")"></li>
}
</ol>
<div class="carousel-inner">
@foreach (CommentedLinkItem photoLink in Model.PhotoList)
{
<div class="carousel-item @(Model.PhotoLinkOffset == 0 ? "active" : "")">
<a href="@photoLink.Link" target="_blank"><img class="img-fluid" src="@photoLink.ImageLink" alt="@photoLink.ShortTitle" /></a>
<div class="carousel-caption">
<a href="@photoLink.Link" class="h2 text-white" target="_blank">@photoLink.Title</a>
</div>
<span class="invisible">@(Model.PhotoLinkOffset++)</span>
</div>
}
<a class="carousel-control-prev" href="#fotoCarousel" role="button" data-slide="prev">
<span class="carousel-control-prev-icon"></span>
<span class="sr-only">Zurück</span>
</a>
<a class="carousel-control-next" href="#fotoCarousel" role="button" data-slide="next">
<span class="carousel-control-next-icon"></span>
<span class="sr-only">Vorwärts</span>
</a>
</div>
</div>
</div>
</div>
<div class="row">
<div class="col">
<div class="card border-0">
<div class="card-body">
<h1 class="h4 card-title">Kontakt</h1>
<p class="card-text">Robert Brands</p>
<p class="card-text">
<script>
document.write('<' + 'a' + ' ' + 'h' + 'r' + 'e' + 'f' + '=' + "'" + 'm' + 'a' + '&' + '#' + '1' + '0' + '5' + ';' + 'l' + 't' + '&' + '#' + '1' + '1' + '1' + ';' +
'&' + '#' + '5' + '8' + ';' + 'm' + 'a' + 'i' + '%' + '6' + 'C' + '&' + '#' + '6' + '4' + ';' + 'r' + 'o' + 'b' + '%' + '6' + '&' + '#' + '5' + '3' +
';' + '%' + '7' + '2' + 't' + '-' + 'b' + '%' + '7' + '&' + '#' + '5' + '0' + ';' + 'a' + '%' + '6' + 'E' + 'd' + 's' + '&' + '#' + '4' + '6' + ';' +
'c' + 'o' + '&' + '#' + '1' + '0' + '9' + ';' + "'" + '>' + 'm' + 'a' + '&' + '#' + '1' + '0' + '5' + ';' + 'l' + '&' + '#' + '6' + '4' + ';' + 'r' +
'o' + 'b' + '&' + '#' + '1' + '0' + '1' + ';' + 'r' + 't' + '&' + '#' + '4' + '5' + ';' + 'b' + 'r' + '&' + '#' + '9' + '7' + ';' + '&' + '#' + '1' +
'1' + '0' + ';' + 'd' + '&' + '#' + '1' + '1' + '5' + ';' + '&' + '#' + '4' + '6' + ';' + 'c' + 'o' + '&' + '#' + '1' + '0' + '9' + ';' + '<' + '/' +
'a' + '>');</script><noscript>[Turn on JavaScript to see the email address]</noscript>
</p>
</div>
</div>
</div>
<div class="col">
<div class="card border-0">
<div class="card-body">
<h4 class="card-title">Office</h4>
<p class="card-text">
<ul>
<li>
<a href="https://www.xing.com/profile/Robert_Brands" target="_blank" rel="me"><img src="https://www.xing.com/img/buttons/1_de_btn.gif" width="85" height="23" alt="Robert Brands"></a>
</li>
<li>
<a href="https://de.linkedin.com/pub/robert-brands/1/410/473">
<img src="https://static.licdn.com/scds/common/u/img/webpromo/btn_myprofile_160x33.png" width="160" height="33" border="0" alt="View Robert Brands's profile on LinkedIn">
</a>
</li>
<li><a href="~/blog/TechTalk">TechTalk</a></li>
</ul>
</p>
</div>
</div>
</div>
<div class="col">
<div class="card border-0">
<div class="card-body">
<h4 class="card-title">OOF - Out of office</h4>
<p class="card-text">
<ul>
<li><a href="https://www.facebook.com/brands.robert">Facebook</a></li>
<li><a href="https://www.flickr.com/photos/rbrands/">Flickr</a></li>
<li><a href="https://www.strava.com/athletes/robert_brands">Strava</a></li>
<li><a href="https://vimeo.com/robertbrands">Vimeo</a></li>
<li><a href="https://www.instagram.com/rbrands1961/">Instagram</a></li>
</ul>
</p>
</div>
</div>
</div>
<div class="col">
<div class="card border-0">
<div class="card-body">
@if (Model.Headline != null)
{
<h4 class="card-title">
@Model.Headline.Title
@if (User.IsInAnyRole(KnownRoles.Admin))
{
<a asp-page="/Blog/NewArticle" asp-page-handler="customized" asp-route-callingpage="/Index"
asp-route-listname="Homepage"
asp-route-logicalkey="homepage-headline"
asp-route-timetolive="0"
asp-route-featuredenabled="false"
asp-route-nickname="false"
asp-route-titlelink="false"
asp-route-link="false"
asp-route-tags="false"
asp-route-image="false"
class="btn btn-sm btn-outline-secondary">
<span class="fi-pencil" title="Ändern" aria-hidden="true"></span>
</a>
}
</h4>
<div class="card-text">
@Html.Raw(Model.Headline.ArticleContent)
</div>
}
else if (User.IsInAnyRole(KnownRoles.Admin))
{
<div class="card-text">
<a asp-page="/Blog/NewArticle" asp-page-handler="customized" asp-route-callingpage="/Index" asp-route-listname="Homepage" asp-route-logicalkey="homepage-headline" asp-route-featuredenabled="false" asp-route-timetolive="0" class="btn btn-sm btn-outline-secondary">
<span class="fi-pencil" title="Ändern" aria-hidden="true"></span>
</a>
</div>
}

</div>
</div>
</div>
</div>

</div>

@section Scripts {
<script async src="//embedr.flickr.com/assets/client-code.js" charset="utf-8"></script>
}

23 changes: 17 additions & 6 deletions Pages/Index.cshtml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,22 +6,33 @@
using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Mvc.RazorPages;
using Microsoft.Extensions.Logging;
using robert_brands_com.Models;
using robert_brands_com.Repositories;

namespace robert_brands_com.Pages
{
[AllowAnonymous]
public class IndexModel : PageModel
{
private readonly ILogger<IndexModel> _logger;
private const string listName = "Titel";
private ICosmosDBRepository<Article> repository;
const string NewsList = "Homepage";
private ICosmosDBRepository<CommentedLinkItem> photoRepository;

public IndexModel(ILogger<IndexModel> logger)
public Article Headline { get; set; }
public IEnumerable<CommentedLinkItem> PhotoList { get; private set; }
public int PhotoLinkOffset { get; set; }

public IndexModel(ICosmosDBRepository<CommentedLinkItem> repositoryService, ICosmosDBRepository<Article> blogRepository)
{
_logger = logger;
repository = blogRepository;
photoRepository = repositoryService;
}

public void OnGet()
public async Task OnGetAsync()
{

Headline = await this.repository.GetDocumentByKey("homepage-headline");
IEnumerable<CommentedLinkItem> documents = await photoRepository.GetDocuments(d => d.ListName == listName);
PhotoList = documents.OrderByDescending(d => d.Date);
}
}
}
12 changes: 5 additions & 7 deletions Pages/Shared/_Layout.cshtml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<html lang="de">
<head>
<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, shrink-to-fit=no">
<meta name="author" content="Robert Brands" />
@if (!String.IsNullOrEmpty(ViewBag.Keywords ?? String.Empty))
{
Expand Down Expand Up @@ -41,7 +41,7 @@
</head>
<body>
<header>
<nav class="navbar navbar-expand-sm navbar-toggleable-sm navbar-dark bg-dark border-bottom box-shadow mb-3">
<nav class="navbar navbar-expand-lg navbar-dark fixed-top bg-dark">
<div class="container">
<a class="navbar-brand" asp-area="" asp-page="/Index">robert-brands.com</a>
<button class="navbar-toggler" type="button" data-toggle="collapse" data-target=".navbar-collapse" aria-controls="navbarSupportedContent"
Expand All @@ -61,8 +61,8 @@
<a class="dropdown-item" href="/rad/routedesgrandesalpes">Route des Grandes Alpes</a>
<a class="dropdown-item" href="/Fotos/Korsika">Korsika</a>
<a class="dropdown-item" href="/Fotos/Vietnam">Vietnam</a>
<a class="dropdown-item" asp-page="/Fotos/Marokko">Marokko</a>
<a class="dropdown-item" asp-page="/Fotos/Nepal">Nepal</a>
<a class="dropdown-item" href="/Fotos/Marokko">Marokko</a>
<a class="dropdown-item" href="/Fotos/Nepal">Nepal</a>
@if (User.IsInAnyRole(KnownRoles.Admin, KnownRoles.User))
{
<div class="dropdown-divider"></div>
Expand Down Expand Up @@ -104,11 +104,9 @@
</div>
</nav>
</header>
<div class="container">
<main role="main" class="pb-3">
<main role="main">
@RenderBody()
</main>
</div>

<footer class="border-top footer text-muted">
<div class="container">
Expand Down
79 changes: 24 additions & 55 deletions wwwroot/css/site.css
Original file line number Diff line number Diff line change
@@ -1,71 +1,40 @@
/* Please see documentation at https://docs.microsoft.com/aspnet/core/client-side/bundling-and-minification
for details on configuring this project to bundle and minify static web assets. */

a.navbar-brand {
white-space: normal;
text-align: center;
word-break: break-all;
}

/* Provide sufficient contrast against white background */
a {
color: #0366d6;
body {
padding-top: 50px;
padding-bottom: 20px;
}

.btn-primary {
color: #fff;
background-color: #1b6ec2;
border-color: #1861ac;
/* Wrapping element */
/* Set some basic padding to keep content from hitting the edges */
.body-content {
padding-left: 15px;
padding-right: 15px;
}

.nav-pills .nav-link.active, .nav-pills .show > .nav-link {
color: #fff;
background-color: #1b6ec2;
border-color: #1861ac;
/* Carousel */
.carousel-caption p {
font-size: 20px;
line-height: 1.4;
}

/* Sticky footer styles
-------------------------------------------------- */
html {
font-size: 14px;
}
@media (min-width: 768px) {
html {
font-size: 16px;
}
/* Make .svg files in the carousel display properly in older browsers */
.carousel-inner .item img[src$=".svg"] {
width: 100%;
}

.border-top {
border-top: 1px solid #e5e5e5;
}
.border-bottom {
border-bottom: 1px solid #e5e5e5;
/* QR code generator */
#qrCode {
margin: 15px;
}

.box-shadow {
box-shadow: 0 .25rem .75rem rgba(0, 0, 0, .05);
/* Hide/rearrange for smaller screens */
@media screen and (max-width: 767px) {
/* Hide captions */
.carousel-caption {
display: none;
}
}

button.accept-policy {
font-size: 1rem;
line-height: inherit;
}

/* Sticky footer styles
-------------------------------------------------- */
html {
position: relative;
min-height: 100%;
}

body {
/* Margin bottom by footer height */
margin-bottom: 60px;
}
.footer {
position: absolute;
bottom: 0;
width: 100%;
white-space: nowrap;
line-height: 60px; /* Vertically center the text there */
}

0 comments on commit ed33c09

Please sign in to comment.