Skip to content

Commit

Permalink
Bump to v3.2.0 (#22)
Browse files Browse the repository at this point in the history
Features and enhancements
* Complete revision of the Blog: Display, filter, integrate latest posts into start page
* Posts with future publishing date will display on reaching this date
* Class PersonProfileBlock now derives from Block (was BlockGroup before)
* Missing MailSettings now throws InvalidOperationException
* Marked blocks used as Model in DisplayTemplates as Nullable
* Added messages to tournament page after the tournament is expired
* TournamentRegistration will now redirect to TournamentPage permalink
* Minor Bootstrap 5 css class fixes
* Tournament registrations can be downloaded in Excel format (before: CSV)

Updated package references
* "MailKit" Version="3.2.0"
* "Microsoft.Data.SqlClient" Version="4.1.0"
* "Microsoft.EntityFrameworkCore.SqlServer" Version="6.0.5"
* "Microsoft.EntityFrameworkCore.Tools" Version="6.0.5">
* "Microsoft.Extensions.Logging.Abstractions" Version="6.0.1"
* "Microsoft.VisualStudio.Web.CodeGeneration.Design" Version="6.0.5"
* "NLog.Web.AspNetCore" Version="5.0.0"
* "Piranha" Version="10.1.0"
* "Piranha.AspNetCore" Version="10.1.0"
* "Piranha.AspNetCore.Identity" Version="10.1.0"
* "Piranha.AspNetCore.Identity.SQLServer" Version="10.1.0"
* "Piranha.AspNetCore.SimpleSecurity" Version="10.1.0"
* "Piranha.AttributeBuilder" Version="10.1.0"
* "Piranha.Data.EF.SQLServer" Version="10.1.0"
* "Piranha.ImageSharp" Version="10.1.0"
* "Piranha.Local.FileStorage" Version="10.1.0"
* "Piranha.Manager" Version="10.1.0"
* "Piranha.Manager.TinyMCE" Version="10.1.0"
* "Bootstrap" Version="5.1.3"
* "jQuery" Version="3.6.0-slim"
  • Loading branch information
axunonb committed May 28, 2022
1 parent 63cc971 commit 0eb5d55
Show file tree
Hide file tree
Showing 42 changed files with 764 additions and 348 deletions.
27 changes: 20 additions & 7 deletions ClubSite/Assets/scss/inc/_blocks.scss
Original file line number Diff line number Diff line change
Expand Up @@ -23,14 +23,27 @@
overflow: hidden;
}
}
}

