1
0
mirror of https://github.com/invoiceninja/invoiceninja.git synced 2024-11-10 05:02:36 +01:00

Added _id to header/body font properties

This commit is contained in:
Hillel Coren 2016-01-07 09:19:57 +02:00
parent 14192846e8
commit 77f9e89b40
4 changed files with 23 additions and 23 deletions

View File

@ -690,8 +690,8 @@ class AccountController extends BaseController
$account = Auth::user()->account;
$account->hide_quantity = Input::get('hide_quantity') ? true : false;
$account->hide_paid_to_date = Input::get('hide_paid_to_date') ? true : false;
$account->header_font = Input::get('header_font');
$account->body_font = Input::get('body_font');
$account->header_font_id = Input::get('header_font_id');
$account->body_font_id = Input::get('body_font_id');
$account->primary_color = Input::get('primary_color');
$account->secondary_color = Input::get('secondary_color');
$account->invoice_design_id = Input::get('invoice_design_id');

View File

@ -899,8 +899,8 @@ class Account extends Eloquent
public function getFontsUrl($protocol = ''){
if ($this->isPro()){
$bodyFont = $this->body_font;
$headerFont = $this->header_font;
$bodyFont = $this->body_font_id;
$headerFont = $this->header_font_id;
}
else{
$bodyFont = DEFAULT_BODY_FONT;
@ -920,15 +920,15 @@ class Account extends Eloquent
}
public function getHeaderFontName(){
return Utils::getFromCache($this->header_font, 'fonts')['name'];
return Utils::getFromCache($this->header_font_id, 'fonts')['name'];
}
public function getBodyFontName(){
return Utils::getFromCache($this->body_font, 'fonts')['name'];
return Utils::getFromCache($this->body_font_id, 'fonts')['name'];
}
public function getHeaderFontCss($include_weight = true){
$font_data = Utils::getFromCache($this->header_font, 'fonts');
$font_data = Utils::getFromCache($this->header_font_id, 'fonts');
$css = 'font-family:'.$font_data['css_stack'].';';
if($include_weight){
@ -939,7 +939,7 @@ class Account extends Eloquent
}
public function getBodyFontCss($include_weight = true){
$font_data = Utils::getFromCache($this->body_font, 'fonts');
$font_data = Utils::getFromCache($this->body_font_id, 'fonts');
$css = 'font-family:'.$font_data['css_stack'].';';
if($include_weight){
@ -950,7 +950,7 @@ class Account extends Eloquent
}
public function getFonts(){
return array_unique(array($this->header_font, $this->body_font));
return array_unique(array($this->header_font_id, $this->body_font_id));
}
public function getFontsData(){

View File

@ -36,14 +36,14 @@ class AddInvoiceFontSupport extends Migration {
Schema::table('accounts', function($table)
{
$table->unsignedInteger('header_font')->default(1);
$table->unsignedInteger('body_font')->default(1);
$table->unsignedInteger('header_font_id')->default(1);
$table->unsignedInteger('body_font_id')->default(1);
});
Schema::table('accounts', function($table)
{
$table->foreign('header_font')->references('id')->on('fonts');
$table->foreign('body_font')->references('id')->on('fonts');
$table->foreign('header_font_id')->references('id')->on('fonts');
$table->foreign('body_font_id')->references('id')->on('fonts');
});
}
@ -54,21 +54,21 @@ class AddInvoiceFontSupport extends Migration {
*/
public function down()
{
if (Schema::hasColumn('accounts', 'header_font'))
if (Schema::hasColumn('accounts', 'header_font_id'))
{
Schema::table('accounts', function($table)
{
$table->dropForeign('accounts_header_font_foreign');
$table->dropColumn('header_font');
$table->dropColumn('header_font_id');
});
}
if (Schema::hasColumn('accounts', 'body_font'))
if (Schema::hasColumn('accounts', 'body_font_id'))
{
Schema::table('accounts', function($table)
{
$table->dropForeign('accounts_body_font_foreign');
$table->dropColumn('body_font');
$table->dropColumn('body_font_id');
});
}

View File

@ -53,8 +53,8 @@
NINJA.primaryColor = $('#primary_color').val();
NINJA.secondaryColor = $('#secondary_color').val();
NINJA.fontSize = parseInt($('#font_size').val());
NINJA.headerFont = $('#header_font option:selected').text();
NINJA.bodyFont = $('#body_font option:selected').text();
NINJA.headerFont = $('#header_font_id option:selected').text();
NINJA.bodyFont = $('#body_font_id option:selected').text();
var fields = ['item', 'description', 'unit_cost', 'quantity', 'line_total', 'terms'];
invoiceLabels.old = {};
@ -84,8 +84,8 @@
$('#primary_color').spectrum(options);
$('#secondary_color').spectrum(options);
$('#header_font').change(function(){loadFont($('#header_font').val())});
$('#body_font').change(function(){loadFont($('#body_font').val())});
$('#header_font_id').change(function(){loadFont($('#header_font').val())});
$('#body_font_id').change(function(){loadFont($('#body_font').val())});
refreshPDF();
@ -133,10 +133,10 @@
->style('display:inline; width:300px')
->fromQuery($invoiceDesigns, 'name', 'id') !!}
@endif
{!! Former::select('header_font')
{!! Former::select('header_font_id')
->style('display:inline; width:300px')
->fromQuery($invoiceFonts, 'name', 'id') !!}
{!! Former::select('body_font')
{!! Former::select('body_font_id')
->style('display:inline; width:300px')
->fromQuery($invoiceFonts, 'name', 'id') !!}