Skip to content

Commit

Permalink
Show slides note in talk page
Browse files Browse the repository at this point in the history
  • Loading branch information
spaze committed Nov 21, 2023
1 parent 04f2724 commit 3606caa
Show file tree
Hide file tree
Showing 7 changed files with 40 additions and 2 deletions.
6 changes: 6 additions & 0 deletions site/app/Form/TalkFormFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,9 @@ public function create(callable $onSuccess, ?Talk $talk = null): UiForm
$form->addText('slidesEmbed', 'Embed odkaz na slajdy:')
->setRequired(false)
->addRule($form::MaxLength, 'Maximální délka embed odkazu na slajdy je %d znaků', 200);
$form->addTextArea('slidesNote', 'Poznámka ke slajdům:')
->setRequired(false)
->addRule($form::MaxLength, 'Maximální délka poznámek je %d znaků', 65535);
$form->addText('videoHref', 'Odkaz na video:')
->setRequired(false)
->addRule($form::MaxLength, 'Maximální délka odkazu na video je %d znaků', 200);
Expand Down Expand Up @@ -124,6 +127,7 @@ public function create(callable $onSuccess, ?Talk $talk = null): UiForm
$values->filenamesTalk,
$values->slidesHref,
$values->slidesEmbed,
$values->slidesNote,
$values->videoHref,
$videoThumbnailBasename ?? ($removeVideoThumbnail ? null : $thumbnailFilename),
$videoThumbnailBasenameAlternative ?? ($removeVideoThumbnailAlternative ? null : $thumbnailAlternativeFilename),
Expand Down Expand Up @@ -158,6 +162,7 @@ public function create(callable $onSuccess, ?Talk $talk = null): UiForm
$values->filenamesTalk,
$values->slidesHref,
$values->slidesEmbed,
$values->slidesNote,
$values->videoHref,
$videoThumbnailBasename,
$videoThumbnailBasenameAlternative,
Expand Down Expand Up @@ -198,6 +203,7 @@ public function setTalk(UiForm $form, Talk $talk, SubmitButton $submit): void
'filenamesTalk' => $talk->getFilenamesTalkId(),
'slidesHref' => $talk->getSlidesHref(),
'slidesEmbed' => $talk->getSlidesEmbed(),
'slidesNote' => $talk->getSlidesNoteTexy(),
'videoHref' => $talk->getVideo()->getVideoHref(),
'videoEmbed' => $talk->getVideoEmbed(),
'event' => $talk->getEventTexy(),
Expand Down
14 changes: 14 additions & 0 deletions site/app/Talks/Talk.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@ public function __construct(
private readonly bool $hasSlides,
private readonly ?string $slidesHref,
private readonly ?string $slidesEmbed,
private readonly ?Html $slidesNote,
private readonly ?string $slidesNoteTexy,
private readonly Video $video,
private readonly ?string $videoEmbed,
private readonly Html $event,
Expand Down Expand Up @@ -142,6 +144,18 @@ public function getSlidesEmbed(): ?string
}


public function getSlidesNote(): ?Html
{
return $this->slidesNote;
}


public function getSlidesNoteTexy(): ?string
{
return $this->slidesNoteTexy;
}


