mirror of
https://github.com/standardebooks/web.git
synced 2025-07-22 15:24:46 -04:00
Allow creating new ebook placeholders when creating a new project
This commit is contained in:
parent
4596aeb007
commit
98e09f414e
14 changed files with 114 additions and 44 deletions
|
@ -56,6 +56,9 @@ catch(Exceptions\InvalidPermissionsException){
|
|||
<form class="create-update-ebook-placeholder" method="<?= Enums\HttpMethod::Post->value ?>" action="<?= $ebook->Url ?>" autocomplete="off">
|
||||
<input type="hidden" name="_method" value="<?= Enums\HttpMethod::Put->value ?>" />
|
||||
<?= Template::EbookPlaceholderForm(['ebook' => $ebook, 'isEditForm' => true]) ?>
|
||||
<div class="footer">
|
||||
<button>Save</button>
|
||||
</div>
|
||||
</form>
|
||||
</section>
|
||||
</main>
|
||||
|
|
|
@ -82,6 +82,9 @@ catch(Exceptions\InvalidPermissionsException){
|
|||
|
||||
<form class="create-update-ebook-placeholder" method="<?= Enums\HttpMethod::Post->value ?>" action="/ebook-placeholders" autocomplete="off">
|
||||
<?= Template::EbookPlaceholderForm(['ebook' => $ebook]) ?>
|
||||
<div class="footer">
|
||||
<button>Submit</button>
|
||||
</div>
|
||||
</form>
|
||||
</section>
|
||||
</main>
|
||||
|
|
|
@ -42,9 +42,9 @@ try{
|
|||
$_SESSION['is-only-ebook-project-created'] = true;
|
||||
}
|
||||
else{
|
||||
// No `Project`, throw the exception and really fail.
|
||||
// The existing ebook already has a `Project`, throw the exception and really fail.
|
||||
$ebook = $existingEbook;
|
||||
throw $ex;
|
||||
throw new Exceptions\ProjectExistsException('This ebook already exists, and already has an in-progress project.');
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -85,7 +85,7 @@ catch(Exceptions\LoginRequiredException){
|
|||
catch(Exceptions\InvalidPermissionsException | Exceptions\InvalidHttpMethodException | Exceptions\HttpMethodNotAllowedException){
|
||||
Template::ExitWithCode(Enums\HttpCode::Forbidden);
|
||||
}
|
||||
catch(Exceptions\InvalidEbookException | Exceptions\InvalidProjectException $ex){
|
||||
catch(Exceptions\InvalidEbookException | Exceptions\ProjectExistsException | Exceptions\InvalidProjectException $ex){
|
||||
$_SESSION['ebook'] = $ebook;
|
||||
$_SESSION['exception'] = $ex;
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue