mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-10-13 16:00:13 +00:00
Remove various sort routines.
This commit is contained in:
@@ -22,7 +22,6 @@ declare(strict_types=1);
|
||||
|
||||
namespace FireflyIII\Support\Binder;
|
||||
|
||||
use FireflyIII\Models\Account;
|
||||
use FireflyIII\Models\AccountType;
|
||||
use Illuminate\Routing\Route;
|
||||
use Illuminate\Support\Collection;
|
||||
@@ -52,6 +51,7 @@ class AccountList implements BinderInterface
|
||||
$collection = auth()->user()->accounts()
|
||||
->leftJoin('account_types', 'account_types.id', '=', 'accounts.account_type_id')
|
||||
->where('account_types.type', AccountType::ASSET)
|
||||
->orderBy('accounts.name', 'ASC')
|
||||
->get(['accounts.*']);
|
||||
}
|
||||
if ('allAssetAccounts' !== $value) {
|
||||
@@ -61,16 +61,11 @@ class AccountList implements BinderInterface
|
||||
$collection = auth()->user()->accounts()
|
||||
->leftJoin('account_types', 'account_types.id', '=', 'accounts.account_type_id')
|
||||
->whereIn('accounts.id', $list)
|
||||
->orderBy('accounts.name', 'ASC')
|
||||
->get(['accounts.*']);
|
||||
}
|
||||
|
||||
if ($collection->count() > 0) {
|
||||
$collection = $collection->sortBy(
|
||||
function (Account $account) {
|
||||
return $account->name;
|
||||
}
|
||||
);
|
||||
|
||||
return $collection;
|
||||
}
|
||||
}
|
||||
|
@@ -394,11 +394,7 @@ trait RenderPartialViews
|
||||
{
|
||||
/** @var TagRepositoryInterface $repository */
|
||||
$repository = app(TagRepositoryInterface::class);
|
||||
$tags = $repository->get()->sortBy(
|
||||
function (Tag $tag) {
|
||||
return $tag->tag;
|
||||
}
|
||||
);
|
||||
$tags = $repository->get();
|
||||
try {
|
||||
$result = view('reports.options.tag', compact('tags'))->render();
|
||||
} catch (Throwable $e) {
|
||||
|
@@ -208,7 +208,7 @@ trait RequestInformation
|
||||
*/
|
||||
protected function getSpecificPageName(): string // get request info
|
||||
{
|
||||
return null === RouteFacade::current()->parameter('what') ? '' : '_' . RouteFacade::current()->parameter('what');
|
||||
return null === RouteFacade::current()->parameter('objectType') ? '' : '_' . RouteFacade::current()->parameter('objectType');
|
||||
}
|
||||
|
||||
/**
|
||||
|
@@ -59,7 +59,7 @@ class General extends Twig_Extension
|
||||
$this->phpdate(),
|
||||
$this->activeRouteStrict(),
|
||||
$this->activeRoutePartial(),
|
||||
$this->activeRoutePartialWhat(),
|
||||
$this->activeRoutePartialObjectType(),
|
||||
$this->formatDate(),
|
||||
$this->getMetaField(),
|
||||
$this->hasRole(),
|
||||
@@ -77,7 +77,7 @@ class General extends Twig_Extension
|
||||
return new Twig_SimpleFunction(
|
||||
'activeRoutePartial',
|
||||
function (): string {
|
||||
$args = \func_get_args();
|
||||
$args = func_get_args();
|
||||
$route = $args[0]; // name of the route.
|
||||
$name = Route::getCurrentRoute()->getName() ?? '';
|
||||
if (!(false === strpos($name, $route))) {
|
||||
@@ -95,15 +95,15 @@ class General extends Twig_Extension
|
||||
*
|
||||
* @return Twig_SimpleFunction
|
||||
*/
|
||||
protected function activeRoutePartialWhat(): Twig_SimpleFunction
|
||||
protected function activeRoutePartialObjectType(): Twig_SimpleFunction
|
||||
{
|
||||
return new Twig_SimpleFunction(
|
||||
'activeRoutePartialWhat',
|
||||
function ($context): string {
|
||||
[, $route, $what] = func_get_args();
|
||||
$activeWhat = $context['what'] ?? false;
|
||||
'activeRoutePartialObjectType',
|
||||
static function ($context): string {
|
||||
[, $route, $objectType] = func_get_args();
|
||||
$activeObjectType = $context['objectType'] ?? false;
|
||||
|
||||
if ($what === $activeWhat && !(false === stripos(Route::getCurrentRoute()->getName(), $route))) {
|
||||
if ($objectType === $activeObjectType && !(false === stripos(Route::getCurrentRoute()->getName(), $route))) {
|
||||
return 'active';
|
||||
}
|
||||
|
||||
@@ -347,5 +347,4 @@ class General extends Twig_Extension
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
}
|
||||
|
Reference in New Issue
Block a user