Skip to content

Commit

Permalink
changed handling of logoUrls;
Browse files Browse the repository at this point in the history
moved font and color css handling to new theme css file;
  • Loading branch information
paaton committed Aug 21, 2024
1 parent 3d075a5 commit 9a0ae4c
Show file tree
Hide file tree
Showing 22 changed files with 139 additions and 109 deletions.
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
100 changes: 0 additions & 100 deletions public/styles.css
Original file line number Diff line number Diff line change
@@ -1,103 +1,3 @@
@font-face {
font-family: 'themix';
src: url('https://cdn.skauting.cz/fonts/TheMix_LT_400.eot');
src: url('https://cdn.skauting.cz/fonts/TheMix_LT_400.eot? #iefix') format('embedded-opentype');
src: url('https://cdn.skauting.cz/fonts/TheMix_LT_400.woff') format('woff'),
url('https://cdn.skauting.cz/fonts/TheMix_LT_400.woff2') format('woff2'),
url('https://cdn.skauting.cz/fonts/TheMix_LT_400.otf') format('opentype'),
url('https://cdn.skauting.cz/fonts/TheMix_LT_400.svg#themix') format('svg');
font-weight: 400;
font-style: normal;
}

@font-face {
font-family: 'themix';
src: url('https://cdn.skauting.cz/fonts/TheMix_LT_400i.eot');
src: url('https://cdn.skauting.cz/fonts/TheMix_LT_400i.eot? #iefix') format('embedded-opentype');
src: url('https://cdn.skauting.cz/fonts/TheMix_LT_400i.woff') format('woff'),
url('https://cdn.skauting.cz/fonts/TheMix_LT_400i.woff2') format('woff2'),
url('https://cdn.skauting.cz/fonts/TheMix_LT_400i.otf') format('opentype'),
url('https://cdn.skauting.cz/fonts/TheMix_LT_400i.svg#themix') format('svg');
font-weight: 400;
font-style: italic;
}

@font-face {
font-family: 'themix';
src: url('https://cdn.skauting.cz/fonts/TheMix_LT_700.eot');
src: url('https://cdn.skauting.cz/fonts/TheMix_LT_700.eot? #iefix') format('embedded-opentype');
src: url('https://cdn.skauting.cz/fonts/TheMix_LT_700.woff') format('woff'),
url('https://cdn.skauting.cz/fonts/TheMix_LT_700.woff2') format('woff2'),
url('https://cdn.skauting.cz/fonts/TheMix_LT_700.otf') format('opentype'),
url('https://cdn.skauting.cz/fonts/TheMix_LT_700.svg#themix') format('svg');
font-weight: 700;
font-style: normal;
}

@font-face {
font-family: 'themix';
src: url('https://cdn.skauting.cz/fonts/TheMix_LT_700i.eot');
src: url('https://cdn.skauting.cz/fonts/TheMix_LT_700i.eot? #iefix') format('embedded-opentype');
src: url('https://cdn.skauting.cz/fonts/TheMix_LT_700i.woff') format('woff'),
url('https://cdn.skauting.cz/fonts/TheMix_LT_700i.woff2') format('woff2'),
url('https://cdn.skauting.cz/fonts/TheMix_LT_700i.otf') format('opentype'),
url('https://cdn.skauting.cz/fonts/TheMix_LT_700i.svg#themix') format('svg');
font-weight: 700;
font-style: italic;
}

@font-face {
font-family: 'skautbold';
src: url('https://cdn.skauting.cz/fonts/skaut-bold-webfont.eot');
src: url('https://cdn.skauting.cz/fonts/skaut-bold-webfont.eot? #iefix') format('embedded-opentype');
src: url('https://cdn.skauting.cz/fonts/skaut-bold-webfont.woff') format('woff'),
url('https://cdn.skauting.cz/fonts/skaut-bold-webfont.otf') format('opentype'),
url('https://cdn.skauting.cz/fonts/skaut-bold-webfont.svg#skautbold') format('svg');
font-weight: normal;
font-style: normal;
}

:root {
background: var(--color-background);
--border-radius: 6px;
font-family: 'themix', sans-serif;
box-sizing: border-box;
color: var(--color-main);
color-scheme: light dark;
accent-color: var(--color-main);
}

@media (prefers-color-scheme: light) {
:root {
--color-background: #e6ebed;
--color-card-background: #f9f9f9;
--color-input-background: #ffffff;
--color-main: #0D71B9;
--color-accent: #b9550d;
--color-fading: #a6d9ff;
--color-light: #3ba5f1;
--color-dark: #06375a;
--color-grey: #636363;
--color-link: #0000ee;
--color-link-visited: #551a8b;
}
}

