Skip to content

Commit

Permalink
Merge pull request #1226 from csrdelft/feature/vierkante-profielfotos
Browse files Browse the repository at this point in the history
Maak profielfoto's vierkant
  • Loading branch information
ardjuh authored Dec 11, 2024
2 parents 0628c54 + 876df93 commit 32c8f6b
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 10 deletions.
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 %}

0 comments on commit 32c8f6b

Please sign in to comment.