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

View File

@@ -42,7 +42,7 @@
<p class="text-info"> <p class="text-info">
{{ 'pref_budget_settings_help'|_ }} {{ 'pref_budget_settings_help'|_ }}
</p> </p>
{{ ExpandedForm.amount('budgetMaximum',budgetMaximum,{'label' : 'Budget maximum'}) }} {{ ExpandedForm.amount('budgetMaximum',budgetMaximum,{'label' : 'budget_maximum'|_}) }}
</div> </div>
</div> </div>
<div class="box"> <div class="box">
@@ -138,6 +138,21 @@
</div> </div>
</div> </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="col-lg-6 col-md-6 col-sm-6">
<div class="box"> <div class="box">
<div class="box-header with-border"> <div class="box-header with-border">