Skip to content

Commit

Permalink
Add 'about' section to footer (#110)
Browse files Browse the repository at this point in the history
  • Loading branch information
samwilson committed Aug 19, 2021
1 parent aceb1b6 commit b027974
Show file tree
Hide file tree
Showing 9 changed files with 68 additions and 21 deletions.
2 changes: 2 additions & 0 deletions .env
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@ DATABASE_URL=mysql://db_user:db_password@127.0.0.1:3306/db_name?serverVersion=5.
MAILER_DSN=smtp://localhost
###< symfony/mailer ###

APP_MAIN_CONTACT=1

APP_MAIL_SENDER=user@example.org
APP_LOG_RECIPIENT=user@example.org

Expand Down
35 changes: 23 additions & 12 deletions assets/css/app.less
Original file line number Diff line number Diff line change
Expand Up @@ -73,28 +73,39 @@ table {
body {
color: @font-color;
font-family: @font-family;
display: flex;
flex-direction: column;
}

body > main {
flex: 10;
padding: 1rem;
}

body > footer {
flex: 1;
text-align: right;
font-size: smaller;
border-top: @border-primary;
padding: 1rem;

ul {
list-style-type: none;
margin: 0;
padding: 0;
display: flex;
li { flex: 1; }
.footer-inner {
max-width: 99em;
margin: auto;
}

.p-name {
display: block;
font-size: larger;
color: inherit;
}

.u-email {
display: inline-block;
margin-left: 2em;
}

.p-note {
max-width: 40em;
}

.powered-by {
margin-top: 3em;
font-size: smaller;
}
}

Expand Down
1 change: 1 addition & 0 deletions config/services.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ services:
arguments:
$projectDir: '%kernel.project_dir%'
$mailFrom: '%env(APP_MAIL_SENDER)%'
$mainContactId: '%env(APP_MAIN_CONTACT)%'

App\WebRequestProcessor:
tags: { name: monolog.processor }
Expand Down
1 change: 0 additions & 1 deletion public/build/app.37cf5762.css

This file was deleted.

1 change: 1 addition & 0 deletions public/build/app.f7a0a964.css

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion public/build/entrypoints.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"/build/app.ec250921.js"
],
"css": [
"/build/app.37cf5762.css"
"/build/app.f7a0a964.css"
]
},
"map": {
Expand Down
2 changes: 1 addition & 1 deletion public/build/manifest.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"build/app.css": "/build/app.37cf5762.css",
"build/app.css": "/build/app.f7a0a964.css",
"build/app.js": "/build/app.ec250921.js",
"build/map.css": "/build/map.194bb611.css",
"build/map.js": "/build/map.5b53fdc6.js",
Expand Down
23 changes: 23 additions & 0 deletions src/Settings.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@

namespace App;

use App\Entity\Contact;
use App\Entity\Setting;
use App\Repository\ContactRepository;
use App\Repository\SettingRepository;
use Doctrine\ORM\EntityManagerInterface;

Expand All @@ -12,6 +14,15 @@ class Settings
/** @var SettingRepository */
private $settingRepository;

/** @var ContactRepository */
private $contactRepository;

/** @var int */
private $mainContactId;

/** @var Contact|null */
private $mainContact;

/** @var EntityManagerInterface */
private $entityManager;

Expand All @@ -26,11 +37,15 @@ class Settings

public function __construct(
SettingRepository $settingRepository,
ContactRepository $contactRepository,
int $mainContactId,
EntityManagerInterface $entityManager,
string $projectDir,
string $mailFrom
) {
$this->settingRepository = $settingRepository;
$this->contactRepository = $contactRepository;
$this->mainContactId = $mainContactId;
$this->entityManager = $entityManager;
$this->projectDir = $projectDir;
$this->mailFrom = $mailFrom;
Expand Down Expand Up @@ -148,4 +163,12 @@ public function flickrTokenSecret(): string
{
return $this->getData()['flickr_token_secret'] ?? '';
}

public function getMainContact(): ?Contact
{
if ($this->mainContact === null) {
$this->mainContact = $this->contactRepository->find($this->mainContactId ?? 1);
}
return $this->mainContact;
}
}
22 changes: 16 additions & 6 deletions templates/base.html.twig
Original file line number Diff line number Diff line change
Expand Up @@ -46,12 +46,22 @@

</main>
<footer>
<ul>
<li>Powered by <a href="https://github.com/samwilson/twyne">Twyne</a> <dfn title="Current application version">{{ git_tag() }}</dfn></li>
<li><a href="https://github.com/samwilson/twyne/issues">Issues</a></li>
<li><a href="https://github.com/samwilson/twyne">Source code</a></li>
<li><a href="https://www.gnu.org/licenses/gpl-3.0-standalone.html">GPL 3.0+</a></li>
</ul>
<div class="footer-inner">
{% if settings.mainContact %}
<div class="h-card">
<p><strong class="p-name">{{ settings.mainContact.name }}</strong></p>
<p>
<a class="u-url" rel="me" href="{{ settings.mainContact.homepage }}">🔗 {{ settings.mainContact.homepage }}</a>
<a class="u-email" rel="me" href="mailto:{{ settings.mainContact.user.email }}">📧 {{ settings.mainContact.user.email }}</a>
</p>
<div class="p-note">{{ settings.mainContact.descriptionPublic|markdownToHtml|raw }}</div>
</div>
{% endif %}
<p class="powered-by">
Powered by <a href="https://github.com/samwilson/twyne">Twyne</a>
<dfn title="Current application version">{{ git_tag() }}</dfn>
</p>
</div>
</footer>
<script>
const appBaseUrl = "{{ url('home') }}";
Expand Down

0 comments on commit b027974

Please sign in to comment.