1
0
mirror of https://github.com/invoiceninja/invoiceninja.git synced 2024-11-08 12:12:48 +01:00

Show modules in main navigation

This commit is contained in:
Hillel Coren 2016-12-07 22:40:36 +02:00
parent e6e9237b4d
commit 4cde9f3d88
3 changed files with 38 additions and 59 deletions

View File

@ -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=

View File

@ -1,23 +0,0 @@
<?php namespace App\Libraries;
class ModuleUtils
{
public static function loadModules()
{
$data = [];
$modules = env('CUSTOM_MODULES');
$modules = explode(',', $modules);
foreach ($modules as $module) {
$info = CurlUtils::get($module . '?action=info');
if ($info = json_decode($info)) {
$info->url = $module;
$data[] = $info;
}
}
session(['custom_modules' => $data]);
return $data;
}
}

View File

@ -423,14 +423,6 @@
'selected' => true,
])
@endif
@if ( ! Utils::isNinjaProd())
@if ($modules = session('custom_modules') ?: App\Libraries\ModuleUtils::loadModules())
<li class="divider"></li>
@foreach ($modules as $module)
<li>{{ link_to($module->url, $module->name) }}</li>
@endforeach
@endif
@endif
<li class="divider"></li>
@if (Utils::isAdmin())
@if (count(session(SESSION_USER_ACCOUNTS)) > 1)
@ -504,7 +496,6 @@
'expenses',
'vendors',
'settings',
//'self-update'
] as $option)
@if (in_array($option, ['dashboard', 'settings'])
|| Auth::user()->can('view', substr($option, 0, -1))
@ -536,6 +527,18 @@
</li>
@endif
@endforeach
@if ( ! Utils::isNinjaProd())
@foreach (Module::all() as $module)
<li class="{{ Request::is("{$module->getAlias()}*") ? 'active' : '' }}">
<a href="{{ url($module->getAlias()) }}"
style="font-size:16px; padding-top:6px; padding-bottom:6px"
class="{{ Request::is("{$module->getAlias()}*") ? 'active' : '' }}">
<i class="fa fa-{{ $module->get('icon', 'th-large') }}" style="width:46px; padding-right:10px"></i>
{{ $module->getName() }}
</a>
</li>
@endforeach
@endif
</ul>
</div>
<!-- /#left-sidebar-wrapper -->