Skip to content

Firefly III: a personal finances manager

Update version and API.

James Coleda77bcde0452
diff --git a/app/Http/Controllers/Account/IndexController.php b/app/Http/Controllers/Account/IndexController.php
index 7eb389ea53..c4e8254f0c 100644
--- a/app/Http/Controllers/Account/IndexController.php
+++ b/app/Http/Controllers/Account/IndexController.php
@@ -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));
diff --git a/app/Http/Controllers/Account/ShowController.php b/app/Http/Controllers/Account/ShowController.php
index 68841905b2..bb9bc474b9 100644
--- a/app/Http/Controllers/Account/ShowController.php
+++ b/app/Http/Controllers/Account/ShowController.php
@@ -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');
diff --git a/app/Support/Twig/General.php b/app/Support/Twig/General.php
index 014c72274c..db23187d9b 100644
--- a/app/Support/Twig/General.php
+++ b/app/Support/Twig/General.php
@@ -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
*/
diff --git a/config/firefly.php b/config/firefly.php
index 3daf86d6eb..c68bcc940c 100644
--- a/config/firefly.php
+++ b/config/firefly.php
@@ -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'),