Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Move assets into separate file #301

Open
wants to merge 3 commits into
base: staging
Choose a base branch
from
Open

Move assets into separate file #301

wants to merge 3 commits into from

Conversation

tomtomklima
Copy link
Contributor

No description provided.

moved font and color css handling to new theme css file;
also handle null logo urls from twig.
public static function getFullLogoUrl(?string $logoUrl): string
{
if ($logoUrl === null) { return "";}
return "/assets" . $logoUrl;
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Takto natvrdo vypálená adresa do kódu není dobře - když to budeme chtít přesunout, tak budeme muset změnit kód, což je špatně. Lepší by bylo toto zanést do infra, aby webserver hledal v této složce automaticky a kód appky to vůbec nemusel vědět

@@ -232,7 +232,7 @@ public function showIban(): bool

public function getSkautLogoPath(Participant $participant): string
{
return '/SKAUT_horizontalni_logo_250.png';
return '/assets/SKAUT_horizontalni_logo_250.png';
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

dtto v src/Event/Event.php

@@ -224,7 +225,7 @@ private function sendMailFromTemplate(
$email->htmlTemplate('emails/' . $templateName . '.twig');
$email->context(array_merge($parameters, [
'fullRegistrationLink' => $this->settings->getFullUrlLink(),
'eventImageExists' => is_file(__DIR__ . '/../../public/' . $event->logoUrl),
'eventImageExists' => is_file(__DIR__ . '/../../public/' . Event::getFullLogoUrl($event->logoUrl)),
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Není potřeba volat staticky, když máme k dispozici už konkrétní objekt, kde to je


<link rel="shortcut icon" href="/favicon-16x16.png" type="image/x-icon">
<link rel="shortcut icon" href="../../../public/assets/favicon-16x16.png" type="image/x-icon">
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

dtto src/Event/Event.php

Comment on lines +23 to +29
public function getFunctions() :array
{
return [
new TwigFunction('eventLogo', [Event::class, 'getFullLogoUrl']),
];
}

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

není potřeba, když se nebude volat staticky

<a href="{{ event.webUrl }}" class="footer-item" target="_blank">
<img class="footer-logo" src="{{ event.logoUrl }}" alt="logo of {{ event.readableName }}">
<img class="footer-logo" src="{{ eventLogo(event.logoUrl) }}" alt="logo of {{ event.readableName }}">
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

dtto src/Settings/TwigExtension.php

@@ -67,7 +67,7 @@
<footer>
{% if eventImageExists %}
<a href="{{ event.webUrl }}" class="footer-item" target="_blank">
<img class="footer-logo" src="{{ email.image( event.logoUrl ) }}" alt="logo of {{ event.readableName }}">
<img class="footer-logo" src="{{ email.image(eventLogo(event.logoUrl)) }}" alt="logo of {{ event.readableName }}">
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

dtto src/Settings/TwigExtension.php

@@ -81,7 +81,7 @@
<footer>
{% if eventImageExists %}
<a href="{{ event.webUrl }}" class="footer-item" target="_blank">
<img class="footer-logo" src="{{ email.image( event.logoUrl ) }}" alt="logo of {{ event.readableName }}">
<img class="footer-logo" src="{{ email.image(eventLogo(event.logoUrl)) }}" alt="logo of {{ event.readableName }}">
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

dtto src/Settings/TwigExtension.php

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants