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

Maak profielfoto's vierkant #1226

Merged
merged 2 commits into from
Dec 11, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 16 additions & 7 deletions lib/entity/profiel/Profiel.php
Original file line number Diff line number Diff line change
Expand Up @@ -401,9 +401,9 @@ public function __construct(
*/
#[
ORM\OneToOne(
targetEntity: \CsrDelft\entity\security\Account::class,
mappedBy: 'profiel'
)
targetEntity: \CsrDelft\entity\security\Account::class,
mappedBy: 'profiel'
)
]
public $account;

Expand Down Expand Up @@ -705,16 +705,21 @@ public function getLink($vorm = 'civitas'): string
if ($vorm === 'pasfoto') {
return $this->getPasfotoTag();
}
if ($vorm === 'pasfoto.vierkant' && LoginService::mag(P_LEDEN_READ)) {
return $this->getPasfotoTag('', 'vierkant');
}
return $this->getNaam();
}
$naam = $this->getNaam($vorm);
if ($vorm === 'pasfoto') {
$naam = $this->getPasfotoTag();
} elseif ($vorm === 'pasfoto.vierkant') {
$naam = $this->getPasfotoTag('', 'vierkant');
} elseif ($this->lidjaar === 2013) {
$naam = CsrBB::parse('[neuzen]' . $naam . '[/neuzen]');
}
if (
$vorm !== 'pasfoto' &&
$vorm !== 'pasfoto' && $vorm !== 'pasfoto.vierkant' &&
InstellingUtil::lid_instelling('layout', 'visitekaartjes') == 'ja'
) {
$title = '';
Expand All @@ -734,7 +739,7 @@ public function getLink($vorm = 'civitas'): string
$this->getNaam($vorm) .
'">';
if (
$vorm !== 'pasfoto' &&
$vorm !== 'pasfoto' && $vorm !== 'pasfoto.vierkant' &&
InstellingUtil::lid_instelling('layout', 'visitekaartjes') == 'ja'
) {
return '<span data-visite="' .
Expand Down Expand Up @@ -896,6 +901,10 @@ public function pasfoto(): string {
return "/profiel/pasfoto/$this->uid.jpg";
}

public function pasfotoVierkant(): string {
return "/profiel/pasfoto/$this->uid.vierkant.jpg";
}

/**
* Kijkt of er een pasfoto voor het gegeven uid is, en geef die terug.
* Geef anders een standaard-plaatje terug.
Expand Down Expand Up @@ -955,12 +964,12 @@ public function getPasfotoInternalPath($vorm = 'user')
return PathUtil::safe_combine_path(PASFOTO_PATH, $path);
}

public function getPasfotoTag($cssClass = '')
public function getPasfotoTag($cssClass = '', $vorm = 'user')
{
return '<img class="pasfoto ' .
htmlspecialchars((string) $cssClass) .
'" src="' .
$this->getPasfotoPath() .
$this->getPasfotoPath($vorm) .
'" alt="Pasfoto van ' .
$this->getNaam('volledig') .
'" />';
Expand Down
2 changes: 1 addition & 1 deletion templates/aanmelder/onderdelen/deelnemer.html.twig
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<div class="card">
<div class="row g-0">
<div class="col-auto d-print-none">
{{ deelnemer.lid.link('pasfoto') | raw }}
{{ deelnemer.lid.link('pasfoto.vierkant') | raw }}
</div>
<div class="col">
<div class="card-body">
Expand Down
2 changes: 1 addition & 1 deletion templates/forum/resultaten.html.twig
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@
{% endif %}
</span>
{% if app.user and post.uid != 'x999' %}
<div class="forumpasfoto">{{ get_profiel(post.uid).link('pasfoto') | raw }}</div>
<div class="forumpasfoto">{{ get_profiel(post.uid).link('pasfoto.vierkant') | raw }}</div>
{% endif %}
</div>
<div class="forum-bericht {{ cycle(['bericht0', 'bericht1'], loop.index) }}" id="post{{ post.post_id }}">
Expand Down
2 changes: 1 addition & 1 deletion templates/groep/pasfotos.html.twig
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

{% for lid in groep.leden %}
<a href="/profiel/{{lid.uid}}" title="{{lid.profiel.naam('volledig')}}" class="lidLink {{lid.profiel.status}}" data-lid="{{lid.uid}}" data-lid-naam="{{lid.profiel.naam('volledig')}}">
<img class="pasfoto" loading="lazy" src="{{ lid.profiel.pasfoto }}" alt="Pasfoto van {{ lid.profiel.naam('volledig') }}">
<img class="pasfoto" loading="lazy" src="{{ lid.profiel.pasfotoVierkant }}" alt="Pasfoto van {{ lid.profiel.naam('volledig') }}">
</a>
{% endfor %}
{% endblock %}
Loading