Remove references to ExpandedForm.

This commit is contained in:
James Cole 2018-04-29 09:48:53 +02:00
parent 88348f59c2
commit 71b63bd33b
No known key found for this signature in database
GPG Key ID: C16961E655E74B5E
5 changed files with 44 additions and 19 deletions

View File

@ -23,11 +23,9 @@ declare(strict_types=1);
namespace FireflyIII\Http\Controllers;
use Carbon\Carbon;
use ExpandedForm;
use FireflyIII\Http\Requests\RuleGroupFormRequest;
use FireflyIII\Http\Requests\SelectTransactionsRequest;
use FireflyIII\Jobs\ExecuteRuleGroupOnExistingTransactions;
use FireflyIII\Models\AccountType;
use FireflyIII\Models\RuleGroup;
use FireflyIII\Repositories\Account\AccountRepositoryInterface;
use FireflyIII\Repositories\RuleGroup\RuleGroupRepositoryInterface;
@ -75,22 +73,18 @@ class RuleGroupController extends Controller
}
/**
* @param RuleGroupRepositoryInterface $repository
* @param RuleGroup $ruleGroup
* @param RuleGroup $ruleGroup
*
* @return View
*/
public function delete(RuleGroupRepositoryInterface $repository, RuleGroup $ruleGroup)
public function delete(RuleGroup $ruleGroup)
{
$subTitle = trans('firefly.delete_rule_group', ['title' => $ruleGroup->title]);
$ruleGroupList = ExpandedForm::makeSelectListWithEmpty($repository->get());
unset($ruleGroupList[$ruleGroup->id]);
// put previous url in session
$this->rememberPreviousUri('rule-groups.delete.uri');
return view('rules.rule-group.delete', compact('ruleGroup', 'subTitle', 'ruleGroupList'));
return view('rules.rule-group.delete', compact('ruleGroup', 'subTitle'));
}
/**
@ -179,17 +173,17 @@ class RuleGroupController extends Controller
}
/**
* @param RuleGroup $ruleGroup
* @param RuleGroup $ruleGroup
*
* @return View
*/
public function selectTransactions(RuleGroup $ruleGroup)
{
$first = session('first')->format('Y-m-d');
$today = Carbon::create()->format('Y-m-d');
$subTitle = (string)trans('firefly.apply_rule_group_selection', ['title' => $ruleGroup->title]);
$first = session('first')->format('Y-m-d');
$today = Carbon::create()->format('Y-m-d');
$subTitle = (string)trans('firefly.apply_rule_group_selection', ['title' => $ruleGroup->title]);
return view('rules.rule-group.select-transactions', compact( 'first', 'today', 'ruleGroup', 'subTitle'));
return view('rules.rule-group.select-transactions', compact('first', 'today', 'ruleGroup', 'subTitle'));
}
/**

View File

@ -32,6 +32,7 @@ use FireflyIII\Models\TransactionCurrency;
use FireflyIII\Repositories\Account\AccountRepositoryInterface;
use FireflyIII\Repositories\Currency\CurrencyRepositoryInterface;
use FireflyIII\Repositories\RuleGroup\RuleGroupRepositoryInterface;
use Form;
use Illuminate\Support\Collection;
use Illuminate\Support\MessageBag;
use RuntimeException;
@ -49,6 +50,7 @@ class ExpandedForm
*
* @return string
* @throws \FireflyIII\Exceptions\FireflyException
* @throws \Throwable
*/
public function amount(string $name, $value = null, array $options = []): string
{
@ -128,7 +130,7 @@ class ExpandedForm
}
unset($options['class']);
$html = view('form.assetAccountCheckList', compact('classes','selected', 'name', 'label', 'options', 'grouped'))->render();
$html = view('form.assetAccountCheckList', compact('classes', 'selected', 'name', 'label', 'options', 'grouped'))->render();
return $html;
}
@ -545,9 +547,37 @@ class ExpandedForm
foreach ($list as $group) {
$array[$group->id] = $group->title;
}
$res = $this->select($name, $array, $value, $options);
return $res;
return $this->select($name, $array, $value, $options);
}
/**
* @param string $name
* @param null $value
* @param null $options
*
* @return \Illuminate\Support\HtmlString
*/
public function ruleGroupListWithEmpty(string $name, $value = null, $options = null)
{
$options = $options ?? [];
$options['class'] = 'form-control';
/** @var RuleGroupRepositoryInterface $groupRepos */
$groupRepos = app(RuleGroupRepositoryInterface::class);
// get all currencies:
$list = $groupRepos->get();
$array = [
0 => trans('firefly.none_in_select_list'),
];
/** @var RuleGroup $group */
foreach ($list as $group) {
if (isset($options['hidden']) && (int)$options['hidden'] !== $group->id) {
$array[$group->id] = $group->title;
}
}
return Form::select($name, $array, $value, $options);
}
/**

View File

@ -188,7 +188,7 @@ return [
'is_safe' => [
'date', 'text', 'select', 'balance', 'optionsList', 'checkbox', 'amount', 'tags', 'integer', 'textarea', 'location',
'multiRadio', 'file', 'multiCheckbox', 'staticText', 'amountSmall', 'password', 'nonSelectableBalance', 'nonSelectableAmount',
'number', 'assetAccountList','amountNoCurrency','currencyList','ruleGroupList','assetAccountCheckList'
'number', 'assetAccountList','amountNoCurrency','currencyList','ruleGroupList','assetAccountCheckList','ruleGroupListWithEmpty'
],
],
'Form' => [

View File

@ -179,6 +179,7 @@ return [
'authorization_request_intro' => '<strong>:client</strong> is requesting permission to access your financial administration. Would you like to authorize <strong>:client</strong> to access these records?',
'scopes_will_be_able' => 'This application will be able to:',
'button_authorize' => 'Authorize',
'none_in_select_list' => '(none)',
// check for updates:
'update_check_title' => 'Check for updates',

View File

@ -35,7 +35,7 @@
</p>
<p>
{{ Form.select('move_rules_before_delete', ruleGroupList, null, {class: 'form-control'}) }}
{{ ExpandedForm.ruleGroupListWithEmpty('move_rules_before_delete',null, {'hidden': ruleGroup.id}) }}
</p>
{% else %}
<input type="hidden" name="move_rules_before_delete" value="0"/>