1
0
mirror of https://github.com/invoiceninja/invoiceninja.git synced 2024-11-08 12:12:48 +01:00

Support testing PhantomJS

This commit is contained in:
Hillel Coren 2018-03-05 12:29:46 +02:00
parent 638561c835
commit 54353563f9
4 changed files with 21 additions and 16 deletions

View File

@ -5,6 +5,7 @@ namespace App\Http\Controllers;
use App\Events\UserSettingsChanged;
use App\Models\Account;
use App\Models\Industry;
use App\Models\Invoice;
use App\Ninja\Mailers\Mailer;
use App\Ninja\Repositories\AccountRepository;
use App\Services\EmailService;
@ -425,4 +426,17 @@ class AppController extends BaseController
return json_encode($data);
}
public function testHeadless()
{
$invoice = Invoice::scope()->first();
if (! $invoice) {
dd('Please create an invoice to run this test');
}
header('Content-type:application/pdf');
echo $invoice->getPDFString();
exit;
}
}

View File

@ -45,15 +45,6 @@ class UserController extends BaseController
return $this->userService->getDatatable(Auth::user()->account_id);
}
public function setTheme()
{
$user = User::find(Auth::user()->id);
$user->theme_id = Input::get('theme_id');
$user->save();
return Redirect::to(Input::get('path'));
}
public function forcePDFJS()
{
$user = Auth::user();

View File

@ -48,10 +48,10 @@
{!! Former::checkbox('pdf_email_attachment')
->text(trans('texts.enable'))
->value(1)
->help( ! Utils::isNinja() ? (config('pdf.phantomjs.bin_path') ? (config('pdf.phantomjs.cloud_key') ? 'phantomjs_local_and_cloud' : 'phantomjs_local') : trans('texts.phantomjs_help', [
->help(Utils::isNinjaProd() ? '' : (config('pdf.phantomjs.bin_path') ? (config('pdf.phantomjs.cloud_key') ? trans('texts.phantomjs_local_and_cloud') : trans('texts.phantomjs_local')) : trans('texts.phantomjs_help', [
'link_phantom' => link_to('https://phantomjscloud.com/', 'phantomjscloud.com', ['target' => '_blank']),
'link_docs' => link_to('http://docs.invoiceninja.com/en/latest/configure.html#phantomjs', 'PhantomJS', ['target' => '_blank'])
])) : false) !!}
])) . ' | ' . link_to('/test_headless', trans('texts.test'), ['target' => '_blank'])) !!}
{!! Former::checkbox('document_email_attachment')
->text(trans('texts.enable'))

View File

@ -302,6 +302,7 @@ Route::group([
Route::get('/unlink_account/{user_account_id}/{user_id}', 'UserController@unlinkAccount');
Route::get('/manage_companies', 'UserController@manageCompanies');
Route::get('/errors', 'AppController@errors');
Route::get('/test_headless', 'AppController@testHeadless');
Route::get('api/tokens', 'TokenController@getDatatable');
Route::resource('tokens', 'TokenController');
@ -325,8 +326,6 @@ Route::group([
Route::post('settings/purge_data', 'AccountController@purgeData');
Route::post('settings/company_details', 'AccountController@updateDetails');
Route::post('settings/{section?}', 'AccountController@doSection');
Route::post('user/setTheme', 'UserController@setTheme');
Route::post('remove_logo', 'AccountController@removeLogo');
Route::post('/export', 'ExportController@doExport');
@ -355,9 +354,10 @@ Route::group([
Route::post('bank_accounts/bulk', 'BankAccountController@bulk');
Route::post('bank_accounts/validate', 'BankAccountController@validateAccount');
Route::post('bank_accounts/import_expenses/{bank_id}', 'BankAccountController@importExpenses');
Route::get('self-update', 'SelfUpdateController@index');
Route::post('self-update', 'SelfUpdateController@update');
Route::get('self-update/download', 'SelfUpdateController@download');
//Route::get('self-update', 'SelfUpdateController@index');
//Route::post('self-update', 'SelfUpdateController@update');
//Route::get('self-update/download', 'SelfUpdateController@download');
});
Route::group(['middleware' => ['lookup:user', 'auth:user']], function () {