Add titles
Signed-off-by: Lukas Reschke <lukas@statuscode.ch>
This commit is contained in:
parent
47cd976035
commit
4b1ac3fef2
3 changed files with 43 additions and 20 deletions
|
@ -127,12 +127,7 @@ class AppSettingsController extends Controller {
|
|||
return $templateResponse;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get all available categories
|
||||
*
|
||||
* @return JSONResponse
|
||||
*/
|
||||
public function listCategories() {
|
||||
private function getAllCategories() {
|
||||
$currentLanguage = substr($this->l10nFactory->findLanguage(), 0, 2);
|
||||
|
||||
$formattedCategories = [
|
||||
|
@ -150,7 +145,16 @@ class AppSettingsController extends Controller {
|
|||
];
|
||||
}
|
||||
|
||||
return new JSONResponse($formattedCategories);
|
||||
return $formattedCategories;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get all available categories
|
||||
*
|
||||
* @return JSONResponse
|
||||
*/
|
||||
public function listCategories() {
|
||||
return new JSONResponse($this->getAllCategories());
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -346,17 +350,34 @@ class AppSettingsController extends Controller {
|
|||
$bundles = $this->bundleFetcher->getBundles();
|
||||
$apps = [];
|
||||
foreach($bundles as $bundle) {
|
||||
$apps[] = [
|
||||
'id' => $bundle->getIdentifier(),
|
||||
'author' => 'Nextcloud',
|
||||
'name' => $bundle->getName() . ' (' . $bundle->getDescription() .')',
|
||||
'description' => '',
|
||||
'internal' => true,
|
||||
'active' => false,
|
||||
'removable' => false,
|
||||
'groups' => [],
|
||||
'apps' => $bundle->getAppIdentifiers(),
|
||||
];
|
||||
$newCategory = true;
|
||||
$allApps = $appClass->listAllApps();
|
||||
$categories = $this->getAllCategories();
|
||||
foreach($categories as $singleCategory) {
|
||||
$newApps = $this->getAppsForCategory($singleCategory['id']);
|
||||
foreach($allApps as $app) {
|
||||
foreach($newApps as $key => $newApp) {
|
||||
if($app['id'] === $newApp['id']) {
|
||||
unset($newApps[$key]);
|
||||
}
|
||||
}
|
||||
}
|
||||
$allApps = array_merge($allApps, $newApps);
|
||||
}
|
||||
|
||||
foreach($bundle->getAppIdentifiers() as $identifier) {
|
||||
foreach($allApps as $app) {
|
||||
if($app['id'] === $identifier) {
|
||||
if($newCategory) {
|
||||
$app['newCategory'] = true;
|
||||
$app['categoryName'] = $bundle->getName();
|
||||
}
|
||||
$newCategory = false;
|
||||
$apps[] = $app;
|
||||
continue;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
default:
|
||||
|
|
|
@ -99,7 +99,7 @@ OC.Settings.Apps = OC.Settings.Apps || {
|
|||
return _.extend({level: 0}, app);
|
||||
});
|
||||
var source;
|
||||
if (categoryId === 'enabled' || categoryId === 'disabled' || categoryId === 'installed' || categoryId === 'app-bundles') {
|
||||
if (categoryId === 'enabled' || categoryId === 'disabled' || categoryId === 'installed') {
|
||||
source = $("#app-template-installed").html();
|
||||
$('#apps-list').addClass('installed');
|
||||
} else {
|
||||
|
|
|
@ -29,7 +29,6 @@ script(
|
|||
<?php endif; ?>
|
||||
</script>
|
||||
|
||||
|
||||
<script id="app-template-installed" type="text/x-handlebars">
|
||||
<div class="section" id="app-{{id}}">
|
||||
<div class="app-image app-image-icon"></div>
|
||||
|
@ -74,6 +73,9 @@ script(
|
|||
</script>
|
||||
|
||||
<script id="app-template" type="text/x-handlebars">
|
||||
{{#if newCategory}}
|
||||
<br/><h2>{{categoryName}}</h2>
|
||||
{{/if}}
|
||||
<div class="section" id="app-{{id}}">
|
||||
{{#if preview}}
|
||||
<div class="app-image{{#if previewAsIcon}} app-image-icon{{/if}} icon-loading">
|
||||
|
|
Loading…
Reference in a new issue