Update version and API.

This commit is contained in:
James Cole
2020-07-12 17:34:06 +02:00
parent c4979bdd27
commit da77bcde04
4 changed files with 43 additions and 7 deletions

View File

@@ -118,9 +118,9 @@ class IndexController extends Controller
/**
* @return \Illuminate\Contracts\Foundation\Application|Factory|View
*/
public function emptyIndex()
public function emptyIndex(?string $objectType = null)
{
return view('accounts.empty-index');
return view('accounts.empty-index', compact('objectType'));
}
/**
@@ -133,6 +133,11 @@ class IndexController extends Controller
*/
public function index(Request $request, string $objectType)
{
// temp catch for layout.
if ('v2' === config('firefly.layout')) {
return $this->emptyIndex($objectType);
}
$objectType = $objectType ?? 'asset';
$subTitle = (string) trans(sprintf('firefly.%s_accounts', $objectType));
$subTitleIcon = config(sprintf('firefly.subIconsByIdentifier.%s', $objectType));

View File

@@ -75,6 +75,7 @@ class ShowController extends Controller
}
/**
* Show an account.
*
@@ -89,6 +90,13 @@ class ShowController extends Controller
*/
public function show(Request $request, Account $account, Carbon $start = null, Carbon $end = null)
{
$objectType = config(sprintf('firefly.shortNamesByFullName.%s', $account->accountType->type));
// temp catch for layout.
if ('v2' === config('firefly.layout')) {
return view('accounts.empty-index', compact('objectType'));
}
if (!$this->isEditableAccount($account)) {
return $this->redirectAccountToAccount($account); // @codeCoverageIgnore
}
@@ -103,7 +111,6 @@ class ShowController extends Controller
}
$location = $this->repository->getLocation($account);
$attachments = $this->repository->getAttachments($account);
$objectType = config(sprintf('firefly.shortNamesByFullName.%s', $account->accountType->type));
$today = new Carbon;
$subTitleIcon = config(sprintf('firefly.subIconsByIdentifier.%s', $account->accountType->type));
$page = (int) $request->get('page');