Tweak wanted list appearance

This commit is contained in:
Alex Cabal 2024-12-28 14:57:18 -06:00
parent c016547e2c
commit c43c4fa2dd
5 changed files with 91 additions and 43 deletions

View file

@ -2433,7 +2433,7 @@ final class Ebook{
where EbookPlaceholders.IsWanted = true and
EbookPlaceholders.IsInProgress = false and
EbookPlaceholders.Difficulty = ?
order by Ebooks.Updated desc
order by Ebooks.Created asc
', [$difficulty], Ebook::class);
}

View file

@ -7,4 +7,7 @@ $sequenceNumber = $collectionMembership?->SequenceNumber;
?>
<? if($sequenceNumber !== null){ ?>№ <?= number_format($sequenceNumber) ?> in the<? }else{ ?>Part of the<? } ?> <a href="<?= $collection->Url ?>" property="schema:isPartOf"><?= Formatter::EscapeHtml(preg_replace('/^The /ius', '', (string)$collection->Name)) ?></a>
<? if($collection->Type !== null){ ?>
<? if(substr_compare(mb_strtolower($collection->Name), mb_strtolower($collection->Type->value), -strlen(mb_strtolower($collection->Type->value))) !== 0){ ?><?= $collection->Type->value ?><? } ?><? }else{ ?>collection<? } ?>
<? if(substr_compare(mb_strtolower($collection->Name), mb_strtolower($collection->Type->value), -strlen(mb_strtolower($collection->Type->value))) !== 0){ ?><?= $collection->Type->value ?><? } ?>
<? }else{ ?>
collection
<? } ?>

34
templates/WantedEbook.php Normal file
View file

@ -0,0 +1,34 @@
<?
/**
* @var Ebook $ebook
*/
if(!isset($ebook->EbookPlaceholder)){
return;
}
$showPlaceholderMetadata = $showPlaceholderMetadata ?? false;
?>
<li>
<p>
<? if(isset($ebook->EbookPlaceholder->TranscriptionUrl)){ ?><a href="<?= $ebook->EbookPlaceholder->TranscriptionUrl ?>"><? } ?><i><?= Formatter::EscapeHtml($ebook->Title) ?></i><? if(isset($ebook->EbookPlaceholder->TranscriptionUrl)){ ?></a><? } ?>
by <?= Formatter::EscapeHtml($ebook->AuthorsString) ?>. <?= $ebook->ContributorsHtml ?>
<? foreach($ebook->CollectionMemberships as $index => $collectionMembership){ ?>
<? if($index == 0){ ?><?= Template::CollectionDescriptor(['collectionMembership' => $collectionMembership]) ?><? }else{ ?><?= lcfirst(Template::CollectionDescriptor(['collectionMembership' => $collectionMembership])) ?><? } ?><? if($index < sizeof($ebook->CollectionMemberships) - 1){ ?>, <? } ?><? if($index == sizeof($ebook->CollectionMemberships) - 1){ ?>.<? } ?>
<? } ?>
<? if(isset($ebook->EbookPlaceholder->Notes)){ ?>
<?= Formatter::MarkdownToHtml($ebook->EbookPlaceholder->Notes, true) ?>
<? } ?>
<? if($showPlaceholderMetadata){ ?>
<a href="<?= $ebook->Url ?>">View placeholder.</a>
<? } ?>
<? if($ebook->EbookPlaceholder->IsPatron){ ?>
<a class="patron-selection" href="/donate#patrons-circle">Patron selection!</a>
<? } ?>
</p>
</li>

View file

