testing shortcode builder with new checkboxes hotfix/2.0.8
authorAnthony Talarico <talarico@gaslightmedia.com>
Thu, 9 Jun 2016 20:04:44 +0000 (16:04 -0400)
committerAnthony Talarico <talarico@gaslightmedia.com>
Thu, 9 Jun 2016 20:04:44 +0000 (16:04 -0400)
classes/glmPluginSupport.php
css/admin.css
js/shortcodeBuilder.js

index 731086d..0342faf 100644 (file)
@@ -664,11 +664,12 @@ return; // Off for now ** Need to make this switchable in management
     public function shortcode_builder_markup(){
 
         require_once(GLM_MEMBERS_PLUGIN_CLASS_PATH.'/data/dataCategories.php');
+        
         $listAttr = $this->config['addOns']['glm-member-db']['shortcodes']['glm-members-list']['attributes'];
         $detailAttr = $this->config['addOns']['glm-member-db']['shortcodes']['glm-member-detail']['attributes'];
 
         $glmcat = new GlmDataCategories($this->wpdb, $this->wpconfig);
-        $list = $glmcat->getList();
+        $list = $glmcat->getListSortedParentChild();
         // get the each addOn slugs to pass to the config array later
         $addOns = $this->config['addOns'];
         foreach($addOns as $addOn){
@@ -695,56 +696,78 @@ return; // Off for now ** Need to make this switchable in management
         echo '<select id="shortcodeDropdown">
         <option value=""> Select Shortcode </option>';
         foreach($shortCodes as $code){
-            echo '<option value = "' . $code . '">' . $code . '</option>';
+            if (false !== strpos($code, 'members-list') || false !== strpos($code, 'packaging-list')){
+                if ( false !== strpos($code, 'members-list' ) ){
+                    echo '<option value = "' . $code . '">' . 'Display Member List by Category' . '</option>';
+                } else if ( false !== strpos($code, 'packaging-list' ) ){
+                    echo '<option value = "' . $code . '">' . 'Packages' . '</option>';
+                }
+            }
         }
         echo '</select>';
 
+        echo '<button id="listBtn" class="glm-button" type="button"> Select a Category </button>';
         /*
          * Member DB Shortcode Attributes
          */
 
         //dropdown for categories
-        echo '<select id="category-scDropdown">';
+        echo '<select id="category-scDropdown" name="category-scDropdown[]">';
         echo '<option> Select Category </option>';
         foreach($list as $key=>$value){
-            echo '<option value='. $key . '>' . $value['name']  . '</option>';
+            if( ! empty($value['parent']['name'])){
+                echo '<option value='. $key .'>' . '&nbsp&nbsp&nbsp'.$value['name']  . '</option>';
+            } else {
+                echo '<option value='. $key .'>' .'&nbsp'. $value['name']  . '</option>';
+            }
         }
         echo '</select>';
+        
+        echo '<div id="showList" title="Member Categories ">';
+        foreach($list as $key=>$value){
+             if( ! empty($value['parent']['name'])){
+                echo '<label class="checkList"><input class="categoryLists" type="checkbox" name="listBox" value='. $key . '>' . '&nbsp&nbsp&nbsp'. $value['name'] .'</label>';
+            } else {
+                echo '<label class="checkList"><input class="categoryLists" type="checkbox" name="listBox" value='. $key . '>' . '&nbsp'. $value['name'] .'</label>';
+            }
+        }
+        echo '</div>';
 
         // dropdown for blank start
         echo '<select id="blank-start-scDropdown">';
-        echo  '<option> Blank Start </option>
+        echo  '<option> Hide List Until Searched</option>
         <option value="False"> False </option>
         <option value="True"> True </option>';
         echo '</select>';
 
         // dropdown for views
         echo '<select id="view-scDropdown">';
+        echo  '<option> View </option>';
         echo '<option selected="selected" value="bars"> Bars </option>';
         echo '<option value="grid"> Grid </option>';
         echo '</select>';
 
         // show list options 'scb' = shortcode builder acronym
-        echo '<div id="showList" title="List Options">';
-        echo '<label><input class="showLists" type="checkbox" name="listBox" value="all">All</label>';
-        echo '<label><input class="showLists" type="checkbox" name="listBox" value="none">None</label>';
-        foreach($listAttr as $key=>$value){
-            if($value != ''){
-                echo '<label class="checkList"><input class="showLists" type="checkbox" name="listBox" value='. $key . '>' . $key .'</label>';
-            }
-        }
-        echo '</div>';
+//        echo '<div id="showList" title="List Options">';
+//        echo '<label><input class="showLists" type="checkbox" name="listBox" value="all">All</label>';
+//        echo '<label><input class="showLists" type="checkbox" name="listBox" value="none">None</label>';
+//        foreach($listAttr as $key=>$value){
+//            if($value != ''){
+//                echo '<label class="checkList"><input class="showLists" type="checkbox" name="listBox" value='. $key . '>' . $key .'</label>';
+//            }
+//        }
+//        echo '</div>';
 
         // show detail options
-        echo '<div id="showDetail" title="Detail Options">';
-        echo '<label><input class="showDetails" type="checkbox" name="detailBox" value="all">All</label>';
-        echo '<label><input class="showDetails" type="checkbox" name="detailBox" value="none">None</label>';
-        foreach($detailAttr as $key=>$value){
-            if($value != ''){
-                echo '<label class="checkDetails"><input class="showDetails" type="checkbox" name="detailBox" value='. $key . '>' . $key .'</label>';
-            }
-        }
-        echo '</div>';
+//        echo '<div id="showDetail" title="Detail Options">';
+//        echo '<label><input class="showDetails" type="checkbox" name="detailBox" value="all">All</label>';
+//        echo '<label><input class="showDetails" type="checkbox" name="detailBox" value="none">None</label>';
+//        foreach($detailAttr as $key=>$value){
+//            if($value != ''){
+//                echo '<label class="checkDetails"><input class="showDetails" type="checkbox" name="detailBox" value='. $key . '>' . $key .'</label>';
+//            }
+//        }
+//        echo '</div>';
 
        // packaging addOn mark up
         if(file_exists(GLM_MEMBERS_PACKAGING_PLUGIN_PATH . "/setup/shortcodeBuilder.php")){
@@ -752,8 +775,8 @@ return; // Off for now ** Need to make this switchable in management
         }
 
         // list and detail buttons to open dialog for member db 'show' attr options
-        echo '<button id="listBtn" class="glm-button" type="button"> Show List Options </button>';
-        echo '<button id="detailBtn" class="glm-button" type="button"> Show Detail Options </button>';
+        
+//        echo '<button id="detailBtn" class="glm-button" type="button"> Show Detail Options </button>';
 
         echo '<button id="generate" class="glm-button" type="button"> Insert Shortcode </button>';
 
index 3682d56..2250c9c 100644 (file)
@@ -339,17 +339,14 @@ input[type=submit], input[type=file] {
     cursor: pointer;
 }
 .showLists, .showDetails{
-    margin:0;
-
+/*    margin:0;
     float:left;
-
-    width:50%; 
+    width:50%; */
 }
 
 #showDetail > label, #showList > label{  
-    margin:0;
-
+/*    margin:0;
     float:left;
-
-    width:50%;
+    width:50%;*/
+    display: block;
 }
index 899fe17..f8a3d70 100644 (file)
@@ -31,12 +31,11 @@ jQuery(document).ready(function ($) {
         }
         
         // get the shortcode option name and hide / show necessary elements
-        shortcodeDropdown = $("#shortcodeDropdown option:selected").text();
+        shortcodeDropdown = $("#shortcodeDropdown option:selected").val();
         
         if(shortcodeDropdown === "glm-members-list"){
             $("#listBtn").show();
             $("#detailBtn").hide();
-            $("#category-scDropdown").show();
             $("#blank-start-scDropdown").show();
             $("#id-scDropdown").hide();
             $("#view-scDropdown").show();