Update version and API.

This commit is contained in:
James Cole 2020-07-12 17:34:06 +02:00
parent c4979bdd27
commit da77bcde04
No known key found for this signature in database
GPG Key ID: B5669F9493CDE38D
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');

View File

@ -60,6 +60,7 @@ class General extends AbstractExtension
$this->activeRouteStrict(),
$this->activeRoutePartial(),
$this->activeRoutePartialObjectType(),
$this->menuOpenRoutePartial(),
$this->formatDate(),
$this->getMetaField(),
$this->hasRole(),
@ -89,9 +90,32 @@ class General extends AbstractExtension
);
}
/**
* Will return "menu-open" when a part of the route matches the argument.
* ie. "accounts" will match "accounts.index".
*
* @return TwigFunction
*/
protected function menuOpenRoutePartial(): TwigFunction
{
return new TwigFunction(
'menuOpenRoutePartial',
static function (): string {
$args = func_get_args();
$route = $args[0]; // name of the route.
$name = Route::getCurrentRoute()->getName() ?? '';
if (!(false === strpos($name, $route))) {
return 'menu-open';
}
return '';
}
);
}
/**
* This function will return "active" when the current route matches the first argument (even partly)
* but, the variable $what has been set and matches the second argument.
* but, the variable $objectType has been set and matches the second argument.
*
* @return TwigFunction
*/

View File

@ -143,8 +143,8 @@ return [
],
//'encryption' => null === env('USE_ENCRYPTION') || true === env('USE_ENCRYPTION'),
'version' => '5.3.0',
'api_version' => '1.2.0',
'version' => '5.3.1',
'api_version' => '1.3.0',
'db_version' => 15,
'maxUploadSize' => 1073741824, // 1 GB
'send_error_message' => env('SEND_ERROR_MESSAGE', true),
@ -168,7 +168,7 @@ return [
'update_endpoint' => 'https://version.firefly-iii.org/index.json',
'send_telemetry' => env('SEND_TELEMETRY', false),
'telemetry_endpoint' => 'https://telemetry.firefly-iii.org',
'layout' => env('FIREFLY_III_LAYOUT', 'v1'),
'layout' => envNonEmpty('FIREFLY_III_LAYOUT', 'v1'),
'update_minimum_age' => 6,
'default_location' => [
'longitude' => env('MAP_DEFAULT_LONG', '5.916667'),