Minor tweaks

This commit is contained in:
Hillel Coren 2015-06-01 16:06:18 +03:00
parent c419f5dab9
commit 74787804e7
10 changed files with 32 additions and 28 deletions

View File

@ -116,7 +116,6 @@ class AppController extends BaseController
$user = $account->users()->first(); $user = $account->users()->first();
//Auth::login($user, true); //Auth::login($user, true);
$this->accountRepo->registerUser($user);
return Redirect::to('/login'); return Redirect::to('/login');
} }

View File

@ -204,7 +204,7 @@ class PaymentController extends BaseController
$gateway->$function($val); $gateway->$function($val);
} }
if ($accountGateway->gateway->id == GATEWAY_DWOLLA) { if ($accountGateway->gateway->id == GATEWAY_DWOLLA && isset($_ENV['DWOLLA_KEY']) && isset($_ENV['DWOLLA_SECRET'])) {
$gateway->setKeySecret($_ENV['DWOLLA_KEY'], $_ENV['DWOLLA_SECRET']); $gateway->setKeySecret($_ENV['DWOLLA_KEY'], $_ENV['DWOLLA_SECRET']);
} }
@ -444,6 +444,7 @@ class PaymentController extends BaseController
'message' => $affiliate->payment_subtitle, 'message' => $affiliate->payment_subtitle,
'license' => $licenseKey, 'license' => $licenseKey,
'hideHeader' => true, 'hideHeader' => true,
'productId' => $license->product_id
]; ];
$name = "{$license->first_name} {$license->last_name}"; $name = "{$license->first_name} {$license->last_name}";

View File