@ -1,38 +1,7 @@
<?
use function Safe\ob_end_clean;
use function Safe\ob_start;
function WantedEbooks(Enums\EbookPlaceholderDifficulty $difficulty, ?bool $showPlaceholderMetadata): string{
$ebooks = Ebook::GetByIsWantedAndDifficulty($difficulty);
$showPlaceholderMetadata = $showPlaceholderMetadata ?? false;
ob_start();
?>
<ul>
<? foreach($ebooks as $ebook){ ?>
<li>
<? if(isset($ebook->EbookPlaceholder->TranscriptionUrl)){ ?><a href="<?= $ebook->EbookPlaceholder->TranscriptionUrl ?>"><? } ?>
<?= Formatter::EscapeHtml($ebook->Title) ?><? if(isset($ebook->EbookPlaceholder->TranscriptionUrl)){ ?></a><? } ?>
<? if(sizeof($ebook->CollectionMemberships) > 0){ ?>
(<? foreach($ebook->CollectionMemberships as $index => $collectionMembership){ ?><?= Template::CollectionDescriptor(['collectionMembership' => $collectionMembership]) ?><? if($index < sizeof($ebook->CollectionMemberships) - 1){ ?>, <? } ?><? } ?>)
<? } ?>
by <?= Formatter::EscapeHtml($ebook->AuthorsString) ?><? if($ebook->ContributorsHtml != ''){ ?>. <? } ?>
<?= $ebook->ContributorsHtml ?>
<? if(isset($ebook->EbookPlaceholder->Notes)){ ?>(<?= Formatter::MarkdownToHtml($ebook->EbookPlaceholder->Notes, true) ?>)<? } ?>
<? if($showPlaceholderMetadata){ ?>
<p>Ebook ID: <?= $ebook->EbookId ?>, <a href="<?= $ebook->Url ?>">View placeholder</a></p>
<? } ?>
</li>
<? } ?>
</ul>
<?
$contents = ob_get_contents() ?: '';
ob_end_clean();
return $contents;
}
$beginnerEbooks = Ebook::GetByIsWantedAndDifficulty(Enums\EbookPlaceholderDifficulty::Beginner);
$intermediateEbooks = Ebook::GetByIsWantedAndDifficulty(Enums\EbookPlaceholderDifficulty::Intermediate);
$advancedEbooks = Ebook::GetByIsWantedAndDifficulty(Enums\EbookPlaceholderDifficulty::Advanced);
?>
<?= Template::Header(['title' => 'Wanted Ebooks', 'highlight' => 'contribute', 'description' => 'A list of ebooks the Standard Ebooks editor would like to see produced, including suggestions for first-time producers.']) ?>
<main>
@ -47,14 +16,29 @@ function WantedEbooks(Enums\EbookPlaceholderDifficulty $difficulty, ?bool $showP
<h2>For your first production</h2>
<p>If nothing on the list below interests you, you can pitch us something else youd like to work on.</p>
<p>First productions should be on the shorter side (less than 100,000 words maximum) and without too many complex formatting issues like illustrations, significant endnotes, letters, poems, etc. Most short plain fiction novels fall in this category.</p>
<?= WantedEbooks(Enums\EbookPlaceholderDifficulty::Beginner, Session::$User?->Benefits->CanEditEbookPlaceholders) ?>
<ul class="wanted-list">
<? foreach($beginnerEbooks as $ebook){ ?>
<?= Template::WantedEbook(['ebook' => $ebook, 'showPlaceholderMetadata' => Session::$User?->Benefits->CanEditEbookPlaceholders]) ?>
<? } ?>
</ul>
<h2>Moderate-difficulty productions</h2>
<?= WantedEbooks(Enums\EbookPlaceholderDifficulty::Intermediate, Session::$User?->Benefits->CanEditEbookPlaceholders) ?>
<ul class="wanted-list">
<? foreach($intermediateEbooks as $ebook){ ?>
<?= Template::WantedEbook(['ebook' => $ebook, 'showPlaceholderMetadata' => Session::$User?->Benefits->CanEditEbookPlaceholders]) ?>
<? } ?>
</ul>
<h2>Advanced productions</h2>
<?= WantedEbooks(Enums\EbookPlaceholderDifficulty::Advanced, Session::$User?->Benefits->CanEditEbookPlaceholders) ?>
<ul class="wanted-list">
<? foreach($advancedEbooks as $ebook){ ?>
<?= Template::WantedEbook(['ebook' => $ebook, 'showPlaceholderMetadata' => Session::$User?->Benefits->CanEditEbookPlaceholders]) ?>
<? } ?>
</ul>
<h2 id="verne">Jules Verne</h2>
<p>Verne has a complex publication and translation history. Please review these notes before starting any Verne books.</p>
<ul>
<ul class="wanted-list">
<li>
<p>As of 2024, <i>20,000 Leagues Under the Seas</i> does not have an acceptable public domain translation, therefore we will not host that ebook.</p>
</li>
@ -62,6 +46,7 @@ function WantedEbooks(Enums\EbookPlaceholderDifficulty $difficulty, ?bool $showP
<p>Master of the World has two PD translations, one from 1911 and one from 1914. The 1911 version is bad, and the 1914 by Cranstoun Metcalfe version is preferred; but, as of 2023, there are no transcriptions or page scans for the 1914 version.</p>
</li>
</ul>
<h2>Uncategorized lists</h2>
<ul>
<li>
@ -97,9 +82,6 @@ function WantedEbooks(Enums\EbookPlaceholderDifficulty $difficulty, ?bool $showP
<li>
<p>Entries in the <a href="https://en.wikipedia.org/wiki/Harvard_Classics#The_Harvard_Classics_Shelf_of_Fiction">Harvard Classics Shelf of Fiction</a></p>
</li>
<li>
<p><a href="https://www.gutenberg.org/ebooks/3337">The Wilderness Hunter</a> by Theodore Roosevelt (a 2 volume work in which this PG transcription is volume 2; editions vary widely; transcription likely required for volume 1 or the latest possible combined edition)</p>
</li>
</ul>
</article>
</main>

View file

@ -3359,6 +3359,35 @@ nav.breadcrumbs + h1{
font-weight: normal;
}
.patron-selection{
background-color: #e8c50b;
border: 1px solid #c8b341;
border-radius: 5px;
box-shadow: 1px 1px 0px rgba(255, 255, 255, 0.5) inset;
}
a.patron-selection:any-link{
color: #fff;
font-style: italic;
font-weight: bold;
padding: 0 .5rem;
text-decoration: none;
text-shadow: 1px 1px 0 rgba(0, 0, 0, .5);
transition: background 200ms ease;
margin-left: .5rem;
white-space: nowrap;
display: inline-block;
}
a.patron-selection:any-link:hover{
background: #eed967;
transition: none;
}
.wanted-list{
text-align: left;
}
@media (hover: none) and (pointer: coarse){ /* target ipads and smartphones without a mouse */
/* For iPad, unset the height so it matches the other elements */
select[multiple]{