Skip to content
This repository was archived by the owner on Sep 19, 2022. It is now read-only.

Commit 278f7fc

Browse files
Merge pull request #110 from vyskocilpavel/social_width
Fixed the width of showed tagged idps
2 parents b1b9e8a + 393ed8b commit 278f7fc

File tree

2 files changed

+16
-3
lines changed

2 files changed

+16
-3
lines changed

CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,9 @@ All notable changes to this project will be documented in this file.
55
#### Added
66
- Added facility capabilities to PerunEntitlement
77

8+
#### Fixed
9+
- Fixed the width of showed tagged idps in case the count of idps is equal to (x * 3) + 1
10+
811
## [v3.8.0]
912
#### Changed
1013
- Releasing forwardedEduPersonEntitlement is now optional (forwardedEduPersonEntitlement are released by default)

lib/Disco.php

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -483,10 +483,12 @@ public static function showTaggedIdPs($t, $tag, $showSignInWith = false)
483483
}
484484
$html .= '</div>';
485485
}
486-
if (($idpCount % 3) !== 0) {
486+
487+
$remainIdpsCount = ($idpCount - ($fullRowCount * 3)) % 3;
488+
if ($remainIdpsCount !== 0) {
487489
$html .= '<div class="row">';
488-
for ($i = 0; $i < $idpCount % 3; $i++) {
489-
$html .= '<div class="col-md-' . (12 / ($idpCount % 3)) . '">';
490+
for ($i = 0; $i < $remainIdpsCount; $i++) {
491+
$html .= '<div class="' . self::getCssClass($remainIdpsCount) . '">';
490492
$html .= '<div class="metalist list-group">';
491493
$html .= self::showTaggedEntry($t, $idps[array_keys($idps)[$counter]], $showSignInWith);
492494
$html .= '</div>';
@@ -499,6 +501,14 @@ public static function showTaggedIdPs($t, $tag, $showSignInWith = false)
499501
return $html;
500502
}
501503

504+
protected static function getCssClass($remainIdpsCount)
505+
{
506+
if ($remainIdpsCount === 1) {
507+
return 'col-md-4 col-md-offset-4';
508+
}
509+
return 'col-md-6';
510+
}
511+
502512
public static function showEntriesScript()
503513
{
504514
$script = '<script type="text/javascript">

0 commit comments

Comments
 (0)