From 9b8ac2d4045791c36f6241a276a4ae253c7f4fe2 Mon Sep 17 00:00:00 2001
From: Mikael Nordfeldth <mmn@hethane.se>
Date: Thu, 9 Jul 2015 14:04:07 +0200
Subject: [PATCH] CSS can handle alternating row colouring now

---
 plugins/Directory/css/directory.css           |  6 +--
 .../lib/sortablesubscriptionlist.php          | 40 ++-----------------
 theme/base/css/display.css                    |  5 +++
 theme/neo-gnu/css/display.css                 |  5 ---
 theme/neo/css/display.css                     |  5 ---
 5 files changed, 10 insertions(+), 51 deletions(-)

diff --git a/plugins/Directory/css/directory.css b/plugins/Directory/css/directory.css
index d49c28fe55..b4fe68d4cc 100644
--- a/plugins/Directory/css/directory.css
+++ b/plugins/Directory/css/directory.css
@@ -41,10 +41,6 @@ table.profile_list tr {
     float: none;
 }
 
-table.profile_list tr.alt {
-    background-color: #def; /* zebra stripe */
-}
-
 table.profie_list td {
     width: 100%;
     padding: 0;
@@ -61,4 +57,4 @@ th.current.reverse {
     background-image: url(../images/control_arrow_up.gif);
     background-repeat: no-repeat;
     background-position: 60% 2px;
-}
\ No newline at end of file
+}
diff --git a/plugins/Directory/lib/sortablesubscriptionlist.php b/plugins/Directory/lib/sortablesubscriptionlist.php
index 75c42a5fdf..d6df6c64cd 100644
--- a/plugins/Directory/lib/sortablesubscriptionlist.php
+++ b/plugins/Directory/lib/sortablesubscriptionlist.php
@@ -27,11 +27,7 @@
  * @link      http://status.net/
  */
 
-if (!defined('STATUSNET')) {
-    exit(1);
-}
-
-require_once INSTALLDIR . '/lib/subscriptionlist.php';
+if (!defined('GNUSOCIAL')) { exit(1); }
 
 /**
  * Widget to show a sortable list of subscriptions
@@ -128,32 +124,9 @@ class SortableSubscriptionList extends SubscriptionList
         $this->out->elementEnd('table');
     }
 
-    function showProfiles()
+    function newListItem($profile)
     {
-        // Note: we don't use fetchAll() because it's borked with query()
-
-        $profiles = array();
-
-        while ($this->profile->fetch()) {
-            $profiles[] = clone($this->profile);
-        }
-
-        $cnt = count($profiles);
-
-        $max = min($cnt, $this->maxProfiles());
-
-        for ($i = 0; $i < $max; $i++) {
-            $odd = ($i % 2 == 0); // for zebra striping
-            $pli = $this->newListItem($profiles[$i], $odd);
-            $pli->show();
-        }
-
-        return $cnt;
-    }
-
-    function newListItem($profile, $odd)
-    {
-        return new SortableSubscriptionListItem($profile, $this->owner, $this->action, $odd);
+        return new SortableSubscriptionListItem($profile, $this->owner, $this->action);
     }
 }
 
@@ -162,11 +135,10 @@ class SortableSubscriptionListItem extends SubscriptionListItem
     /** Owner of this list */
     var $owner = null;
 
-    function __construct($profile, $owner, $action, $alt)
+    function __construct($profile, $owner, $action)
     {
         parent::__construct($profile, $owner, $action);
 
-        $this->alt   = $alt; // is this row alternate?
         $this->owner = $owner;
     }
 
@@ -177,10 +149,6 @@ class SortableSubscriptionListItem extends SubscriptionListItem
             'id'    => 'profile-' . $this->profile->id
         );
 
-        if ($this->alt) {
-            $attr['class'] .= ' alt';
-        }
-
         $this->out->elementStart('tr', $attr);
     }
 
diff --git a/theme/base/css/display.css b/theme/base/css/display.css
index ddc225fb82..20f9aa775f 100644
--- a/theme/base/css/display.css
+++ b/theme/base/css/display.css
@@ -1622,6 +1622,11 @@ ul.profile_list li {
     display: block;
 }
 
+table.profile_list tbody tr:nth-child(2n+1) {
+    background-color: #fafafa !important;
+    border: none !important;
+}
+
 .entity_profile .entity_nickname,
 .entity_profile .entity_fn {
 margin-left:0;
diff --git a/theme/neo-gnu/css/display.css b/theme/neo-gnu/css/display.css
index 39cce89e48..be9b80d41c 100644
--- a/theme/neo-gnu/css/display.css
+++ b/theme/neo-gnu/css/display.css
@@ -1141,11 +1141,6 @@ table.profile_list {
         background: url(../images/bluearrow_up.png) no-repeat top right;
 }
 
-table.profile_list tr.alt {
-    background-color: #fafafa !important;
-    border: none !important;
-}
-
 td.entity_profile {
     width: auto;
     min-width: 250px;
diff --git a/theme/neo/css/display.css b/theme/neo/css/display.css
index 601845164b..575e6b7386 100644
--- a/theme/neo/css/display.css
+++ b/theme/neo/css/display.css
@@ -938,11 +938,6 @@ table.profile_list {
         background: url(../images/bluearrow_up.png) no-repeat top right;
 }
 
-table.profile_list tr.alt {
-    background-color: #fafafa !important;
-    border: none !important;
-}
-
 td.entity_profile {
     width: auto;
     min-width: 250px;
-- 
2.39.5