Skip to content

Commit f740643

Browse files
committed
Change idps grouping in discopower
- Handle idps that have the tag "idps_with_logos" or "idps_in_searchable_list_index". - Adjust style of separator (or) in order to support any kind of sorting of groups.
1 parent 7bb4126 commit f740643

2 files changed

Lines changed: 28 additions & 12 deletions

File tree

themes/ssp/discopower/disco-tpl.php

Lines changed: 19 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@
3838
$(document).ready(function() {';
3939
$i = 0;
4040
foreach ($this->data['idplist'] AS $tab => $slist) {
41-
if ($tab == 'all') {
41+
if ($tab == 'idps_in_searchable_list') {
4242
$this->data['head'] .= "\n" . '$("#query_' . $tab . '").liveUpdate("#list_' . $tab . '")' .
4343
(($i++ == 0) && (empty($faventry)) ? '.focus()' : '') . ';';
4444
}
@@ -159,10 +159,12 @@ function getTranslatedName($t, $metadata) {
159159
');
160160
}
161161

162-
162+
$idps_in_searchable_list_index;
163+
$idps_with_logos_index;
163164
foreach( $this->data['idplist'] AS $tab => $slist) {
164165
if (!empty($slist)) {
165-
if($tab == 'all') {
166+
if($tab == 'idps_in_searchable_list') {
167+
$idps_in_searchable_list_index = array_search($tab, array_keys($this->data['idplist']));
166168
$top = '<div class="row ssp-content-group js-spread">
167169
<div class="col-sm-12 js-spread">';
168170
$search_name = 'query_' . $tab;
@@ -173,7 +175,7 @@ function getTranslatedName($t, $metadata) {
173175
. $search_name . '" id="' . $search_name . '" />'
174176
. '</form>'
175177
. '</div>';
176-
$list_open = '<div class="metalist ssp-content-group__provider-list ssp-content-group__provider-list--all js-spread" id="list_' . $tab . '">';
178+
$list_open = '<div class="metalist ssp-content-group__provider-list ssp-content-group__provider-list--idps_in_searchable_list js-spread" id="list_' . $tab . '">';
177179
$list_items = '';
178180
$close = '</div></div></div>'; // /metalist /ssp-content-group /row
179181

@@ -190,12 +192,13 @@ function getTranslatedName($t, $metadata) {
190192
echo($top . $search . $list_open . $list_items . $close);
191193
}
192194
else if($tab == "idps_with_logos") {
195+
$idps_with_logos_index = array_search($tab, array_keys($this->data['idplist']));
193196
$top = '<div class="row ssp-content-group">
194-
<div class="col-sm-12">';
195-
$or = '<div class="text-center ssp-line-or-line"><span class="ssp-line-or-line__or">' . $this->t('{themevanilla:discopower:or}') . '</span></div>';
196-
$list_open = '<div class="metalist ssp-content-group__provider-list ssp-content-group__provider-list--other">';
197+
';
198+
$list_open = '<div class="col-sm-12"><div class="metalist ssp-content-group__provider-list ssp-content-group__provider-list--other">';
197199
$list_items = '';
198-
$close = '</div></div></div>'; // /metalist /ssp-content-group /row
200+
$close_list = '</div>';
201+
$close = '</div></div>'; // /metalist /ssp-content-group /row
199202
if (!empty($this->data['preferredidp']) && array_key_exists($this->data['preferredidp'], $slist)) {
200203
$idpentry = $slist[$this->data['preferredidp']];
201204
$list_items .= (showEntry($this, $idpentry, TRUE, TRUE));
@@ -206,7 +209,14 @@ function getTranslatedName($t, $metadata) {
206209
$list_items .= (showEntry($this, $idpentry, FALSE, TRUE));
207210
}
208211
}
209-
echo $top . $or . $list_open . $list_items . $close;
212+
if($idps_in_searchable_list_index < $idps_with_logos_index) {
213+
$or = '<div class="col-sm-12"><div class="col-sm-12 text-center ssp-line-or-line ssp-line-or-line--top"><span class="ssp-line-or-line__or">' . $this->t('{themevanilla:discopower:or}') . '</span></div>';
214+
echo $top . $or . $list_open . $list_items . $close_list . $close;
215+
}
216+
else {
217+
$or = '<div class="col-sm-12 text-center ssp-line-or-line ssp-line-or-line--bottom"><span class="ssp-line-or-line__or">' . $this->t('{themevanilla:discopower:or}') . '</span></div>';
218+
echo $top . $list_open . $list_items . $close_list . $or . $close;
219+
}
210220
}
211221
}
212222
}

www/resources/sass/_extra.scss

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -345,7 +345,7 @@ h4 {
345345
padding: 0px 42px;
346346
&__provider-list {
347347
overflow: auto;
348-
&--all {
348+
&--idps_in_searchable_list {
349349
margin: 6px 6px 6px 42px;
350350
height: 23vh;
351351
a {
@@ -396,8 +396,14 @@ h4 {
396396
.ssp-line-or-line {
397397
position: relative;
398398
border-bottom: 1px solid #ccc;
399-
margin-bottom: 18px;
400-
margin-top: 6px;
399+
&--top {
400+
margin-bottom: 18px;
401+
margin-top: 6px;
402+
}
403+
&--bottom {
404+
margin-bottom: 30px;
405+
margin-top: 0;
406+
}
401407
.ssp-line-or-line__or {
402408
@extend h2;
403409
position: relative;

0 commit comments

Comments
 (0)