Fixed the county search hidden on contact list
authorLaury GvR <laury@gaslightmedia.com>
Thu, 12 Jan 2017 18:39:58 +0000 (13:39 -0500)
committerLaury GvR <laury@gaslightmedia.com>
Thu, 12 Jan 2017 18:39:58 +0000 (13:39 -0500)
The county search was not being properly hidden when there were no
counties.

models/front/contacts/list.php
views/front/contacts/list.html

index 65c4ce2..17f1544 100644 (file)
@@ -130,6 +130,7 @@ class GlmMembersFront_contacts_list extends GlmDataContacts
         $filterText = false;
         $countySearch = false;
         $countyList = array();
+        $haveCounties = false;
         $haveFilter = false;
         $userDeleted = false;
         $wpUserDeleted = false;
@@ -302,6 +303,10 @@ class GlmMembersFront_contacts_list extends GlmDataContacts
 
         // Get a list of counties
         $countyList = $this->wpdb->get_col("SELECT DISTINCT county FROM ".GLM_MEMBERS_CONTACTS_PLUGIN_DB_PREFIX . "contacts WHERE active = true;");
+        if ($countyList[0]) {
+            echo "<pre>" . print_r($countyList, true) . "</pre>";
+            $haveCounties = true;
+        }
 //        
 //        
 //
@@ -324,7 +329,6 @@ class GlmMembersFront_contacts_list extends GlmDataContacts
         }
         
         
-        //echo "<pre>" . print_r($countyList, true) . "</pre>";
 
         // Compile template data
         $templateData = array(
@@ -353,6 +357,7 @@ class GlmMembersFront_contacts_list extends GlmDataContacts
             'filterArchived' => $filterArchived,
             'filterText' => $filterText,
             'countyList' => $countyList,
+            'haveCounties' => $haveCounties,
             'countySearch' => $countySearch,
             'haveFilter' => $haveFilter,
             'userDeleted' => $userDeleted,
index 90bfa98..a1b4ed0 100644 (file)
@@ -23,7 +23,7 @@ and open the template in the editor.
                 <div id="glmContactsSearchContainer" class="small-12 large-5">
                     <b>Text Search: </b><input  id="glmContactsSearch" name="filterText" type="text" id="autoTest" value="{$filterText}">
                 </div>
-                {if $countyList}
+                {if $haveCounties}
                 <div id="glmContactsCountySearchContainer" class="small-12 large-5">
                     <b>County Search: </b>
                     <select  id="glmContactsCountySearch" name="countySearch" type="text" value="{$countySearch}">