add external links

This commit is contained in:
Simon Vieille 2020-08-11 15:52:15 +02:00
parent 8aa08dbc6b
commit caa9c092ef
Signed by: deblan
GPG key ID: 03383D15A1D31745
4 changed files with 23 additions and 3 deletions

View file

@ -26,7 +26,6 @@ use OCP\IRequest;
class CssController extends Controller
{
/**
* @var \OCP\IConfig
*/

View file

@ -31,7 +31,7 @@ use OC\URLGenerator;
class NavController extends Controller
{
/**
* @var \OCP\IConfig
* @var IConfig
*/
protected $config;
@ -95,6 +95,7 @@ class NavController extends Controller
$apps = $this->appRepository->getVisibleApps();
$currentLanguage = substr($this->l10nFactory->findLanguage(), 0, 2);
$categoriesLabels = $this->categoryFetcher->get();
$externalSitesInTopMenu = (bool) $this->config->getAppValue('side_menu', 'external-sites-in-top-menu', 0);
$appsCategories = [];
$categoriesAppsCount = [];
$items = [];
@ -105,11 +106,17 @@ class NavController extends Controller
unset($categoriesLabels[$k]);
}
$categoriesLabels['external_links'] = $this->trans->t('External sites');
foreach ($apps as $app) {
$categories = (array) $app['category'];
$appsCategories[$app['id']] = [];
foreach ($categories as $category) {
if ($externalSitesInTopMenu && $category === 'external_links') {
continue;
}
if (!isset($items[$category])) {
$items[$category] = [
'name' => $categoriesLabels[$category],

View file

@ -43,6 +43,20 @@ class AppRepository
}
}
foreach ($navigation as $app) {
if (substr($app['id'], 0, 14) === 'external_index') {
$visibleApps[$app['id']] = [
'id' => $app['id'],
'name' => $app['name'],
'preview' => $app['icon'],
'previewAsIcon' => true,
'category' => [
'external_links',
],
];
}
}
return $visibleApps;
}
}

View file

@ -319,7 +319,7 @@ $choicesSizes = [
</label>
</div>
<p><em>This feature is not compatible with the <code>big menu</code> display.</em></p>
<p><em>Should be enabled with the <code>big menu</code> display.</em></p>
<div>
<select id="side-menu-external-sites-in-top-menu" name="external-sites-in-top-menu" class="side-menu-setting">