Update the scripting for pdf link hotfix/1.7.22
authorSteve Sutton <steve@gaslightmedia.com>
Thu, 21 Mar 2019 13:43:33 +0000 (09:43 -0400)
committerSteve Sutton <steve@gaslightmedia.com>
Thu, 21 Mar 2019 13:43:33 +0000 (09:43 -0400)
Submit the form but add in target _blank.
Remove these from form after submit.

index.php
js/dashboard.js
views/front/events/searchForm.html

index 8599da3..b8e1e2d 100755 (executable)
--- a/index.php
+++ b/index.php
@@ -3,7 +3,7 @@
  * Plugin Name: GLM Associate - Events Add-On
  * Plugin URI: http://www.gaslightmedia.com/
  * Description: Gaslight Media Members Database.
- * Version: 1.7.21
+ * Version: 1.7.22
  * Author: Chuck Scott
  * Author URI: http://www.gaslightmedia.com/
  * License: GPL2
@@ -19,7 +19,7 @@
  * @package glmMembersDatabaseEventsAddOn
  * @author Chuck Scott <cscott@gaslightmedia.com>
  * @license http://www.gaslightmedia.com Gaslightmedia
- * @version 1.7.21
+ * @version 1.7.22
  */
 
 // Check that we're being called by WordPress.
@@ -43,7 +43,7 @@ if (!defined('ABSPATH')) {
  *  so that we're sure the other add-ons see an up to date
  *  version from this plugin.
  */
-define('GLM_MEMBERS_EVENTS_PLUGIN_VERSION', '1.7.21');
+define('GLM_MEMBERS_EVENTS_PLUGIN_VERSION', '1.7.22');
 define('GLM_MEMBERS_EVENTS_PLUGIN_DB_VERSION', '0.1.13');
 
 // This is the minimum version of the GLM Members DB plugin require for this plugin.
index d90cb64..4fa5ab4 100644 (file)
@@ -24,12 +24,13 @@ jQuery(document).ready(function ($) {
             GLM_GeoMap.initializeLargeMap();
         });
     }
-    jQuery('#glm-event-pdf-submit').click(function(event){
-        eventForm = $('#glm-member-event-search');
-        // Get the data-cats
-        var categories = $(this).data('cats');
-        eventForm.attr('action', ajaxUrl + '?action=glm_members_admin_ajax&glm_action=pdfOutput&glm-event-pdf=1&categories=' + categories );
-    });
+    // This has been moved into the view file for the event search form
+    // jQuery('#glm-event-pdf-submit').click(function(event){
+    //     eventForm = $('#glm-member-event-search');
+    //     // Get the data-cats
+    //     var categories = $(this).data('cats');
+    //     eventForm.attr('action', ajaxUrl + '?action=glm_members_admin_ajax&glm_action=pdfOutput&glm-event-pdf=1&categories=' + categories );
+    // });
     if (jQuery('#glm-event-name').length > 0) {
         var cache = {};
         jQuery("#glm-event-name").autocomplete({
index 8d46e3a..e15dc54 100644 (file)
 {/if}
 <script type="text/javascript">
     jQuery(document).ready(function($){
-        jQuery('#glm-event-pdf-submit').click(function(){
-            jQuery('#glm-member-event-search').attr('method', 'post');
+        jQuery('#glm-event-pdf-submit').click(function(e){
+            e.preventDefault();
+            var eventForm  = $('#glm-member-event-search');
+            var categories = $(this).data('cats');
+            var oldAction  = eventForm.attr('action');
+            var oldMethod  = eventForm.attr('method');
+            eventForm.attr('action', ajaxUrl + '?action=glm_members_admin_ajax&glm_action=pdfOutput&glm-event-pdf=1&categories=' + categories );
+            eventForm.attr('method', 'post');
+            eventForm.attr('target', '_blank');
+            eventForm.submit();
+            eventForm.attr('action', oldAction );
+            eventForm.attr('method', oldMethod );
+            eventForm.attr('target', '');
+
         });
     });
 </script>