From: Steve Sutton Date: Thu, 12 Oct 2017 17:25:58 +0000 (-0400) Subject: WIP for the logout and adding attendees X-Git-Tag: v1.0.0^2~353 X-Git-Url: http://cvs2.gaslightmedia.com/gitweb/index.cgi?a=commitdiff_plain;h=571ff4c0c72f8240961c0fefb13edd443f590e7c;p=WP-Plugins%2Fglm-member-db-registrations.git WIP for the logout and adding attendees Fix the add attendee so you can select the time. Logout will now go to the event list. --- diff --git a/css/front.css b/css/front.css index bad3cac..7e1e659 100644 --- a/css/front.css +++ b/css/front.css @@ -175,19 +175,19 @@ div.glm-reg-register input.error { .new-reg h2 { width: auto; } -.new-reg .reg_fname, -.new-reg .reg_lname, -.new-reg .reg_addr1, -.new-reg .reg_addr2, -.new-reg .reg_city, -.new-reg .reg_state, -.new-reg .reg_zip, -.new-reg .reg_country { +.new-reg .add_reg_fname, +.new-reg .add_reg_lname, +.new-reg .add_reg_addr1, +.new-reg .add_reg_addr2, +.new-reg .add_reg_city, +.new-reg .add_reg_state, +.new-reg .add_reg_zip, +.new-reg .add_reg_country { width: 46%; margin-right: 1rem; float: left; } -.new-reg .reg_email { +.new-reg .add_reg_email { width: 96%; } diff --git a/js/frontRegApp.js b/js/frontRegApp.js index f5338fb..8ff12ce 100644 --- a/js/frontRegApp.js +++ b/js/frontRegApp.js @@ -523,7 +523,6 @@ app.Views.Front.App = Backbone.View.extend({ data: 'option=logout' }) .done(function( msg ){ - console.log( msg ); // Here we can update. loginAccount = ''; this.accountView.remove(); @@ -532,6 +531,8 @@ app.Views.Front.App = Backbone.View.extend({ item.set({ loggedIn: false }); }); jQuery('#appLogin').show(); + // Need to reload the page now + window.location.href = thisPageUrl; }) .fail(function(msg){ console.log('Fail:'); @@ -828,7 +829,7 @@ app.Views.Front.RegClass = Backbone.View.extend({ this.newRegAccountView = new app.Views.Front.RegistrantForm({model: this.newRegAccount}); this.$el.append( this.newRegAccountView.render().el ); if ( app.timeSpecific ) { - app.initFullCalendar(); + app.initFullCalendar( true ); console.log('called app.initFullCalendar()'); } }, @@ -1001,7 +1002,7 @@ app.Views.Front.RegRequestRegistrant = Backbone.View.extend({ this.$('.reg-edit-form').show(); if ( app.timeSpecific === true ) { this.$('#reg-select-time').val( this.model.get( 'reg_time' ) ); - app.initFullCalendar(); + app.initFullCalendar( false ); console.log( this.model.get( 'reg_time' ) ); } }, diff --git a/js/views/front/app.js b/js/views/front/app.js index b9358ad..b7d1317 100644 --- a/js/views/front/app.js +++ b/js/views/front/app.js @@ -54,7 +54,6 @@ app.Views.Front.App = Backbone.View.extend({ data: 'option=logout' }) .done(function( msg ){ - console.log( msg ); // Here we can update. loginAccount = ''; this.accountView.remove(); @@ -63,6 +62,8 @@ app.Views.Front.App = Backbone.View.extend({ item.set({ loggedIn: false }); }); jQuery('#appLogin').show(); + // Need to reload the page now + window.location.href = thisPageUrl; }) .fail(function(msg){ console.log('Fail:'); diff --git a/js/views/front/regClass.js b/js/views/front/regClass.js index cba27ce..4b39580 100644 --- a/js/views/front/regClass.js +++ b/js/views/front/regClass.js @@ -139,7 +139,7 @@ app.Views.Front.RegClass = Backbone.View.extend({ this.newRegAccountView = new app.Views.Front.RegistrantForm({model: this.newRegAccount}); this.$el.append( this.newRegAccountView.render().el ); if ( app.timeSpecific ) { - app.initFullCalendar(); + app.initFullCalendar( true ); console.log('called app.initFullCalendar()'); } }, diff --git a/js/views/front/regRequestRegistrant.js b/js/views/front/regRequestRegistrant.js index b60b749..9f62500 100644 --- a/js/views/front/regRequestRegistrant.js +++ b/js/views/front/regRequestRegistrant.js @@ -69,7 +69,7 @@ app.Views.Front.RegRequestRegistrant = Backbone.View.extend({ this.$('.reg-edit-form').show(); if ( app.timeSpecific === true ) { this.$('#reg-select-time').val( this.model.get( 'reg_time' ) ); - app.initFullCalendar(); + app.initFullCalendar( false ); console.log( this.model.get( 'reg_time' ) ); } }, diff --git a/models/admin/ajax/account.php b/models/admin/ajax/account.php index 6fa45a3..09053fe 100644 --- a/models/admin/ajax/account.php +++ b/models/admin/ajax/account.php @@ -183,7 +183,10 @@ class GlmMembersAdmin_ajax_account extends GlmDataRegistrationsAccount break; case 'logout': - unset( $_SESSION['LoginAccount'] ); + unset( + $_SESSION['LoginAccount'], + $_SESSION['glm_reg_cart_id'] + ); $return = array( 'valid' => false ); break; case 'login': diff --git a/models/front/registrations/registration.php b/models/front/registrations/registration.php index 83fd2e2..8d02298 100644 --- a/models/front/registrations/registration.php +++ b/models/front/registrations/registration.php @@ -42,6 +42,7 @@ $loginAccount = ''; $cartId = false; $haveCart = false; + $isNewCart = false; $regEventFirstTime = false; // Have Backbone.js loaded @@ -121,12 +122,15 @@ // Try to get the new cart $cart = $RegCart->getRegistrationCart( $cartId ); if ($cart !== false && is_array($cart)) { - $haveCart = true; + $haveCart = true; + $isNewCart = true; $_SESSION['glm_reg_cart_id'] = $cartId; } } + // Need to refresh the page + } // If we have a good cart, convert to JSON for view @@ -293,6 +297,7 @@ // Compile template data $templateData = array( 'haveCart' => $haveCart, + 'isNewCart' => $isNewCart, 'regEvent' => $regEvent, 'regEventFirstTime' => $regEventFirstTime, 'thisJsUrl' => GLM_MEMBERS_REGISTRATIONS_PLUGIN_URL . '/js', diff --git a/views/front/registrations/registration.html b/views/front/registrations/registration.html index 89d6c60..2ec44d0 100644 --- a/views/front/registrations/registration.html +++ b/views/front/registrations/registration.html @@ -240,7 +240,8 @@ var app = { return regex.test(email); }, {if $regEvent.time_specific.value} - initFullCalendar: function(){ + initFullCalendar: function( isNew ){ + console.log( isNew ); if ({$regEvent.time_specific.value}) { $('#eventCalendar').fullCalendar({ {if $regEvent} @@ -266,8 +267,13 @@ var app = { fixedWeekCount : false, eventClick: function(calEvent, jsEvent, view) { $('.fc-event').css('background-color', '#3a67ad'); - jQuery('#reg-select-time').val( calEvent.reg_time ); - jQuery('#reg-select-time-display').html( calEvent.start.format('L LT') ); + if ( isNew ) { + jQuery('#add_reg-select-time').val( calEvent.reg_time ); + jQuery('#add_reg-select-time-display').html( calEvent.start.format('L LT') ); + } else { + jQuery('#reg-select-time').val( calEvent.reg_time ); + jQuery('#reg-select-time-display').html( calEvent.start.format('L LT') ); + } $(this).css('background-color', 'red'); } {/if} @@ -283,6 +289,9 @@ var regEvent = ''; var cart = ''; var loginAccount = ''; jQuery(function($){ + {if $isNewCart} + location.reload( true ); + {/if} {if $loginAccount } loginAccount = new app.Models.Front.Account( {$loginAccount} ); {else}