Skip to content

Commit

Permalink
Users/rbrands/2021 11 11 (#99)
Browse files Browse the repository at this point in the history
* Routes synced with app

* Using the name for comment

* Comments for routes
  • Loading branch information
rbrands authored Nov 14, 2021
1 parent 1db3e2f commit e38178e
Show file tree
Hide file tree
Showing 9 changed files with 60 additions and 10 deletions.
2 changes: 1 addition & 1 deletion MeetUpFunctions/Constants.cs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ public static class Constants
public const string DEFAULT_DISCLAIMER = "Disclaimer";
public const string DEFAULT_GUEST_DISCLAIMER = "Guest Disclaimer";

public const string VERSION = "2021-11-08";
public const string VERSION = "2021-11-14";
public const int ADMINOVERBOOKFACTOR = 2;

public const int LOG_TTL = 30 * 24 * 3600; // 30 days TTL for Log items
Expand Down
16 changes: 16 additions & 0 deletions MeetUpPlanner/Client/AppState.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using System.Text;
using MeetUpPlanner.Shared;
using System.ComponentModel.DataAnnotations;

Expand Down Expand Up @@ -39,6 +40,21 @@ public ClientSettings ClientSettings
[MaxLength(80, ErrorMessage = "Der Nachname ist zu lang."), MinLength(3, ErrorMessage = "Der Nachname ist zu kurz.")]
[Required(ErrorMessage = "Der Nachname fehlt.")]
public string LastName { get; set; }
public string DisplayName
{
get
{
int nameDisplayLength = _clientSettings != null ? _clientSettings.NameDisplayLength : 0;
int length = nameDisplayLength > 0 ? Math.Min(nameDisplayLength, LastName.Length) : LastName.Length;
StringBuilder sb = new StringBuilder(FirstName).Append(' ');
sb.Append(LastName.Substring(0, length));
if (length < LastName.Length)
{
sb.Append('.');
}
return sb.ToString();
}
}
[MaxLength(120, ErrorMessage = "Die Tel-Nr/Mail-Adresse ist zu lang"), MinLength(8, ErrorMessage = "Die Tel-Nr/Mail-Adresse ist zu kurz.")]
[Required(ErrorMessage = "Tel-Nr/Mail-Adresse fehlen.")]
public string PhoneMail { get; set; }
Expand Down
2 changes: 1 addition & 1 deletion MeetUpPlanner/Client/Pages/About.razor
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@
</div>

@code {
private const string clientVersion = "2021-11-08";
private const string clientVersion = "2021-11-14";
private string serverVersion = "tbd";
private string functionsVersion = "tbd";

Expand Down
4 changes: 2 additions & 2 deletions MeetUpPlanner/Client/Pages/NewMeetUp.razor
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
@inject NavigationManager NavigationManager
@inject NotificationService notificationService
@using Newtonsoft.Json
@using System.Text
@using Microsoft.AspNetCore.SignalR.Client
@using MeetUpPlanner.Shared
@using Blazored.TextEditor
Expand Down Expand Up @@ -648,8 +649,7 @@
_routeComment = new MeetUpPlanner.Shared.Comment();
_routeComment.ReferenceId = route.Core.Id;
_routeComment.CommentText = "Im MeetUpPlanner für eine Ausfahrt ausgewählt!";
_routeComment.AuthorDisplayName = $"{AppStateStore.FirstName}";

_routeComment.AuthorDisplayName = AppStateStore.DisplayName;
}

}
6 changes: 6 additions & 0 deletions MeetUpPlanner/Client/Pages/Routes.razor
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ else
<p>
<button class="btn btn-primary" title="Suche anzeigen" @onclick="@(() => ToggleSearchCollapse())"><span class="oi oi-magnifying-glass"></span></button>
<button class="btn btn-primary" title="Reload" @onclick="@(() => Reload())"><span class="oi oi-reload"></span></button>
<a class="btn btn-primary" title="Hilfe" href="https://docs.meetuproutes.de" target="_blank"><span class="oi oi-question-mark"></span></a>
</p>
<div class="row @_searchCollapse">
<ComposeFilter Filter="@_filter" TagSets="@_tagSets" OnChangeCallback="Reload"></ComposeFilter>
Expand Down Expand Up @@ -67,7 +68,12 @@ else
{
try
{
_statusMessage.Hide();
_routes = await RoutesApi.GetRoutes(_filter);
if (_routes.Count() == 0)
{
_statusMessage.ShowWarning("Keine Route mit den Suchkriterien gefunden. Bitte ändere deinen Suchfilter.");
}
}
catch (Exception ex)
{
Expand Down
13 changes: 11 additions & 2 deletions MeetUpPlanner/Client/Shared/EditComment.razor
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
}
else
{
<EditForm Model="@Comment.Core">
<EditForm Model="@Comment.Core" OnValidSubmit="SaveComment">
<DataAnnotationsValidator />
<ValidationSummary />
<div class="form-group">
Expand Down Expand Up @@ -60,6 +60,15 @@ else
await OnCancel.InvokeAsync();
}


private async Task SaveComment()
{
if (!String.IsNullOrEmpty(Comment.Core.CommentText) || !String.IsNullOrEmpty(Comment.Core.Link))
{
Comment.Core.AuthorDisplayName = AppStateStore.DisplayName;
await Api.WriteComment(Comment.Core);
}
_editMode = false;
await OnSave.InvokeAsync();
}

}
24 changes: 21 additions & 3 deletions MeetUpPlanner/Client/Shared/RouteCard.razor
Original file line number Diff line number Diff line change
Expand Up @@ -79,15 +79,21 @@
{
<div class="btn-group mr-2" role="group" aria-label="Ausfahrt anlegen">
<a class="btn btn-sm btn-outline-secondary" @onclick="@(() => SelectForMeetUp())" hidden="@(!KeywordCheck.IsUser || AppStateStore.ClientSettings.OnlyAdminsAsHost && !KeywordCheck.IsAdmin)">Ausfahrt anlegen</a>
<button class="btn btn-sm btn-outline-secondary" title="Kommentieren" @onclick="@(() => ToggleCommentInput())"><span class="oi oi-comment-square"></span></button>
<button class="btn btn-sm btn-outline-secondary" title="Ich bin die Route gefahren" @onclick="@(() => AddRidingComment())"><span class="oi oi-thumb-up"></span>Bin die Route gefahren.</button>
</div>
}
}
<div class="btn-group mr-2" role="group" aria-label="Routen-Infos">
<a href="@RouteItem.Core.GpxLink" target="_blank" title="GPX-Link" class="btn btn-sm btn-outline-secondary" hidden="@String.IsNullOrEmpty(RouteItem.Core.GpxLink)">GPX</a>
<a href="@RouteItem.Core.StravaLink" target="_blank" title="Strava" class="btn btn-sm btn-outline-secondary" hidden="@String.IsNullOrEmpty(RouteItem.Core.StravaLink)">Strava</a>
<a href="@RouteItem.Core.PhotosLink" target="_blank" title="Fotos" class="btn btn-sm btn-outline-secondary" hidden="@String.IsNullOrEmpty(RouteItem.Core.PhotosLink)"><span class="oi oi-camera-slr"></span></a>
<a href="@RouteItem.Core.VideoLink" target="_blank" title="Video" class="btn btn-sm btn-outline-secondary" hidden="@String.IsNullOrEmpty(RouteItem.Core.VideoLink)"><span class="oi oi-video"></span></a>
</div>
</div>
@if (_enableCommentInput)
{
<EditComment ReferenceId="@RouteItem.Core.Id" OnCancel="ToggleCommentInput" OnSave="OnSaveComment"></EditComment>
}
</div>
</div>

