Allow editing of liabilities.

This commit is contained in:
James Cole
2018-08-05 18:59:15 +02:00
parent 0a89f4000d
commit 33294dd9f0
17 changed files with 228 additions and 107 deletions

View File

@@ -44,23 +44,25 @@ use FireflyIII\Models\TransactionType;
use FireflyIII\User;
use Illuminate\Support\Collection;
/**
* Cuts away the middle of a string when it's very long.
*
* @param string $string
*
* @return string
*/
function limitStringLength(string $string): string
{
$maxChars = 75;
$length = \strlen($string);
$result = $string;
if ($length > $maxChars) {
$result = substr_replace($string, ' ... ', $maxChars / 2, $length - $maxChars);
}
if (!function_exists('limitStringLength')) {
/**
* Cuts away the middle of a string when it's very long.
*
* @param string $string
*
* @return string
*/
function limitStringLength(string $string): string
{
$maxChars = 75;
$length = \strlen($string);
$result = $string;
if ($length > $maxChars) {
$result = substr_replace($string, ' ... ', $maxChars / 2, $length - $maxChars);
}
return $result;
return $result;
}
}
try {
@@ -849,6 +851,14 @@ try {
}
);
Breadcrumbs::register(
'rules.create-from-bill',
function (BreadcrumbsGenerator $breadcrumbs, RuleGroup $ruleGroup = null) {
$breadcrumbs->parent('rules.index');
$breadcrumbs->push(trans('firefly.make_new_rule_no_group'), route('rules.create'));
}
);
Breadcrumbs::register(
'rules.edit',
function (BreadcrumbsGenerator $breadcrumbs, Rule $rule) {
@@ -1033,7 +1043,7 @@ try {
Breadcrumbs::register(
'transactions.show',
function (BreadcrumbsGenerator $breadcrumbs, TransactionJournal $journal) {
$what = strtolower($journal->transactionType->type);
$what = strtolower($journal->transactionType->type);
$title = limitStringLength($journal->description);
$breadcrumbs->parent('transactions.index', $what);

View File

@@ -781,6 +781,7 @@ Route::group(
// create controller
Route::get('create/{ruleGroup?}', ['uses' => 'Rule\CreateController@create', 'as' => 'create']);
Route::get('create-from-bill/{bill}', ['uses' => 'Rule\CreateController@createFromBill', 'as' => 'create-from-bill']);
Route::post('store', ['uses' => 'Rule\CreateController@store', 'as' => 'store']);
// delete controller