@media (prefers-color-scheme: dark) {
:root {
--color-background: #212121;
--color-card-background: #252525;
--color-input-background: #2f2f2f;
--color-main: #85A2D5;
--color-accent: #d5b885;
--color-fading: #1f2e3d;
--color-light: #3e6ab5;
--color-dark: #d1dcef;
--color-grey: #888888;
--color-link: lightskyblue;
--color-link-visited: #ad76de;
}
}

*, *::before, *::after {
box-sizing: inherit;
Expand Down
100 changes: 100 additions & 0 deletions public/theme.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,100 @@
@font-face {
font-family: 'themix';
src: url('https://cdn.skauting.cz/fonts/TheMix_LT_400.eot');
src: url('https://cdn.skauting.cz/fonts/TheMix_LT_400.eot? #iefix') format('embedded-opentype');
src: url('https://cdn.skauting.cz/fonts/TheMix_LT_400.woff') format('woff'),
url('https://cdn.skauting.cz/fonts/TheMix_LT_400.woff2') format('woff2'),
url('https://cdn.skauting.cz/fonts/TheMix_LT_400.otf') format('opentype'),
url('https://cdn.skauting.cz/fonts/TheMix_LT_400.svg#themix') format('svg');
font-weight: 400;
font-style: normal;
}

@font-face {
font-family: 'themix';
src: url('https://cdn.skauting.cz/fonts/TheMix_LT_400i.eot');
src: url('https://cdn.skauting.cz/fonts/TheMix_LT_400i.eot? #iefix') format('embedded-opentype');
src: url('https://cdn.skauting.cz/fonts/TheMix_LT_400i.woff') format('woff'),
url('https://cdn.skauting.cz/fonts/TheMix_LT_400i.woff2') format('woff2'),
url('https://cdn.skauting.cz/fonts/TheMix_LT_400i.otf') format('opentype'),
url('https://cdn.skauting.cz/fonts/TheMix_LT_400i.svg#themix') format('svg');
font-weight: 400;
font-style: italic;
}

@font-face {
font-family: 'themix';
src: url('https://cdn.skauting.cz/fonts/TheMix_LT_700.eot');
src: url('https://cdn.skauting.cz/fonts/TheMix_LT_700.eot? #iefix') format('embedded-opentype');
src: url('https://cdn.skauting.cz/fonts/TheMix_LT_700.woff') format('woff'),
url('https://cdn.skauting.cz/fonts/TheMix_LT_700.woff2') format('woff2'),
url('https://cdn.skauting.cz/fonts/TheMix_LT_700.otf') format('opentype'),
url('https://cdn.skauting.cz/fonts/TheMix_LT_700.svg#themix') format('svg');
font-weight: 700;
font-style: normal;
}

@font-face {
font-family: 'themix';
src: url('https://cdn.skauting.cz/fonts/TheMix_LT_700i.eot');
src: url('https://cdn.skauting.cz/fonts/TheMix_LT_700i.eot? #iefix') format('embedded-opentype');
src: url('https://cdn.skauting.cz/fonts/TheMix_LT_700i.woff') format('woff'),
url('https://cdn.skauting.cz/fonts/TheMix_LT_700i.woff2') format('woff2'),
url('https://cdn.skauting.cz/fonts/TheMix_LT_700i.otf') format('opentype'),
url('https://cdn.skauting.cz/fonts/TheMix_LT_700i.svg#themix') format('svg');
font-weight: 700;
font-style: italic;
}

@font-face {
font-family: 'skautbold';
src: url('https://cdn.skauting.cz/fonts/skaut-bold-webfont.eot');
src: url('https://cdn.skauting.cz/fonts/skaut-bold-webfont.eot? #iefix') format('embedded-opentype');
src: url('https://cdn.skauting.cz/fonts/skaut-bold-webfont.woff') format('woff'),
url('https://cdn.skauting.cz/fonts/skaut-bold-webfont.otf') format('opentype'),
url('https://cdn.skauting.cz/fonts/skaut-bold-webfont.svg#skautbold') format('svg');
font-weight: normal;
font-style: normal;
}

:root {
background: var(--color-background);
--border-radius: 6px;
font-family: 'themix', sans-serif;
box-sizing: border-box;
color: var(--color-main);
color-scheme: light dark;
accent-color: var(--color-main);
}

@media (prefers-color-scheme: light) {
:root {
--color-background: #e6ebed;
--color-card-background: #f9f9f9;
--color-input-background: #ffffff;
--color-main: #0D71B9;
--color-accent: #b9550d;
--color-fading: #a6d9ff;
--color-light: #3ba5f1;
--color-dark: #06375a;
--color-grey: #636363;
--color-link: #0000ee;
--color-link-visited: #551a8b;
}
}

@media (prefers-color-scheme: dark) {
:root {
--color-background: #212121;
--color-card-background: #252525;
--color-input-background: #2f2f2f;
--color-main: #85A2D5;
--color-accent: #d5b885;
--color-fading: #1f2e3d;
--color-light: #3e6ab5;
--color-dark: #d1dcef;
--color-grey: #888888;
--color-link: lightskyblue;
--color-link-visited: #ad76de;
}
}
7 changes: 6 additions & 1 deletion src/Event/Event.php
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,12 @@ public function getAvailableRoles(): array

public function getLogoInBase64(): string
{
return ImageUtils::getLocalImageInBase64($this->logoUrl);
return ImageUtils::getLocalImageInBase64($this->getFullLogoUrl($this->logoUrl));

Check failure on line 126 in src/Event/Event.php

View workflow job for this annotation

GitHub Actions / test / Static Analysis

Dynamic call to static method kissj\Event\Event::getFullLogoUrl().
}

public static function getFullLogoUrl(string $logoUrl): string
{
return "/assets" . $logoUrl;
}

public function getMinimalPpCount(Participant $participant): int
Expand Down
2 changes: 1 addition & 1 deletion src/Event/EventType/EventType.php
Original file line number Diff line number Diff line change
Expand Up @@ -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';
}