Expand All @@ -96,6 +102,7 @@
public ExtendedRoute RouteItem { get; set; } = new ExtendedRoute();
[Parameter]
public EventCallback OnReload { get; set; }
private Boolean _enableCommentInput = false;

private string[] BadgeClasses =
{
Expand All @@ -119,8 +126,8 @@
{
Comment comment = new Comment();
comment.ReferenceId = RouteItem.Core.Id;
comment.CommentText = "Die Route wurde im MeetUpPlanner verwendet!";
comment.AuthorDisplayName = $"{AppStateStore.FirstName}";
comment.CommentText = "Danke, ich bin die Route gefahren!";
comment.AuthorDisplayName = AppStateStore.DisplayName;
await RouteApi.WriteComment(comment);
await OnReload.InvokeAsync();
}
Expand All @@ -133,4 +140,15 @@
{
await OnReload.InvokeAsync();
}
private void ToggleCommentInput()
{
_enableCommentInput = !_enableCommentInput;
}
private async Task OnSaveComment()
{
_enableCommentInput = !_enableCommentInput;
await OnReload.InvokeAsync();
}


}
2 changes: 1 addition & 1 deletion MeetUpPlanner/Server/Controllers/UtilController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ public class UtilController : ControllerBase
{
private readonly MeetUpFunctions _meetUpFunctions;
private readonly ILogger<UtilController> logger;
const string serverVersion = "2021-11-08";
const string serverVersion = "2021-11-14";
string functionsVersion = "tbd";

public UtilController(ILogger<UtilController> logger, MeetUpFunctions meetUpFunctions)
Expand Down
1 change: 1 addition & 0 deletions MeetUpPlanner/Shared/ExtendedInfoItem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ public ExtendedInfoItem(InfoItem infoItem)
this.OrderId = infoItem.OrderId;
this.Tenant = infoItem.Tenant;
this.Title = infoItem.Title;
this.SubTitle = infoItem.SubTitle;
}
}
}

0 comments on commit e38178e

Please sign in to comment.