Skip to content

Commit

Permalink
Merge pull request #143 from mongodb-developer/feature/email-toggle
Browse files Browse the repository at this point in the history
Change email hint (required or not) on event register
  • Loading branch information
snarvaez authored May 8, 2024
2 parents 32831df + 2dc6430 commit a3ca2fb
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion website/Pages/EventRegister.razor
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@
</span>
</div>
<input id="email" @bind="_player.Email" name="" class="form-control"
placeholder="E-Mail for prizes (optional)" type="email"
placeholder="@hintEmail"
pattern="/^[a-zA-Z0-9._%+-]+@@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$/">
<!-- @@ escapes 'at' symbol in razor -->
</div> <!-- form-group// -->
Expand Down Expand Up @@ -152,6 +152,10 @@
private string _errorMessage = string.Empty;
private readonly RestClient _restClient = RestServiceClient.Create();

private const string hintEmailRequired = "E-Mail for prizes";
private const string hintEmailNotRequired = "E-Mail for prizes (optional)";
private string hintEmail = hintEmailNotRequired;

protected override async Task OnAfterRenderAsync(bool firstRender)
{
if (firstRender)
Expand Down Expand Up @@ -186,6 +190,9 @@
var events = await _restClient.GetJsonAsync<List<Event>>(eventsUrlWithQuery);

_event = events.FirstOrDefault();

if (_event != null && _event.EmailRequired)
hintEmail = hintEmailRequired;
}

private async Task CreatePlayer()
Expand Down

0 comments on commit a3ca2fb

Please sign in to comment.