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();
//Auth::login($user, true);
$this->accountRepo->registerUser($user);
return Redirect::to('/login');
}

View File

@ -204,7 +204,7 @@ class PaymentController extends BaseController
$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']);
}
@ -444,6 +444,7 @@ class PaymentController extends BaseController
'message' => $affiliate->payment_subtitle,
'license' => $licenseKey,
'hideHeader' => true,
'productId' => $license->product_id
];
$name = "{$license->first_name} {$license->last_name}";

View File

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

View File

@ -48,7 +48,8 @@
@if (in_array($field, $hiddenFields))
{{-- 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 --}}
@elseif ($field == 'testMode' || $field == 'developerMode' || $field == 'sandbox')
{!! Former::checkbox($gateway->id.'_'.$field)->label(Utils::toSpaceCase($field))->text('Enable')->value('true') !!}

View File

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

View File

@ -106,7 +106,7 @@
success: function(result) {
if (result) {
localStorage.setItem('guest_key', '');
trackUrl('/signed_up');
trackEvent('/account', '/signed_up');
NINJA.isRegistered = true;
$('#signUpButton').hide();
$('#myAccountButton').html(result);
@ -150,7 +150,7 @@
@if (Auth::check() && !Auth::user()->isPro())
function submitProPlan(feature) {
trackUrl('/submit_pro_plan/' + feature);
trackEvent('/account', '/submit_pro_plan/' + feature);
if (NINJA.isRegistered) {
$('#proPlanDiv, #proPlanFooter').hide();
$('#proPlanWorking').show();
@ -263,7 +263,7 @@
validateSignUp();
$('#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) {
var $input = $('form.signUpForm #new_'+field);
if (!$input.val()) {

View File

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

View File

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

View File

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

View File

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