// Medium devices (tablets, 768px and up)
@media (min-width: 768px) {
.block {
&.column-block {
.col-md:not(:last-child) {
margin-bottom: 0;
&.separator-block {
padding: 0 0 .5rem
}

&.new-posts-block {
padding: 0;
margin: 0;

article h3 {
font-size: 1.5rem !important;
}
}

// Medium devices (tablets, 768px and up)
@media (min-width: 768px) {
.block {
&.column-block {
.col-md:not(:last-child) {
margin-bottom: 0;
}
}
}
}
Expand Down
3 changes: 2 additions & 1 deletion ClubSite/Assets/scss/inc/_general.scss
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,9 @@
}

main { // needed for Post, Archive, Page
padding: 2rem 0;
padding: 1rem 0;
}

img {
max-width: 100%;
}
Expand Down
18 changes: 18 additions & 0 deletions ClubSite/Assets/scss/inc/_pagination.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
.page-link {
color: #f44336;
min-width: 2.5rem;
text-align: center;

&:hover {
color: darken(#f44336, 10%);
}
}

.page-item {
&.active {
.page-link {
background: #f44336;
border-color: #f44336;
}
}
}
1 change: 1 addition & 0 deletions ClubSite/Assets/scss/style.scss
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,4 @@
@import "inc/header";
@import "inc/blocks";
@import "inc/posts";
@import "inc/pagination";
37 changes: 19 additions & 18 deletions ClubSite/ClubSite.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -3,35 +3,36 @@
<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<Nullable>enable</Nullable>
<Version>3.1.0</Version>
<Version>3.2.0</Version>
<Authors>axuno gGmbH</Authors>
<Description>The source code for https://www.volleyballclub.de/</Description>
<Copyright>axuno gGmbH and Contributors</Copyright>
<PackageLicenseExpression>MIT</PackageLicenseExpression>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="MailKit" Version="3.1.1" />
<PackageReference Include="EPPlus" Version="6.0.4" />
<PackageReference Include="MailKit" Version="3.2.0" />
<PackageReference Include="Microsoft.Data.SqlClient" Version="4.1.0" />
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="6.0.2" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="6.0.2">
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="6.0.5" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="6.0.5">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="Microsoft.Extensions.Logging.Abstractions" Version="6.0.0" />
<PackageReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Design" Version="6.0.2" />
<PackageReference Include="NLog.Web.AspNetCore" Version="4.14.0" />
<PackageReference Include="Piranha" Version="10.0.2" />
<PackageReference Include="Piranha.AspNetCore" Version="10.0.2" />
<PackageReference Include="Piranha.AspNetCore.Identity" Version="10.0.2" />
<PackageReference Include="Piranha.AspNetCore.Identity.SQLServer" Version="10.0.2" />
<PackageReference Include="Piranha.AspNetCore.SimpleSecurity" Version="10.0.2" />
<PackageReference Include="Piranha.AttributeBuilder" Version="10.0.2" />
<PackageReference Include="Piranha.Data.EF.SQLServer" Version="10.0.2" />
<PackageReference Include="Piranha.ImageSharp" Version="10.0.2" />
<PackageReference Include="Piranha.Local.FileStorage" Version="10.0.2" />
<PackageReference Include="Piranha.Manager" Version="10.0.2" />
<PackageReference Include="Piranha.Manager.TinyMCE" Version="10.0.2" />
<PackageReference Include="Microsoft.Extensions.Logging.Abstractions" Version="6.0.1" />
<PackageReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Design" Version="6.0.5" />
<PackageReference Include="NLog.Web.AspNetCore" Version="5.0.0" />
<PackageReference Include="Piranha" Version="10.1.0" />
<PackageReference Include="Piranha.AspNetCore" Version="10.1.0" />
<PackageReference Include="Piranha.AspNetCore.Identity" Version="10.1.0" />
<PackageReference Include="Piranha.AspNetCore.Identity.SQLServer" Version="10.1.0" />
<PackageReference Include="Piranha.AspNetCore.SimpleSecurity" Version="10.1.0" />
<PackageReference Include="Piranha.AttributeBuilder" Version="10.1.0" />
<PackageReference Include="Piranha.Data.EF.SQLServer" Version="10.1.0" />
<PackageReference Include="Piranha.ImageSharp" Version="10.1.0" />
<PackageReference Include="Piranha.Local.FileStorage" Version="10.1.0" />
<PackageReference Include="Piranha.Manager" Version="10.1.0" />
<PackageReference Include="Piranha.Manager.TinyMCE" Version="10.1.0" />
</ItemGroup>

<ItemGroup>
Expand Down
12 changes: 7 additions & 5 deletions ClubSite/ConfigurationPoco/MailSettings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,19 +3,21 @@
// of the MIT license. See the LICENSE file for details.
// https://github.com/axuno/ClubSite

using System;

namespace ClubSite.ConfigurationPoco
{
public class MailSettings
{
public Sender Sender { get; set; } = new Sender();
public Message Message { get; set; } = new Message();
public Sender Sender { get; set; } = new ();
public Message Message { get; set; } = new ();
}

public class Sender
{
public string MessageOutput { get; set; } = string.Empty;
public Smtp Smtp { get; set; } = new Smtp();
public File File { get; set; } = new File();
public Smtp Smtp { get; set; } = new ();
public File File { get; set; } = new ();
}

public class Smtp
Expand All @@ -35,7 +37,7 @@ public class File
public class Message
{
public MailAddress DefaultFrom { get; set; } = new ();
public MailAddress[] ContactFormTo { get; set; } = { };
public MailAddress[] ContactFormTo { get; set; } = Array.Empty<MailAddress>();
public string? Organization { get; set; }
}

Expand Down
3 changes: 0 additions & 3 deletions ClubSite/Models/ContactPage.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,7 @@
// of the MIT license. See the LICENSE file for details.
// https://github.com/axuno/ClubSite

using System.Collections.Generic;
using Piranha.AttributeBuilder;
using Piranha.Extend;
using Piranha.Extend.Fields;
using Piranha.Models;

namespace ClubSite.Models
Expand Down
54 changes: 54 additions & 0 deletions ClubSite/Models/NewPostsBlock.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
// Copyright (C) axuno gGmbH and Contributors.
// This software may be modified and distributed under the terms
// of the MIT license. See the LICENSE file for details.
// https://github.com/axuno/ClubSite

using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Piranha;
using Piranha.Data;
using Piranha.Extend;
using Piranha.Extend.Fields;
using Piranha.Models;

namespace ClubSite.Models
{
[BlockType(Name = "Latest Posts", Category = "References", Icon = "fas fa-link")]
public class NewPostsBlock : Piranha.Extend.Block
{
private const int NumOfDays = 30;
private const int MaxPosts = 2;

[Field(Title = "Überschrift")]
public StringField Title { get; set; } = new() { Value = string.Empty };

[Field(Title = "Tage seit letztem Beitrag", Description = "In diesem Zeitraum werden Beiträge als \"aktuell\" behandelt.")]
public NumberField NumOfDaysSincePublication { get; set; } = new() { Value = NumOfDays };

[Field(Title = "Max. Anzahl der angezeigten Beiträge", Description = "Empfohlen: 2. Werte kleiner 1 unterdrücken die Ausgabe")]
public NumberField NumOfPostsToDisplay { get; set; } = new() { Value = MaxPosts };

public List<PostInfo> Posts { get; private set; } = new();

public PageInfo ArchivePage { get; set; } = new();
public async Task Init(IDb db, IApi api)
{
var blogId = db.Set<Page>().First(p => p.PageTypeId == nameof(StandardArchive)).Id;
// PageInfo will exclude all regions and blocks from the model, which we don't need here
ArchivePage = await api.Pages.GetByIdAsync<PageInfo>(blogId);

if(NumOfPostsToDisplay < 1) return;
var postArchive = await api.Archives.GetByIdAsync<PostInfo>(blogId);

// Returns only posts that have IsPublished true, while api.Posts.GetAllAsync gets ALL
var posts = postArchive.Posts.Take(NumOfPostsToDisplay.Value ?? 0).ToList();
if (posts.Any()
&& posts.First().Published >= DateTime.Now.Date.AddDays(-1 * NumOfDaysSincePublication.Value ?? 0))
{
Posts = posts;
}
}
}
}
23 changes: 12 additions & 11 deletions ClubSite/Models/PersonProfileBlock.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,23 +3,24 @@
// of the MIT license. See the LICENSE file for details.
// https://github.com/axuno/ClubSite

using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Piranha.Extend;
using Piranha.Extend.Blocks;
using Piranha.Extend.Fields;
using Piranha.Extend.Fields.Settings;
using Piranha.Models;

namespace ClubSite.Models
{
[BlockGroupType(Name = "Person Profile", Category = "Content", Icon = "fas fa-images",
Display = BlockDisplayMode.Horizontal)]
[BlockItemType(Type = typeof(ImageBlock))]
[BlockItemType(Type = typeof(HtmlBlock))]
public class PersonProfileBlock : BlockGroup
[BlockType(Name = "Person Profile", Category = "Content", Icon = "fas fa-user")]
public class PersonProfileBlock : Block
{
public StringField Title { get; set; } = new StringField();
[Field(Title = "Funktionsbezeichnung")]
[StringFieldSettings(MaxLength = 40)]
public StringField Title { get; set; } = new();

[Field(Title = "Name, Kontaktdaten", Options = FieldOption.HalfWidth)]
public HtmlField? Contact { get; set; }

[Field(Title = "Foto", Options = FieldOption.HalfWidth)]
public ImageField? Photo { get; set; }
}
}
77 changes: 77 additions & 0 deletions ClubSite/Models/TournamentDefinition.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
// Copyright (C) axuno gGmbH and Contributors.
// This software may be modified and distributed under the terms
// of the MIT license. See the LICENSE file for details.
// https://github.com/axuno/ClubSite

using System;
using Piranha.Extend;
using Piranha.Extend.Fields;

namespace ClubSite.Models;

public class TournamentDefinition
{
[Field(Title = "Primäres Bild", Placeholder = "Bild einsetzen")]
public ImageField TopImage { get; set; } = new();

[Field(Title = "Turniername", Placeholder = "z.B. 28. Neusäßer Mixedturnier")]
public StringField Name { get; set; } = new();

[Field(Title = "Datum von", Placeholder = "Datum")]
public DateField DateFrom { get; set; } = new();

[Field(Title = "Datum bis", Placeholder = "Datum")]
public DateField DateTo { get; set; } = new();

[Field(Title = "Uhrzeit von/bis", Placeholder = "Uhrzeit")]
public StringField TimeFromTo { get; set; } = new();

[Field(Title = "Beginn der Anmeldefrist", Placeholder = "Datum")]
public DateField RegistrationStart { get; set; } = new();

[Field(Title = "Anmeldeschluss", Placeholder = "Datum")]
public DateField RegistrationDeadline { get; set; } = new();

[Field(Title = "Anzahl Teams", Placeholder = "Anzahl")]
public NumberField NumberOfTeams { get; set; } = new();

[Field(Title = "Team-Zusammensetzung", Placeholder = "z.B. Anzahl Damen/Herren")]
public StringField TeamComposition { get; set; } = new();

[Field(Title = "Startgeld", Placeholder = "Startgeld")]
public StringField EntryFee { get; set; } = new();

[Field(Title = "Bankverbindung")]
public TextField BankDetails { get; set; } = new();

[Field(Title = "Adresse", Placeholder = "Hallenadresse")]
public StringField Address { get; set; } = new();

[Field(Title = "Infos", Placeholder = "Ablauf, Regeln, Infos")]
public HtmlField Infos { get; set; } = new();

public bool IsOver(DateTime dateToTest)
{
return DateFrom.Value == null
|| DateTo.Value == null
|| (DateFrom.Value.HasValue &&
DateTo.Value.HasValue &&
DateOnly.FromDateTime(DateTo.Value.Value) <=
DateOnly.FromDateTime(dateToTest));
}

public bool IsRegistrationAllowed(DateTime dateToTest)
{
return DateFrom.Value != null
&& DateTo.Value != null
&& RegistrationStart.Value.HasValue
&& RegistrationDeadline.Value.HasValue
&& dateToTest.Date >= RegistrationStart.Value.Value.Date
&& dateToTest.Date <= RegistrationDeadline.Value.Value.Date;
}

public bool IsRegistrationPeriodSet()
{
return RegistrationStart.Value.HasValue && RegistrationDeadline.Value.HasValue;
}
}
Loading

0 comments on commit 0eb5d55

Please sign in to comment.