diff options
author | Lukas Reschke <lukas@statuscode.ch> | 2017-04-25 20:17:52 +0200 |
---|---|---|
committer | Lukas Reschke <lukas@statuscode.ch> | 2017-04-26 20:07:49 +0200 |
commit | 4b1ac3fef204b9ac252766fb7496b3ec5fbed731 (patch) | |
tree | d453b978d5fa54ef1224fe59101137fafb423b9c | |
parent | 47cd9760350baaf24bdf92c7a77129e59ec2f8f3 (diff) | |
download | nextcloud-server-4b1ac3fef204b9ac252766fb7496b3ec5fbed731.tar.gz nextcloud-server-4b1ac3fef204b9ac252766fb7496b3ec5fbed731.zip |
Add titles
Signed-off-by: Lukas Reschke <lukas@statuscode.ch>
-rw-r--r-- | settings/Controller/AppSettingsController.php | 57 | ||||
-rw-r--r-- | settings/js/apps.js | 2 | ||||
-rw-r--r-- | settings/templates/apps.php | 4 |
3 files changed, 43 insertions, 20 deletions
diff --git a/settings/Controller/AppSettingsController.php b/settings/Controller/AppSettingsController.php index 0d204bd47ab..a8b6d8b242d 100644 --- a/settings/Controller/AppSettingsController.php +++ b/settings/Controller/AppSettingsController.php @@ -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: diff --git a/settings/js/apps.js b/settings/js/apps.js index cda0b5112ea..bff28a60abb 100644 --- a/settings/js/apps.js +++ b/settings/js/apps.js @@ -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 { diff --git a/settings/templates/apps.php b/settings/templates/apps.php index 310513722cf..b3dcbeba233 100644 --- a/settings/templates/apps.php +++ b/settings/templates/apps.php @@ -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"> |