mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2024-11-08 20:22:42 +01:00
Reorganize Client Portal Fonts/CSS to allow styling client auth screens
This commit is contained in:
parent
7ce06a28e9
commit
fb749092b2
@ -32,17 +32,6 @@ class AuthController extends Controller
|
||||
'clientauth' => true,
|
||||
];
|
||||
|
||||
$contactKey = session('contact_key');
|
||||
if ($contactKey) {
|
||||
$contact = Contact::where('contact_key', '=', $contactKey)->first();
|
||||
if ($contact && ! $contact->is_deleted) {
|
||||
$account = $contact->account;
|
||||
|
||||
$data['account'] = $account;
|
||||
$data['clientFontUrl'] = $account->getFontsUrl();
|
||||
}
|
||||
}
|
||||
|
||||
return view('clientauth.login')->with($data);
|
||||
}
|
||||
|
||||
|
@ -52,14 +52,7 @@ class PasswordController extends Controller
|
||||
'clientauth' => true,
|
||||
];
|
||||
$contactKey = session('contact_key');
|
||||
if ($contactKey) {
|
||||
$contact = Contact::where('contact_key', '=', $contactKey)->first();
|
||||
if ($contact && ! $contact->is_deleted) {
|
||||
$account = $contact->account;
|
||||
$data['account'] = $account;
|
||||
$data['clientFontUrl'] = $account->getFontsUrl();
|
||||
}
|
||||
} else {
|
||||
if (!$contactKey) {
|
||||
return \Redirect::to('/client/sessionexpired');
|
||||
}
|
||||
|
||||
@ -136,10 +129,7 @@ class PasswordController extends Controller
|
||||
}
|
||||
}
|
||||
|
||||
if (! empty($account)) {
|
||||
$data['account'] = $account;
|
||||
$data['clientFontUrl'] = $account->getFontsUrl();
|
||||
} else {
|
||||
if ( empty($account)) {
|
||||
return \Redirect::to('/client/sessionexpired');
|
||||
}
|
||||
}
|
||||
|
@ -131,7 +131,6 @@ class ClientPortalController extends BaseController
|
||||
'account' => $account,
|
||||
'showApprove' => $showApprove,
|
||||
'showBreadcrumbs' => false,
|
||||
'clientFontUrl' => $account->getFontsUrl(),
|
||||
'invoice' => $invoice->hidePrivateFields(),
|
||||
'invitation' => $invitation,
|
||||
'invoiceLabels' => $account->getInvoiceLabels(),
|
||||
@ -252,7 +251,6 @@ class ClientPortalController extends BaseController
|
||||
'contact' => $contact,
|
||||
'account' => $account,
|
||||
'client' => $client,
|
||||
'clientFontUrl' => $account->getFontsUrl(),
|
||||
'gateway' => $account->getTokenGateway(),
|
||||
'paymentMethods' => $customer ? $customer->payment_methods : false,
|
||||
'transactionToken' => $paymentDriver ? $paymentDriver->createTransactionToken() : false,
|
||||
@ -318,7 +316,6 @@ class ClientPortalController extends BaseController
|
||||
'color' => $color,
|
||||
'account' => $account,
|
||||
'client' => $contact->client,
|
||||
'clientFontUrl' => $account->getFontsUrl(),
|
||||
'title' => trans('texts.recurring_invoices'),
|
||||
'entityType' => ENTITY_RECURRING_INVOICE,
|
||||
'columns' => Utils::trans(['frequency', 'start_date', 'end_date', 'invoice_total', 'auto_bill']),
|
||||
@ -346,7 +343,6 @@ class ClientPortalController extends BaseController
|
||||
'color' => $color,
|
||||
'account' => $account,
|
||||
'client' => $contact->client,
|
||||
'clientFontUrl' => $account->getFontsUrl(),
|
||||
'title' => trans('texts.invoices'),
|
||||
'entityType' => ENTITY_INVOICE,
|
||||
'columns' => Utils::trans(['invoice_number', 'invoice_date', 'invoice_total', 'balance_due', 'due_date']),
|
||||
@ -391,7 +387,6 @@ class ClientPortalController extends BaseController
|
||||
$data = [
|
||||
'color' => $color,
|
||||
'account' => $account,
|
||||
'clientFontUrl' => $account->getFontsUrl(),
|
||||
'entityType' => ENTITY_PAYMENT,
|
||||
'title' => trans('texts.payments'),
|
||||
'columns' => Utils::trans(['invoice', 'transaction_reference', 'method', 'payment_amount', 'payment_date', 'status']),
|
||||
@ -476,7 +471,6 @@ class ClientPortalController extends BaseController
|
||||
$data = [
|
||||
'color' => $color,
|
||||
'account' => $account,
|
||||
'clientFontUrl' => $account->getFontsUrl(),
|
||||
'title' => trans('texts.quotes'),
|
||||
'entityType' => ENTITY_QUOTE,
|
||||
'columns' => Utils::trans(['quote_number', 'quote_date', 'quote_total', 'due_date']),
|
||||
@ -512,7 +506,6 @@ class ClientPortalController extends BaseController
|
||||
$data = [
|
||||
'color' => $color,
|
||||
'account' => $account,
|
||||
'clientFontUrl' => $account->getFontsUrl(),
|
||||
'title' => trans('texts.credits'),
|
||||
'entityType' => ENTITY_CREDIT,
|
||||
'columns' => Utils::trans(['credit_date', 'credit_amount', 'credit_balance']),
|
||||
@ -548,7 +541,6 @@ class ClientPortalController extends BaseController
|
||||
$data = [
|
||||
'color' => $color,
|
||||
'account' => $account,
|
||||
'clientFontUrl' => $account->getFontsUrl(),
|
||||
'title' => trans('texts.documents'),
|
||||
'entityType' => ENTITY_DOCUMENT,
|
||||
'columns' => Utils::trans(['invoice_number', 'name', 'document_date', 'document_size']),
|
||||
@ -757,8 +749,6 @@ class ClientPortalController extends BaseController
|
||||
'contact' => $contact,
|
||||
'color' => $account->primary_color ? $account->primary_color : '#0b4d78',
|
||||
'client' => $client,
|
||||
'clientViewCSS' => $account->clientViewCSS(),
|
||||
'clientFontUrl' => $account->getFontsUrl(),
|
||||
'paymentMethods' => $customer ? $customer->payment_methods : false,
|
||||
'gateway' => $account->getTokenGateway(),
|
||||
'title' => trans('texts.payment_methods'),
|
||||
|
@ -102,6 +102,46 @@ class Utils
|
||||
return self::getResllerType() ? true : false;
|
||||
}
|
||||
|
||||
public static function clientViewCSS()
|
||||
{
|
||||
$account = false;
|
||||
|
||||
if (Auth::check()) {
|
||||
$account = Auth::user()->account;
|
||||
} elseif ($contactKey = session('contact_key')) {
|
||||
if ($contact = \App\Models\Contact::whereContactKey($contactKey)->first()) {
|
||||
$account = $contact->account;
|
||||
}
|
||||
}
|
||||
|
||||
if ( !$account && ! self::isNinja()) {
|
||||
// For self-hosted accounts, pick the first account
|
||||
$account = \App\Models\Account::first();
|
||||
}
|
||||
|
||||
return $account ? $account->clientViewCSS() : '';
|
||||
}
|
||||
|
||||
public static function getAccountFontsUrl($protocol = '')
|
||||
{
|
||||
$account = false;
|
||||
|
||||
if (Auth::check()) {
|
||||
$account = Auth::user()->account;
|
||||
} elseif ($contactKey = session('contact_key')) {
|
||||
if ($contact = \App\Models\Contact::whereContactKey($contactKey)->first()) {
|
||||
$account = $contact->account;
|
||||
}
|
||||
}
|
||||
|
||||
if ( !$account && ! self::isNinja()) {
|
||||
// For self-hosted accounts, pick the first account
|
||||
$account = \App\Models\Account::first();
|
||||
}
|
||||
|
||||
return $account ? $account->getFontsUrl($protocol) : false;
|
||||
}
|
||||
|
||||
public static function isWhiteLabel()
|
||||
{
|
||||
$account = false;
|
||||
|
@ -166,7 +166,6 @@ class BasePaymentDriver
|
||||
'currencyCode' => $this->client()->getCurrencyCode(),
|
||||
'account' => $this->account(),
|
||||
'sourceId' => $sourceId,
|
||||
'clientFontUrl' => $this->account()->getFontsUrl(),
|
||||
'tokenize' => $this->tokenize(),
|
||||
'transactionToken' => $this->createTransactionToken(),
|
||||
];
|
||||
|
@ -3,6 +3,6 @@
|
||||
<div class="form-signin">
|
||||
<h2 class="form-signin-heading">{{ trans('texts.session_expired') }}</h2>
|
||||
<hr class="green">
|
||||
<h4><center>{{ trans('texts.client_session_expired_message') }}</center></h4>
|
||||
<div><center>{{ trans('texts.client_session_expired_message') }}</center></div>
|
||||
</div>
|
||||
@endsection
|
@ -3,7 +3,9 @@
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
||||
<!--[if !mso]><!-- -->
|
||||
<link href="{{ isset($account) ? $account->getFontsUrl('http') : '' }}" rel="stylesheet" type="text/css" />
|
||||
@if($fontsUrl = Utils::getAccountFontsUrl())
|
||||
<link href="{{ $fontsUrl }}" rel="stylesheet" type="text/css" />
|
||||
@endif
|
||||
<!--<![endif]-->
|
||||
</head>
|
||||
<body style="color: #000000;{!! isset($account) ? $account->getBodyFontCss() : '' !!}font-size: 12px; -webkit-text-size-adjust: none; -ms-text-size-adjust: none; background: #F4F5F5; margin: 0; padding: 0;"
|
||||
|
@ -1,18 +1,18 @@
|
||||
@extends('master')
|
||||
|
||||
@section('head')
|
||||
@if (!empty($clientauth) && !empty($clientFontUrl))
|
||||
<link href="{!! $clientFontUrl !!}" rel="stylesheet" type="text/css">
|
||||
@if (!empty($clientauth) && $fontsUrl = Utils::getAccountFontsUrl())
|
||||
<link href="{!! $fontsUrl !!}" rel="stylesheet" type="text/css">
|
||||
@endif
|
||||
<link href="{{ asset('css/built.public.css') }}?no_cache={{ NINJA_VERSION }}" rel="stylesheet" type="text/css"/>
|
||||
|
||||
@if (!empty($clientauth) && !empty($account))
|
||||
<style type="text/css">{!! $account->clientViewCSS() !!}</style>
|
||||
@endif
|
||||
|
||||
<link href="{{ asset('css/bootstrap.min.css') }}" rel="stylesheet" type="text/css"/>
|
||||
<link href="{{ asset('css/built.css') }}" rel="stylesheet" type="text/css"/>
|
||||
<link href="{{ asset('css/built.login.css') }}" rel="stylesheet" type="text/css"/>
|
||||
|
||||
@if (!empty($clientauth))
|
||||
<style type="text/css">{!! Utils::clientViewCSS() !!}</style>
|
||||
@endif
|
||||
@endsection
|
||||
|
||||
@section('body')
|
||||
|
@ -5,7 +5,7 @@
|
||||
<link href="{!! $clientFontUrl !!}" rel="stylesheet" type="text/css">
|
||||
@endif
|
||||
<link href="{{ asset('css/built.public.css') }}?no_cache={{ NINJA_VERSION }}" rel="stylesheet" type="text/css"/>
|
||||
<style type="text/css">{!! isset($account)?$account->clientViewCSS():'' !!}</style>
|
||||
<style type="text/css">{!! Utils::clientViewCSS() !!}</style>
|
||||
@stop
|
||||
|
||||
@section('body')
|
||||
|
Loading…
Reference in New Issue
Block a user