Skip to content

Commit

Permalink
Merge pull request #8 from liamgold/feature/question-submit-confirmation
Browse files Browse the repository at this point in the history
Add confirmation message to question submit form
  • Loading branch information
seangwright authored Aug 30, 2024
2 parents fd8d86b + dfa0f6a commit e96d5e9
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -52,20 +52,23 @@ public async Task<IActionResult> CreateQuestion(QAndAQuestionFormSubmissionViewM
var questionsParent = await mediator.Send(new QAndAQuestionsRootPageQuery(channelContext.WebsiteChannelName));
var questionMonthFolder = await mediator.Send(new QAndAMonthFolderQuery(questionsParent, channelContext.WebsiteChannelName, now.Year, now.Month, channelContext.WebsiteChannelID));

return await mediator.Send(new QAndAQuestionCreateCommand(
var result = await mediator.Send(new QAndAQuestionCreateCommand(
member,
questionMonthFolder,
channelContext.WebsiteChannelID,
requestModel.Title,
requestModel.Content,
SystemTaxonomies.QAndADiscussionTypeTaxonomy.QuestionTag.GUID,
Maybe<BlogPostPage>.None))
.Match(_ =>
{
Response.Htmx(h => h.Redirect("/q-and-a"));
Maybe<BlogPostPage>.None));

return Ok();
}, LogAndReturnError("CREATE_QUESTION"));
if (result.IsSuccess)
{
return PartialView("~/Features/QAndA/Components/Form/QAndAQuestionFormConfirmation.cshtml");
}
else
{
return LogAndReturnError("CREATE_QUESTION")(result.Error);
}
}

[HttpPost]
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<div class="alert alert-success" role="alert">
Your question has been successfully submitted!<br><br>
It may take a few moments for the <a href="/q-and-a">Q&A listing</a> to update, don't worry if you don't see it
right away.
</div>

0 comments on commit e96d5e9

Please sign in to comment.