mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-07-09 03:14:30 -04:00
Added UI setting to enable JS PDF renderer
This commit is contained in:
parent
f182c281fe
commit
d7f22041ab
@ -730,9 +730,27 @@ class AccountController extends BaseController
|
||||
*/
|
||||
private function saveAccountManagement()
|
||||
{
|
||||
$account = Auth::user()->account;
|
||||
$user = Auth::user();
|
||||
$account = $user->account;
|
||||
$modules = Input::get('modules');
|
||||
|
||||
$user->force_pdfjs = Input::get('force_pdfjs') ? true : false;
|
||||
$user->save();
|
||||
|
||||
$account->live_preview = Input::get('live_preview') ? true : false;
|
||||
|
||||
// Automatically disable live preview when using a large font
|
||||
$fonts = Cache::get('fonts')->filter(function($font) use ($account) {
|
||||
if ($font->google_font) {
|
||||
return false;
|
||||
}
|
||||
return $font->id == $account->header_font_id || $font->id == $account->body_font_id;
|
||||
});
|
||||
if ($account->live_preview && count($fonts)) {
|
||||
$account->live_preview = false;
|
||||
Session::flash('warning', trans('texts.live_preview_disabled'));
|
||||
}
|
||||
|
||||
$account->enabled_modules = $modules ? array_sum($modules) : 0;
|
||||
$account->save();
|
||||
|
||||
@ -1045,19 +1063,6 @@ class AccountController extends BaseController
|
||||
$account->invoice_design_id = Input::get('invoice_design_id');
|
||||
$account->font_size = intval(Input::get('font_size'));
|
||||
$account->page_size = Input::get('page_size');
|
||||
$account->live_preview = Input::get('live_preview') ? true : false;
|
||||
|
||||
// Automatically disable live preview when using a large font
|
||||
$fonts = Cache::get('fonts')->filter(function($font) use ($account) {
|
||||
if ($font->google_font) {
|
||||
return false;
|
||||
}
|
||||
return $font->id == $account->header_font_id || $font->id == $account->body_font_id;
|
||||
});
|
||||
if ($account->live_preview && count($fonts)) {
|
||||
$account->live_preview = false;
|
||||
Session::flash('warning', trans('texts.live_preview_disabled'));
|
||||
}
|
||||
|
||||
$labels = [];
|
||||
foreach (['item', 'description', 'unit_cost', 'quantity', 'line_total', 'terms', 'balance_due', 'partial_due', 'subtotal', 'paid_to_date', 'discount', 'tax'] as $field) {
|
||||
|
@ -664,6 +664,8 @@ if (!defined('CONTACT_EMAIL')) {
|
||||
define('OFX_HOME_URL', env('OFX_HOME_URL', 'http://www.ofxhome.com/index.php/home/directory/all'));
|
||||
define('GOOGLE_ANALYITCS_URL', env('GOOGLE_ANALYITCS_URL', 'https://www.google-analytics.com/collect'));
|
||||
define('TRANSIFEX_URL', env('TRANSIFEX_URL', 'https://www.transifex.com/invoice-ninja/invoice-ninja'));
|
||||
define('CHROME_PDF_HELP_URL', 'https://support.google.com/chrome/answer/6213030?hl=en');
|
||||
define('FIREFOX_PDF_HELP_URL', 'https://support.mozilla.org/en-US/kb/view-pdf-files-firefox');
|
||||
|
||||
define('MSBOT_LOGIN_URL', 'https://login.microsoftonline.com/common/oauth2/v2.0/token');
|
||||
define('MSBOT_LUIS_URL', 'https://api.projectoxford.ai/luis/v1/application');
|
||||
|
@ -2252,6 +2252,9 @@ $LANG = array(
|
||||
'update_credit' => 'Update Credit',
|
||||
'updated_credit' => 'Successfully updated credit',
|
||||
'edit_credit' => 'Edit Credit',
|
||||
'live_preview_help' => 'Display a live PDF preview on the invoice page.<br/>Disable this to improve performance when editing invoices.',
|
||||
'force_pdfjs_help' => 'Replace the built-in PDF viewer in :chrome_link or :firefox_link.<br/>Enable this if your browser is automatically downloading the PDF.',
|
||||
'force_pdfjs' => 'PDF Viewer',
|
||||
|
||||
);
|
||||
|
||||
|
@ -120,7 +120,6 @@
|
||||
{!! Former::populateField('invoice_design_id', $account->invoice_design_id) !!}
|
||||
{!! Former::populateField('body_font_id', $account->getBodyFontId()) !!}
|
||||
{!! Former::populateField('header_font_id', $account->getHeaderFontId()) !!}
|
||||
{!! Former::populateField('live_preview', intval($account->live_preview)) !!}
|
||||
{!! Former::populateField('font_size', $account->font_size) !!}
|
||||
{!! Former::populateField('page_size', $account->page_size) !!}
|
||||
{!! Former::populateField('invoice_embed_documents', intval($account->invoice_embed_documents)) !!}
|
||||
@ -175,8 +174,6 @@
|
||||
{!! Former::select('header_font_id')
|
||||
->fromQuery($invoiceFonts, 'name', 'id') !!}
|
||||
|
||||
{!! Former::checkbox('live_preview')->text(trans('texts.enable')) !!}
|
||||
|
||||
</div>
|
||||
<div class="col-md-6">
|
||||
|
||||
|
@ -142,6 +142,9 @@
|
||||
|
||||
|
||||
{!! Former::open('settings/account_management') !!}
|
||||
{!! Former::populateField('live_preview', intval($account->live_preview)) !!}
|
||||
{!! Former::populateField('force_pdfjs', intval(Auth::user()->force_pdfjs)) !!}
|
||||
|
||||
<div class="panel panel-default">
|
||||
<div class="panel-heading">
|
||||
<h3 class="panel-title">{!! trans('texts.modules') !!}</h3>
|
||||
@ -167,6 +170,33 @@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="panel panel-default">
|
||||
<div class="panel-heading">
|
||||
<h3 class="panel-title">{!! trans('texts.pdf_settings') !!}</h3>
|
||||
</div>
|
||||
<div class="panel-body">
|
||||
|
||||
{!! Former::checkbox('live_preview')
|
||||
->text(trans('texts.enable'))
|
||||
->help('live_preview_help') !!}
|
||||
|
||||
{!! Former::checkbox('force_pdfjs')
|
||||
->text(trans('texts.enable'))
|
||||
->help(trans('texts.force_pdfjs_help', [
|
||||
'chrome_link' => link_to(CHROME_PDF_HELP_URL, 'Chrome', ['target' => '_blank']),
|
||||
'firefox_link' => link_to(FIREFOX_PDF_HELP_URL, 'Firefox', ['target' => '_blank']),
|
||||
])) !!}
|
||||
|
||||
<div class="form-group">
|
||||
<label for="modules" class="control-label col-lg-4 col-sm-4"></label>
|
||||
<div class="col-lg-8 col-sm-8">
|
||||
{!! Button::success(trans('texts.save'))->submit()->large()->appendIcon(Icon::create('floppy-disk')) !!}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{!! Former::close() !!}
|
||||
|
||||
{!! Former::open('settings/cancel_account')->addClass('cancel-account') !!}
|
||||
|
Loading…
x
Reference in New Issue
Block a user