@ -1,22 +1,25 @@
<?php namespace App\Listeners; <?php namespace App\Listeners;
use Utils;
use Auth; use Auth;
use Carbon; use Carbon;
use App\Events\UserLoggedIn; use App\Events\UserLoggedIn;
use App\Ninja\Repositories\AccountRepository;
use Illuminate\Queue\InteractsWithQueue; use Illuminate\Queue\InteractsWithQueue;
use Illuminate\Contracts\Queue\ShouldBeQueued; use Illuminate\Contracts\Queue\ShouldBeQueued;
class HandleUserLoggedIn { class HandleUserLoggedIn {
protected $accountRepo;
/** /**
* Create the event handler. * Create the event handler.
* *
* @return void * @return void
*/ */
public function __construct() public function __construct(AccountRepository $accountRepo)
{ {
// $this->accountRepo = $accountRepo;
} }
/** /**
@ -26,8 +29,13 @@ class HandleUserLoggedIn {
* @return void * @return void
*/ */
public function handle(UserLoggedIn $event) public function handle(UserLoggedIn $event)
{ {
$account = Auth::user()->account; $account = Auth::user()->account;
if (!Utils::isNinja() && empty($account->last_login)) {
$this->accountRepo->registerUser(Auth::user());
}
$account->last_login = Carbon::now()->toDateTimeString(); $account->last_login = Carbon::now()->toDateTimeString();
$account->save(); $account->save();

View File

@ -48,7 +48,8 @@
@if (in_array($field, $hiddenFields)) @if (in_array($field, $hiddenFields))
{{-- do nothing --}} {{-- do nothing --}}
@elseif ($gateway->id == GATEWAY_DWOLLA && ($field == 'Key' || $field == 'Secret')) @elseif ($gateway->id == GATEWAY_DWOLLA && ($field == 'Key' || $field == 'Secret')
&& isset($_ENV['DWOLLA_KEY']) && isset($_ENV['DWOLLA_SECRET']))
{{-- do nothing --}} {{-- do nothing --}}
@elseif ($field == 'testMode' || $field == 'developerMode' || $field == 'sandbox') @elseif ($field == 'testMode' || $field == 'developerMode' || $field == 'sandbox')
{!! Former::checkbox($gateway->id.'_'.$field)->label(Utils::toSpaceCase($field))->text('Enable')->value('true') !!} {!! Former::checkbox($gateway->id.'_'.$field)->label(Utils::toSpaceCase($field))->text('Enable')->value('true') !!}

View File

@ -85,11 +85,9 @@
{!! Former::populate($account) !!} {!! Former::populate($account) !!}
{!! Former::populateField('hide_quantity', intval($account->hide_quantity)) !!} {!! Former::populateField('hide_quantity', intval($account->hide_quantity)) !!}
{!! Former::populateField('hide_paid_to_date', intval($account->hide_paid_to_date)) !!} {!! Former::populateField('hide_paid_to_date', intval($account->hide_paid_to_date)) !!}
@if ($invoiceLabels)
@foreach ($invoiceLabels as $field => $value) @foreach ($invoiceLabels as $field => $value)
{!! Former::populateField("labels_{$field}", $value) !!} {!! Former::populateField("labels_{$field}", $value) !!}
@endforeach @endforeach
@endif
<div class="panel panel-default"> <div class="panel panel-default">
<div class="panel-heading"> <div class="panel-heading">

View File

@ -106,7 +106,7 @@
success: function(result) { success: function(result) {
if (result) { if (result) {
localStorage.setItem('guest_key', ''); localStorage.setItem('guest_key', '');
trackUrl('/signed_up'); trackEvent('/account', '/signed_up');
NINJA.isRegistered = true; NINJA.isRegistered = true;
$('#signUpButton').hide(); $('#signUpButton').hide();
$('#myAccountButton').html(result); $('#myAccountButton').html(result);
@ -150,7 +150,7 @@
@if (Auth::check() && !Auth::user()->isPro()) @if (Auth::check() && !Auth::user()->isPro())
function submitProPlan(feature) { function submitProPlan(feature) {
trackUrl('/submit_pro_plan/' + feature); trackEvent('/account', '/submit_pro_plan/' + feature);
if (NINJA.isRegistered) { if (NINJA.isRegistered) {
$('#proPlanDiv, #proPlanFooter').hide(); $('#proPlanDiv, #proPlanFooter').hide();
$('#proPlanWorking').show(); $('#proPlanWorking').show();
@ -263,7 +263,7 @@
validateSignUp(); validateSignUp();
$('#signUpModal').on('shown.bs.modal', function () { $('#signUpModal').on('shown.bs.modal', function () {
trackUrl('/view_sign_up'); trackEvent('/account', '/view_sign_up');
$(['first_name','last_name','email','password']).each(function(i, field) { $(['first_name','last_name','email','password']).each(function(i, field) {
var $input = $('form.signUpForm #new_'+field); var $input = $('form.signUpForm #new_'+field);
if (!$input.val()) { if (!$input.val()) {

View File

@ -760,7 +760,7 @@
} }
function onDownloadClick() { function onDownloadClick() {
trackUrl('/download_pdf'); trackEvent('/activity', '/download_pdf');
var invoice = createInvoiceModel(); var invoice = createInvoiceModel();
var design = getDesignJavascript(); var design = getDesignJavascript();
if (!design) return; if (!design) return;
@ -1043,7 +1043,7 @@
} }
self.showClientForm = function() { self.showClientForm = function() {
trackUrl('/view_client_form'); trackEvent('/activity', '/view_client_form');
self.clientBackup = ko.mapping.toJS(self.invoice().client); self.clientBackup = ko.mapping.toJS(self.invoice().client);
$('#emailError').css( "display", "none" ); $('#emailError').css( "display", "none" );
@ -1051,7 +1051,7 @@
} }
self.clientFormComplete = function() { self.clientFormComplete = function() {
trackUrl('/save_client_form'); trackEvent('/activity', '/save_client_form');
var email = $('#email0').val(); var email = $('#email0').val();
var firstName = $('#first_name').val(); var firstName = $('#first_name').val();

View File

@ -120,7 +120,7 @@
} }
function showMoreDesigns() { function showMoreDesigns() {
trackUrl('/view_more_designs'); trackEvent('/account', '/view_more_designs');
$('#moreDesignsModal').modal('show'); $('#moreDesignsModal').modal('show');
} }

View File

@ -79,10 +79,6 @@
<!-- End Google Tag Manager --> <!-- End Google Tag Manager -->
<script> <script>
function trackUrl(url) {
url = '/track' + url.replace('http:/', '');
dataLayer.push({'event':url, 'eventLabel':this.src});
}
function trackEvent(category, action) {} function trackEvent(category, action) {}
</script> </script>
@elseif (isset($_ENV['ANALYTICS_KEY']) && $_ENV['ANALYTICS_KEY']) @elseif (isset($_ENV['ANALYTICS_KEY']) && $_ENV['ANALYTICS_KEY'])
@ -95,19 +91,12 @@
ga('create', '{{ $_ENV['ANALYTICS_KEY'] }}', 'auto'); ga('create', '{{ $_ENV['ANALYTICS_KEY'] }}', 'auto');
ga('send', 'pageview'); ga('send', 'pageview');
function trackUrl(url) {
url = '/track' + url.replace('http:/', '');
ga('send', 'pageview', url);
}
function trackEvent(category, action) { function trackEvent(category, action) {
ga('send', 'event', category, action, this.src); ga('send', 'event', category, action, this.src);
} }
</script> </script>
@else @else
<script> <script>
function trackUrl(url) {}
function trackEvent(category, action) {} function trackEvent(category, action) {}
</script> </script>
@endif @endif
@ -132,7 +121,7 @@
} }
}); });
function openUrl(url, track) { function openUrl(url, track) {
trackUrl(track ? track : url); trackEvent('/view_link', track ? track : url);
window.open(url, '_blank'); window.open(url, '_blank');
} }

View File

@ -98,4 +98,12 @@ header h3 em {
</div> </div>
<script type="text/javascript">
$(function() {
trackEvent('license', 'product_{{ $productId }}');
})
</script>
@stop @stop