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 LOG=single
REQUIRE_HTTPS=false REQUIRE_HTTPS=false
API_SECRET=password API_SECRET=password
#CUSTOM_MODULES=
#TRUSTED_PROXIES= #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, 'selected' => true,
]) ])
@endif @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> <li class="divider"></li>
@if (Utils::isAdmin()) @if (Utils::isAdmin())
@if (count(session(SESSION_USER_ACCOUNTS)) > 1) @if (count(session(SESSION_USER_ACCOUNTS)) > 1)
@ -504,38 +496,49 @@
'expenses', 'expenses',
'vendors', 'vendors',
'settings', 'settings',
//'self-update'
] as $option) ] as $option)
@if (in_array($option, ['dashboard', 'settings']) @if (in_array($option, ['dashboard', 'settings'])
|| Auth::user()->can('view', substr($option, 0, -1)) || Auth::user()->can('view', substr($option, 0, -1))
|| Auth::user()->can('create', substr($option, 0, -1))) || Auth::user()->can('create', substr($option, 0, -1)))
<li class="{{ Request::is("{$option}*") ? 'active' : '' }}"> <li class="{{ Request::is("{$option}*") ? 'active' : '' }}">
@if ($option == 'settings') @if ($option == 'settings')
<a type="button" class="btn btn-default btn-sm pull-right" <a type="button" class="btn btn-default btn-sm pull-right"
href="{{ Utils::getDocsUrl(request()->path()) }}" target="_blank"> href="{{ Utils::getDocsUrl(request()->path()) }}" target="_blank">
<i class="fa fa-question-circle" style="width:20px" title="{{ trans('texts.help') }}"></i> <i class="fa fa-question-circle" style="width:20px" title="{{ trans('texts.help') }}"></i>
</a>
@elseif ($option != 'dashboard')
@if (Auth::user()->can('create', substr($option, 0, -1)))
<a type="button" class="btn btn-primary btn-sm pull-right"
href="{{ url("/{$option}/create") }}">
<i class="fa fa-plus-circle" style="width:20px" title="{{ trans('texts.create_new') }}"></i>
</a> </a>
@elseif ($option != 'dashboard')
@if (Auth::user()->can('create', substr($option, 0, -1)))
<a type="button" class="btn btn-primary btn-sm pull-right"
href="{{ url("/{$option}/create") }}">
<i class="fa fa-plus-circle" style="width:20px" title="{{ trans('texts.create_new') }}"></i>
</a>
@endif
@endif @endif
<a href="{{ url($option == 'recurring' ? 'recurring_invoice' : $option) }}"
style="font-size:16px; padding-top:6px; padding-bottom:6px"
class="{{ Request::is("{$option}*") ? 'active' : '' }}">
<i class="fa fa-{{ \App\Models\EntityModel::getIcon($option) }}" style="width:46px; padding-right:10px"></i>
{{ ($option == 'recurring_invoices') ? trans('texts.recurring') : trans("texts.{$option}") }}
{!! Utils::isTrial() && in_array($option, ['quotes', 'tasks', 'expenses', 'vendors']) ? '&nbsp;<sup>' . trans('texts.pro') . '</sup>' : '' !!}
@if (false && $option == 'self-update' && Updater::source()->isNewVersionAvailable('v'.NINJA_VERSION))
<span class="badge alert-danger">1</span>
@endif
</a>
</li>
@endif @endif
<a href="{{ url($option == 'recurring' ? 'recurring_invoice' : $option) }}"
style="font-size:16px; padding-top:6px; padding-bottom:6px"
class="{{ Request::is("{$option}*") ? 'active' : '' }}">
<i class="fa fa-{{ \App\Models\EntityModel::getIcon($option) }}" style="width:46px; padding-right:10px"></i>
{{ ($option == 'recurring_invoices') ? trans('texts.recurring') : trans("texts.{$option}") }}
{!! Utils::isTrial() && in_array($option, ['quotes', 'tasks', 'expenses', 'vendors']) ? '&nbsp;<sup>' . trans('texts.pro') . '</sup>' : '' !!}
@if (false && $option == 'self-update' && Updater::source()->isNewVersionAvailable('v'.NINJA_VERSION))
<span class="badge alert-danger">1</span>
@endif
</a>
</li>
@endif
@endforeach @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> </ul>
</div> </div>
<!-- /#left-sidebar-wrapper --> <!-- /#left-sidebar-wrapper -->