public function getVideo(): Video
{
return $this->video;
Expand Down
2 changes: 2 additions & 0 deletions site/app/Talks/TalkFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,8 @@ public function createFromDatabaseRow(Row $row): Talk
(bool)$row->hasSlides,
$row->slidesHref,
$row->slidesEmbed,
$row->slidesNote ? $this->texyFormatter->formatBlock($row->slidesNote) : null,
$row->slidesNote,
$this->videoFactory->createFromDatabaseRow($row),
$row->videoEmbed,
$this->texyFormatter->format($row->event),
Expand Down
12 changes: 11 additions & 1 deletion site/app/Talks/Talks.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ public function getAll(?int $limit = null): array
t.slides_href IS NOT NULL OR EXISTS (SELECT * FROM talk_slides s WHERE s.key_talk = COALESCE(t.key_talk_slides, t.id_talk)) AS hasSlides,
t.slides_href AS slidesHref,
t.slides_embed AS slidesEmbed,
t.slides_note AS slidesNote,
t.video_href AS videoHref,
t.video_thumbnail AS videoThumbnail,
t.video_thumbnail_alternative AS videoThumbnailAlternative,
Expand Down Expand Up @@ -103,6 +104,7 @@ public function getUpcoming(): array
t.slides_href IS NOT NULL OR EXISTS (SELECT * FROM talk_slides s WHERE s.key_talk = COALESCE(t.key_talk_slides, t.id_talk)) AS hasSlides,
t.slides_href AS slidesHref,
t.slides_embed AS slidesEmbed,
t.slides_note AS slidesNote,
t.video_href AS videoHref,
t.video_thumbnail AS videoThumbnail,
t.video_thumbnail_alternative AS videoThumbnailAlternative,
Expand Down Expand Up @@ -153,6 +155,7 @@ public function get(string $name): Talk
t.slides_href IS NOT NULL OR EXISTS (SELECT * FROM talk_slides s WHERE s.key_talk = COALESCE(t.key_talk_slides, t.id_talk)) AS hasSlides,
t.slides_href AS slidesHref,
t.slides_embed AS slidesEmbed,
t.slides_note AS slidesNote,
t.video_href AS videoHref,
t.video_thumbnail AS videoThumbnail,
t.video_thumbnail_alternative AS videoThumbnailAlternative,
Expand Down Expand Up @@ -203,6 +206,7 @@ public function getById(int $id): Talk
t.slides_href IS NOT NULL OR EXISTS (SELECT * FROM talk_slides s WHERE s.key_talk = COALESCE(t.key_talk_slides, t.id_talk)) AS hasSlides,
t.slides_href AS slidesHref,
t.slides_embed AS slidesEmbed,
t.slides_note AS slidesNote,
t.video_href AS videoHref,
t.video_thumbnail AS videoThumbnail,
t.video_thumbnail_alternative AS videoThumbnailAlternative,
Expand Down Expand Up @@ -275,6 +279,7 @@ public function update(
?int $filenamesTalk,
?string $slidesHref,
?string $slidesEmbed,
?string $slidesNote,
?string $videoHref,
?string $videoThumbnail,
?string $videoThumbnailAlternative,
Expand All @@ -300,6 +305,7 @@ public function update(
$filenamesTalk,
$slidesHref,
$slidesEmbed,
$slidesNote,
$videoHref,
$videoThumbnail,
$videoThumbnailAlternative,
Expand Down Expand Up @@ -334,6 +340,7 @@ public function add(
?int $filenamesTalk,
?string $slidesHref,
?string $slidesEmbed,
?string $slidesNote,
?string $videoHref,
?string $videoThumbnail,
?string $videoThumbnailAlternative,
Expand All @@ -359,6 +366,7 @@ public function add(
$filenamesTalk,
$slidesHref,
$slidesEmbed,
$slidesNote,
$videoHref,
$videoThumbnail,
$videoThumbnailAlternative,
Expand Down Expand Up @@ -386,7 +394,7 @@ public function pageTitle(string $translationKey, Talk $talk): Html


/**
* @return array{key_locale:int, key_translation_group:int|null, action:string|null, title:string, description:string|null, date:DateTime, duration:int|null, href:string|null, key_talk_slides:int|null, key_talk_filenames:int|null, slides_href:string|null, slides_embed:string|null, video_href:string|null, video_thumbnail:string|null, video_thumbnail_alternative:string|null, video_embed:string|null, event:string, event_href:string|null, og_image:string|null, transcript:string|null, favorite:string|null, key_superseded_by:int|null, publish_slides:bool}
* @return array{key_locale:int, key_translation_group:int|null, action:string|null, title:string, description:string|null, date:DateTime, duration:int|null, href:string|null, key_talk_slides:int|null, key_talk_filenames:int|null, slides_href:string|null, slides_embed:string|null, slides_note:string|null, video_href:string|null, video_thumbnail:string|null, video_thumbnail_alternative:string|null, video_embed:string|null, event:string, event_href:string|null, og_image:string|null, transcript:string|null, favorite:string|null, key_superseded_by:int|null, publish_slides:bool}
* @throws TalkDateTimeException
*/
private function getAddUpdateParams(
Expand All @@ -402,6 +410,7 @@ private function getAddUpdateParams(
?int $filenamesTalk,
?string $slidesHref,
?string $slidesEmbed,
?string $slidesNote,
?string $videoHref,
?string $videoThumbnail,
?string $videoThumbnailAlternative,
Expand Down Expand Up @@ -432,6 +441,7 @@ private function getAddUpdateParams(
'key_talk_filenames' => (empty($filenamesTalk) ? null : $filenamesTalk),
'slides_href' => (empty($slidesHref) ? null : $slidesHref),
'slides_embed' => (empty($slidesEmbed) ? null : $slidesEmbed),
'slides_note' => (empty($slidesNote) ? null : $slidesNote),
'video_href' => (empty($videoHref) ? null : $videoHref),
'video_thumbnail' => $videoThumbnail,
'video_thumbnail_alternative' => $videoThumbnailAlternative,
Expand Down
3 changes: 3 additions & 0 deletions site/app/Talks/talkInputs.latte
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,9 @@
<tr class="lighter">
<th class="align-top">{label slidesEmbed /}</th><td>{input slidesEmbed}<br><small><em>deprecated</em></small></td>
</tr>
<tr>
<th class="align-top">{label slidesNote /}</th><td>{input slidesNote}</td>
</tr>
<tr>
<th>{label videoHref /}</th><td>{input videoHref}</td>
</tr>
Expand Down
3 changes: 2 additions & 1 deletion site/app/Www/Presenters/templates/Talks/talk.latte
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,8 @@
<small n:if="$talk->getDuration() || $slides || $talk->getVideo()->getVideoHref()">({if $talk->getDuration()}{_messages.talks.duration|format:$talk->getDuration()}{if $slides || $talk->getVideo()->getVideoHref()}, {/if}{/if}{if $slides}<a href="#{_html.id.slides}">{_messages.talks.slidescount, count($slides)}</a>{if $talk->getVideo()->getVideoHref()}, {/if}{/if}{if $talk->getVideo()->getVideoHref()}<a href="#{_html.id.recording}">{_messages.label.lowercasevideo}</a>{/if})</small>
</p>

<h2 n:if="$talk->isHasSlides()" id="{_html.id.slides}">{_messages.label.slides}</h2>
<h2 n:if="$talk->isHasSlides() || $talk->getSlidesNote()" id="{_html.id.slides}">{_messages.label.slides}</h2>
{if $talk->getSlidesNote()}{$talk->getSlidesNote()}{/if}
{if $talk->getSlidesHref()}
<p><span title="{_messages.label.slides}">{icon images}</span> <a href="{$talk->getSlidesHref()}">{$slidesPlatform ?? $talk->getSlidesHref()}</a></p>
{if $talk->getTranscript()}
Expand Down
2 changes: 2 additions & 0 deletions site/tests/Talks/TalkLocaleUrlsTest.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,8 @@ class TalkLocaleUrlsTest extends TestCase
false,
null,
null,
null,
null,
$video,
null,
Html::fromText('event'),
Expand Down

0 comments on commit 3606caa

Please sign in to comment.