Automatically disable live preview when using a large font

This commit is contained in:
Hillel Coren 2016-04-19 14:12:02 +03:00
parent 9f5fe33059
commit cd52faa3bf
2 changed files with 13 additions and 0 deletions

View File

@ -820,6 +820,18 @@ class AccountController extends BaseController
$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'] as $field) {
$labels[$field] = Input::get("labels_{$field}");

View File

@ -1129,6 +1129,7 @@ $LANG = array(
'live_preview' => 'Live Preview',
'page_size' => 'Page Size',
'live_preview_disabled' => 'Live preview has been disabled to support selected font',
);
return $LANG;