Enqueued Materialize, autocomplete script comments
authorLaury GvR <laury@gaslightmedia.com>
Wed, 19 Sep 2018 16:53:39 +0000 (12:53 -0400)
committerLaury GvR <laury@gaslightmedia.com>
Wed, 19 Sep 2018 16:53:39 +0000 (12:53 -0400)
- Added autocomplete script as seen on the agenda view frontend of
the events plugin. Commented it all out, just for reference now.
- Enqueued materialize in the dashboard model

models/admin/newDashboard/index.php
views/admin/members/summaryWidget.html
views/admin/newDashboard/index.html

index 852b24c..570458c 100644 (file)
@@ -108,6 +108,18 @@ class GlmMembersAdmin_newDashboard_index extends GlmDataMembers
         $clickThroughCounts = array('day' => 0, 'week' => 0, 'month' => 0);
         $detailViewCounts   = array('day' => 0, 'week' => 0, 'month' => 0);
 
+        // Enqueue Materialize
+        wp_register_script(
+            'materialize',
+            GLM_MEMBERS_PLUGIN_URL . 'js/materialize.min.js',
+            array(
+                    'jquery'
+            ),
+            GLM_MEMBERS_PLUGIN_VERSION
+        );
+        wp_enqueue_script('materialize', false, array('jquery'), false, true);
+        wp_enqueue_style('materialize-css', GLM_MEMBERS_PLUGIN_URL . 'css/materialize.min.css');
+
         // Check if there's a logged in user who is locked to their own entity.
         $lockedToMember = apply_filters( 'glm_members_locked_to_member_id', false );
         $memberID       = $lockedToMember;
index 7cb804b..7413513 100644 (file)
@@ -1,6 +1,6 @@
 <ul id="members-summary-widget" class="summary members-summary-widget dashboard-summary-widget collapsible">
     <li>
-        <div class="summary-widget-handle collapsible-header"> {$w|var_dump} </div>
+        <div class="summary-widget-handle collapsible-header"><pre> {$w|var_dump} </pre></div>
         <div class="summary-widget-body collapsible-body">
             <div class="quicklinks">
                 <a href="#">Dashboard</a>
             </div>
         </div>
     </li>
-</ul>
\ No newline at end of file
+</ul>
+<script type="text/javascript">
+    jQuery(document).ready(function($) {
+
+        /*
+            * Do autocomplete search for member
+            * label: What will be searched
+            * value: What will be displayed when selected
+            * id: Member id added so we can go to the member while showing what was selected
+            * Also note that autocomplete does not properly render HTML codes, so we
+            * "unescape" them for HTML in Smarty.
+            */
+
+            // $( "#glmMembersList" ).autocomplete({
+            //     //source: availableTags,
+            //     source: {*ajaxModel*},
+            //     data: {
+                    
+            //         action: 'glm_members_admin_ajax',
+            //         glm_action: 'eventsCalMonthAJAX',
+            //         custom_data: 'custom_data',
+            //     },
+            //     html: true,
+            //     select: function( event, ui ) {
+            //         var memberID = ui.item.id;
+            //         window.location.replace("{*$adminUrl*}?page=glm-members-admin-menu-member&glm_action=index&member=" + memberID );
+            //     },
+            //     response: function(event, ui) {
+            //         if (!ui.content.length) {
+            //             var noResult = { value:"",label:"No results found" };
+            //             ui.content.push(noResult);
+            //         }
+            //     }
+            // });
+
+    });
+
+</script>
index 1c7caca..34d72b1 100644 (file)
         </div>
     </div>    
 </div>
+NewDashboard!
 <script> 
     jQuery(function($){
         M.AutoInit();
     })
     
+    
 </script>
-NewDashboard!
+
 {include file='admin/footer.html'}
\ No newline at end of file