Bug fixes

This commit is contained in:
Hillel Coren 2014-04-22 23:10:14 +03:00
parent 4a7432cc41
commit b11ab39a9f
13 changed files with 74 additions and 18 deletions

View File

@ -701,6 +701,8 @@ class AccountController extends \BaseController {
Session::set(REQUESTED_PRO_PLAN, true); Session::set(REQUESTED_PRO_PLAN, true);
} }
Session::set(SESSION_COUNTER, -1);
return "{$user->first_name} {$user->last_name}"; return "{$user->first_name} {$user->last_name}";
} }
} }

View File

@ -13,6 +13,9 @@
App::before(function($request) App::before(function($request)
{ {
$count = Session::get(SESSION_COUNTER, 0);
Session::put(SESSION_COUNTER, ++$count);
if (App::environment() == ENV_PRODUCTION) if (App::environment() == ENV_PRODUCTION)
{ {
if (!Request::secure()) if (!Request::secure())

View File

@ -71,6 +71,10 @@ return array(
"unique" => ":attribute ist schon vergeben.", "unique" => ":attribute ist schon vergeben.",
"url" => "Das Format von :attribute ist ungültig.", "url" => "Das Format von :attribute ist ungültig.",
"positive" => "The :attribute must be greater than zero.",
"has_credit" => "The client does not have enough credit.",
"notmasked" => "The values are masked",
/* /*
|-------------------------------------------------------------------------- |--------------------------------------------------------------------------
| Custom Validation Language Lines | Custom Validation Language Lines

View File

@ -323,7 +323,7 @@ return array(
'field_label' => 'Field Label', 'field_label' => 'Field Label',
'field_value' => 'Field Value', 'field_value' => 'Field Value',
'edit' => 'Edit', 'edit' => 'Edit',
'set_name' => 'Set your company name',

View File

@ -71,7 +71,7 @@ return array(
"positive" => "The :attribute must be greater than zero.", "positive" => "The :attribute must be greater than zero.",
"has_credit" => "The client does not have enough credit.", "has_credit" => "The client does not have enough credit.",
"notmasked" => "The values are masked",
/* /*
|-------------------------------------------------------------------------- |--------------------------------------------------------------------------

View File

@ -73,6 +73,10 @@ return array(
"positive" => ":attribute debe ser mayor que cero.", "positive" => ":attribute debe ser mayor que cero.",
"has_credit" => "el cliente no tiene crédito suficiente.", "has_credit" => "el cliente no tiene crédito suficiente.",
"positive" => "The :attribute must be greater than zero.",
"has_credit" => "The client does not have enough credit.",
"notmasked" => "The values are masked",
/* /*
|-------------------------------------------------------------------------- |--------------------------------------------------------------------------

View File

@ -71,6 +71,10 @@ return array(
"unique" => "La valeur du champ :attribute est déjà utilisée.", "unique" => "La valeur du champ :attribute est déjà utilisée.",
"url" => "Le format de l'URL de :attribute n'est pas valide.", "url" => "Le format de l'URL de :attribute n'est pas valide.",
"positive" => "The :attribute must be greater than zero.",
"has_credit" => "The client does not have enough credit.",
"notmasked" => "The values are masked",
/* /*
|-------------------------------------------------------------------------- |--------------------------------------------------------------------------
| Custom Validation Language Lines | Custom Validation Language Lines

View File

@ -70,6 +70,10 @@ return array(
"unique" => ":attribute è stato già utilizzato.", "unique" => ":attribute è stato già utilizzato.",
"url" => ":attribute deve essere un URL.", "url" => ":attribute deve essere un URL.",
"positive" => "The :attribute must be greater than zero.",
"has_credit" => "The client does not have enough credit.",
"notmasked" => "The values are masked",
/* /*
|-------------------------------------------------------------------------- |--------------------------------------------------------------------------
| Custom Validation Language Lines | Custom Validation Language Lines

View File

@ -74,6 +74,10 @@ return array(
"positive" => ":attribute moet groter zijn dan nul.", "positive" => ":attribute moet groter zijn dan nul.",
"has_credit" => "De klant heeft niet voldoende krediet.", "has_credit" => "De klant heeft niet voldoende krediet.",
"positive" => "The :attribute must be greater than zero.",
"has_credit" => "The client does not have enough credit.",
"notmasked" => "The values are masked",
/* /*
|-------------------------------------------------------------------------- |--------------------------------------------------------------------------
| Custom Validation Language Lines | Custom Validation Language Lines

View File

@ -72,6 +72,10 @@ return array(
"positive" => ":attribute deve ser maior que zero.", "positive" => ":attribute deve ser maior que zero.",
"has_credit" => "O cliente não possui crédito suficiente.", "has_credit" => "O cliente não possui crédito suficiente.",
"positive" => "The :attribute must be greater than zero.",
"has_credit" => "The client does not have enough credit.",
"notmasked" => "The values are masked",
/* /*
|-------------------------------------------------------------------------- |--------------------------------------------------------------------------

View File

@ -114,12 +114,32 @@ class User extends ConfideUser implements UserInterface, RemindableInterface
return !$this->theme_id || in_array($this->theme_id, [2, 3, 5, 6, 7, 8, 10, 11, 12]); return !$this->theme_id || in_array($this->theme_id, [2, 3, 5, 6, 7, 8, 10, 11, 12]);
} }
public function showSignUpPopOver() public function getRequestsCount()
{ {
$count = Session::get(SESSION_COUNTER, 0); return Session::get(SESSION_COUNTER, 0);
Session::put(SESSION_COUNTER, ++$count); }
return $count == 1 || $count % 7 == 0; public function getPopOverText()
{
if (!Auth::check())
{
return false;
}
$count = self::getRequestsCount();
if ($count == 1 || $count % 5 == 0)
{
if (!Utils::isRegistered())
{
return trans('texts.sign_up_to_save');
}
else if (!Auth::user()->account->name)
{
return trans('texts.set_name');
}
}
return false;
} }
public function afterSave($success=true, $forced = false) public function afterSave($success=true, $forced = false)

View File

@ -108,32 +108,29 @@
<div class="navbar-form navbar-right"> <div class="navbar-form navbar-right">
@if (Auth::check() && !Auth::user()->registered) @if (Auth::check() && !Auth::user()->registered)
{{ Button::sm_success_primary(trans('texts.sign_up'), array('id' => 'signUpButton', 'data-toggle'=>'modal', 'data-target'=>'#signUpModal')) }} &nbsp; {{ Button::sm_success_primary(trans('texts.sign_up'), array('id' => 'signUpButton', 'data-toggle'=>'modal', 'data-target'=>'#signUpModal')) }} &nbsp;
@endif
@if (Auth::check() && Auth::user()->showSignUpPopOver()) @if (Auth::user()->getPopOverText() && !Utils::isRegistered())
<button id="signUpPopOver" type="button" class="btn btn-default" data-toggle="popover" data-placement="bottom" data-content="{{ trans('texts.sign_up_to_save') }}" data-html="true" style="display:none"> <button id="ninjaPopOver" type="button" class="btn btn-default" data-toggle="popover" data-placement="bottom" data-content="{{ Auth::user()->getPopOverText() }}" data-html="true" style="display:none">
{{ trans('texts.sign_up') }} {{ trans('texts.sign_up') }}
</button> </button>
@endif
@if (Auth::user()->getPopOverText())
<script> <script>
$(function() { $(function() {
$('#signUpPopOver').show().popover('show').hide(); $('#ninjaPopOver').show().popover('show').hide();
$('body').click(function() { $('body').click(function() {
$('#signUpPopOver').popover('hide'); $('#ninjaPopOver').popover('hide');
}); });
}); });
</script> </script>
@endif @endif
@endif
<div class="btn-group"> <div class="btn-group">
<button type="button" class="btn btn-default btn-sm dropdown-toggle" data-toggle="dropdown"> <button type="button" class="btn btn-default btn-sm dropdown-toggle" data-toggle="dropdown">
<span id="myAccountButton"> <span id="myAccountButton">
@if (Auth::user()->registered) {{ Auth::user()->getDisplayName() }}
{{ Auth::user()->getFullName() }}
@else
{{ trans('texts.guest') }}
@endif
</span> </span>
<span class="caret"></span> <span class="caret"></span>
</button> </button>
@ -148,6 +145,16 @@
<li>{{ link_to('#', trans('texts.logout'), array('onclick'=>'logout()')) }}</li> <li>{{ link_to('#', trans('texts.logout'), array('onclick'=>'logout()')) }}</li>
</ul> </ul>
</div> </div>
@if (Auth::user()->getPopOverText() && Utils::isRegistered())
<button id="ninjaPopOver" type="button" class="btn btn-default" data-toggle="popover" data-placement="bottom" data-content="{{ Auth::user()->getPopOverText() }}" data-html="true" style="display:none">
{{ Auth::user()->getDisplayName() }}
</button>
@endif
</div> </div>

View File

@ -30,7 +30,7 @@
<script type="text/javascript"> <script type="text/javascript">
var NINJA = NINJA || {}; var NINJA = NINJA || {};
NINJA.isRegistered = {{ Utils::isRegistered() ? 'true' : 'false' }}; NINJA.isRegistered = {{ Utils::isRegistered() ? 'true' : 'false' }};
window.onerror = function(e) { window.onerror = function(e) {
try { try {
$.ajax({ $.ajax({