-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
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
Showing
42 changed files
with
764 additions
and
348 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,3 +8,4 @@ | |
@import "inc/header"; | ||
@import "inc/blocks"; | ||
@import "inc/posts"; | ||
@import "inc/pagination"; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; | ||
} | ||
} |
Oops, something went wrong.