From 4cde9f3d8812538e304e86393a429e8c4a4a01a0 Mon Sep 17 00:00:00 2001 From: Hillel Coren Date: Wed, 7 Dec 2016 22:40:36 +0200 Subject: [PATCH] Show modules in main navigation --- .env.example | 1 - app/Libraries/ModuleUtils.php | 23 ---------- resources/views/header.blade.php | 73 +++++++++++++++++--------------- 3 files changed, 38 insertions(+), 59 deletions(-) delete mode 100644 app/Libraries/ModuleUtils.php diff --git a/.env.example b/.env.example index f233a46556..2d1db72861 100644 --- a/.env.example +++ b/.env.example @@ -29,7 +29,6 @@ PHANTOMJS_CLOUD_KEY='a-demo-key-with-low-quota-per-ip-address' LOG=single REQUIRE_HTTPS=false API_SECRET=password -#CUSTOM_MODULES= #TRUSTED_PROXIES= diff --git a/app/Libraries/ModuleUtils.php b/app/Libraries/ModuleUtils.php deleted file mode 100644 index 53db3f2309..0000000000 --- a/app/Libraries/ModuleUtils.php +++ /dev/null @@ -1,23 +0,0 @@ -url = $module; - $data[] = $info; - } - } - - session(['custom_modules' => $data]); - - return $data; - } -} diff --git a/resources/views/header.blade.php b/resources/views/header.blade.php index 7ff815970e..8c1d843436 100644 --- a/resources/views/header.blade.php +++ b/resources/views/header.blade.php @@ -423,14 +423,6 @@ 'selected' => true, ]) @endif - @if ( ! Utils::isNinjaProd()) - @if ($modules = session('custom_modules') ?: App\Libraries\ModuleUtils::loadModules()) -
  • - @foreach ($modules as $module) -
  • {{ link_to($module->url, $module->name) }}
  • - @endforeach - @endif - @endif
  • @if (Utils::isAdmin()) @if (count(session(SESSION_USER_ACCOUNTS)) > 1) @@ -504,38 +496,49 @@ 'expenses', 'vendors', 'settings', - //'self-update' ] as $option) - @if (in_array($option, ['dashboard', 'settings']) - || Auth::user()->can('view', substr($option, 0, -1)) - || Auth::user()->can('create', substr($option, 0, -1))) -
  • - @if ($option == 'settings') - - - - @elseif ($option != 'dashboard') - @if (Auth::user()->can('create', substr($option, 0, -1))) - - + @if (in_array($option, ['dashboard', 'settings']) + || Auth::user()->can('view', substr($option, 0, -1)) + || Auth::user()->can('create', substr($option, 0, -1))) +
  • + @if ($option == 'settings') + + + @elseif ($option != 'dashboard') + @if (Auth::user()->can('create', substr($option, 0, -1))) + + + + @endif @endif + + + {{ ($option == 'recurring_invoices') ? trans('texts.recurring') : trans("texts.{$option}") }} + {!! Utils::isTrial() && in_array($option, ['quotes', 'tasks', 'expenses', 'vendors']) ? ' ' . trans('texts.pro') . '' : '' !!} + @if (false && $option == 'self-update' && Updater::source()->isNewVersionAvailable('v'.NINJA_VERSION)) + 1 + @endif + +
  • @endif - - - {{ ($option == 'recurring_invoices') ? trans('texts.recurring') : trans("texts.{$option}") }} - {!! Utils::isTrial() && in_array($option, ['quotes', 'tasks', 'expenses', 'vendors']) ? ' ' . trans('texts.pro') . '' : '' !!} - @if (false && $option == 'self-update' && Updater::source()->isNewVersionAvailable('v'.NINJA_VERSION)) - 1 - @endif - - - @endif @endforeach + @if ( ! Utils::isNinjaProd()) + @foreach (Module::all() as $module) +
  • getAlias()}*") ? 'active' : '' }}"> + getAlias()}*") ? 'active' : '' }}"> + + {{ $module->getName() }} + +
  • + @endforeach + @endif