public function getSkautStampSignPath(Participant $participant): string
Expand Down
2 changes: 1 addition & 1 deletion src/Mailer/Mailer.php
Original file line number Diff line number Diff line change
Expand Up @@ -224,7 +224,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)),

Check failure on line 227 in src/Mailer/Mailer.php

View workflow job for this annotation

GitHub Actions / test / Static Analysis

Dynamic call to static method kissj\Event\Event::getFullLogoUrl().
]));
array_map(fn (string $attachment) => $email->attach($attachment), $attachments);
foreach ($embeds as $embed) {
Expand Down
12 changes: 12 additions & 0 deletions src/Settings/TwigExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,23 @@
use kissj\Participant\Troop\TroopLeader;
use kissj\Participant\Troop\TroopParticipant;
use kissj\User\UserStatus;
use kissj\Event\Event;
use Twig\Extension\AbstractExtension;
use Twig\TwigTest;
use Twig\TwigFunction;

class TwigExtension extends AbstractExtension
{
/**
* @return TwigFunction[]
*/
public function getFunctions() :array
{
return [
new TwigFunction('eventLogo', [Event::class, 'getFullLogoUrl']),
];
}

/**
* @return TwigTest[]
*/
Expand Down
21 changes: 17 additions & 4 deletions src/Templates/translatable/_layout.twig
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,16 @@
<meta name="theme-color" content="#872e4e" media="(prefers-color-scheme: dark)">
<meta name="viewport" content="width=device-width, initial-scale=1" />

<title>{% trans %}_layout.title{% endtrans %} - {{ event.readableName }} - kissj</title>
<title>{% if event is not null %}
{% trans %}_layout.title{% endtrans %} - {{ event.readableName }}
{% else %}
Kissj
{% endif %}
</title>

<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">
<link rel="stylesheet" href="https://fonts.googleapis.com/icon?family=Material+Icons">
<link rel="stylesheet" href="{{ base_path() }}/theme.css">
<link rel="stylesheet" href="{{ base_path() }}/styles.css">
{% if event.eventType.getStylesheetNameWithoutLeadingSlash is not null %}
<link rel="stylesheet" href="{{ base_path() }}/{{ event.eventType.getStylesheetNameWithoutLeadingSlash }}">
Expand All @@ -31,7 +37,14 @@
</head>

<body class="wrapper">
<h1 class="text-center">{% trans %}_layout.title{% endtrans %} - {{ event.readableName }}</h1>
<h1 class="text-center">
{% if event is not null %}
{% trans %}_layout.title{% endtrans %} - {{ event.readableName }}
{% else %}
Kissj
{% endif %}

</h1>
<div class="user text-right">
{% for localeSlug, localeText in event.eventType.getLanguages() %}
<a href="?locale={{ localeSlug }}">{{ localeText }}</a>{% if not loop.last %} | {% endif%}
Expand Down Expand Up @@ -90,7 +103,7 @@
| <a href="https://www.stojimezaukrajinou.cz/" target="_blank">🇺🇦 stojimezaukrajinou.cz</a>
</span>
<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() }}" alt="logo of {{ event.readableName }}">
</a>
</footer>
</body>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 }}">
</a>
{% endif %}
</footer>
Expand Down
2 changes: 1 addition & 1 deletion src/Templates/translatable/emails/_mail-layout.twig
Original file line number Diff line number Diff line change
Expand Up @@ -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 }}">
</a>
{% endif %}
</footer>
Expand Down

0 comments on commit 9a0ae4c

Please sign in to comment.