New preference for page size.

This commit is contained in:
James Cole 2016-04-21 08:59:15 +02:00
parent 29fbd46e33
commit b097e29104
2 changed files with 39 additions and 15 deletions

View File

@ -64,25 +64,26 @@ class PreferencesController extends Controller
*/
public function index(ARI $repository)
{
$accounts = $repository->getAccounts(['Default account', 'Asset account']);
$viewRangePref = Preferences::get('viewRange', '1M');
$viewRange = $viewRangePref->data;
$frontPageAccounts = Preferences::get('frontPageAccounts', []);
$budgetMax = Preferences::get('budgetMaximum', 1000);
$language = Preferences::get('language', env('DEFAULT_LANGUAGE', 'en_US'))->data;
$budgetMaximum = $budgetMax->data;
$customFiscalYear = Preferences::get('customFiscalYear', 0)->data;
$fiscalYearStartStr = Preferences::get('fiscalYearStart', '01-01')->data;
$fiscalYearStart = date('Y') . '-' . $fiscalYearStartStr;
$is2faEnabled = Preferences::get('twoFactorAuthEnabled', 0)->data; // twoFactorAuthEnabled
$has2faSecret = !is_null(Preferences::get('twoFactorAuthSecret')); // hasTwoFactorAuthSecret
$showIncomplete = env('SHOW_INCOMPLETE_TRANSLATIONS', false) === true;
$accounts = $repository->getAccounts(['Default account', 'Asset account']);
$viewRangePref = Preferences::get('viewRange', '1M');
$viewRange = $viewRangePref->data;
$frontPageAccounts = Preferences::get('frontPageAccounts', []);
$budgetMax = Preferences::get('budgetMaximum', 1000);
$language = Preferences::get('language', env('DEFAULT_LANGUAGE', 'en_US'))->data;
$budgetMaximum = $budgetMax->data;
$transactionPageSize = Preferences::get('transactionPageSize', 50)->data;
$customFiscalYear = Preferences::get('customFiscalYear', 0)->data;
$fiscalYearStartStr = Preferences::get('fiscalYearStart', '01-01')->data;
$fiscalYearStart = date('Y') . '-' . $fiscalYearStartStr;
$is2faEnabled = Preferences::get('twoFactorAuthEnabled', 0)->data; // twoFactorAuthEnabled
$has2faSecret = !is_null(Preferences::get('twoFactorAuthSecret')); // hasTwoFactorAuthSecret
$showIncomplete = env('SHOW_INCOMPLETE_TRANSLATIONS', false) === true;
return view(
'preferences.index',
compact(
'budgetMaximum', 'language', 'accounts', 'frontPageAccounts',
'viewRange', 'customFiscalYear', 'fiscalYearStart', 'is2faEnabled',
'viewRange', 'customFiscalYear', 'transactionPageSize', 'fiscalYearStart', 'is2faEnabled',
'has2faSecret', 'showIncomplete'
)
);
@ -135,6 +136,14 @@ class PreferencesController extends Controller
Preferences::set('customFiscalYear', $customFiscalYear);
Preferences::set('fiscalYearStart', $fiscalYearStart);
// save page size:
$transactionPageSize = intval(Input::get('transactionPageSize'));
if($transactionPageSize > 0 && $transactionPageSize < 1337) {
Preferences::set('transactionPageSize', $transactionPageSize);
} else {
Preferences::set('transactionPageSize', 50);
}
// two factor auth
$twoFactorAuthEnabled = intval(Input::get('twoFactorAuthEnabled'));
$hasTwoFactorAuthSecret = !is_null(Preferences::get('twoFactorAuthSecret'));

View File

@ -42,7 +42,7 @@
<p class="text-info">
{{ 'pref_budget_settings_help'|_ }}
</p>
{{ ExpandedForm.amount('budgetMaximum',budgetMaximum,{'label' : 'Budget maximum'}) }}
{{ ExpandedForm.amount('budgetMaximum',budgetMaximum,{'label' : 'budget_maximum'|_}) }}
</div>
</div>
<div class="box">
@ -138,6 +138,21 @@
</div>
</div>
</div>
<!-- page size -->
<div class="col-lg-6 col-md-6 col-sm-6 col-xs-6">
<div class="box">
<div class="box-header with-border">
<h3 class="box-title">{{ 'transaction_page_size_title'|_ }}</h3>
</div>
<div class="box-body">
<p class="text-info">{{ 'transaction_page_size_help'|_ }}</p>
{{ ExpandedForm.integer('transactionPageSize',transactionPageSize,{'label' : 'transaction_page_size_label'|_}) }}
</div>
</div>
</div>
<div class="col-lg-6 col-md-6 col-sm-6">
<div class="box">
<div class="box-header with-border">