Browse Source

add option to Auto-collapse categories (FR#150933)

CauseFX 4 years ago
parent
commit
98d8e36d9b
3 changed files with 12 additions and 5 deletions
  1. 8 2
      api/classes/organizr.class.php
  2. 2 1
      api/config/default.php
  3. 2 2
      js/functions.js

+ 8 - 2
api/classes/organizr.class.php

@@ -1388,6 +1388,12 @@ class Organizr
 					'label' => 'Expand All Categories',
 					'value' => $this->config['expandCategoriesByDefault']
 				),
+				array(
+					'type' => 'switch',
+					'name' => 'autoCollapseCategories',
+					'label' => 'Auto-Collapse Categories',
+					'value' => $this->config['autoCollapseCategories']
+				),
 				array(
 					'type' => 'select',
 					'name' => 'unsortedTabs',
@@ -3633,7 +3639,8 @@ class Organizr
 				'debugArea' => $this->qualifyRequest($this->config['debugAreaAuth']),
 				'debugErrors' => $this->config['debugErrors'],
 				'sandbox' => $this->config['sandbox'],
-				'expandCategoriesByDefault' => $this->config['expandCategoriesByDefault']
+				'expandCategoriesByDefault' => $this->config['expandCategoriesByDefault'],
+				'autoCollapseCategories' => $this->config['autoCollapseCategories']
 			),
 			'menuLink' => array(
 				'githubMenuLink' => $this->config['githubMenuLink'],
@@ -6258,7 +6265,6 @@ class Organizr
 							'owned' => (float)$server['owned'],
 						);
 					}
-					
 				}
 				$this->setAPIResponse('success', null, 200, $items);
 				return $items;

+ 2 - 1
api/config/default.php

@@ -483,5 +483,6 @@ return array(
 	'traktClientSecret' => '',
 	'traktAccessToken' => '',
 	'traktAccessTokenExpires' => '',
-	'traktRefreshToken' => ''
+	'traktRefreshToken' => '',
+	'autoCollapseCategories' => false
 );

+ 2 - 2
js/functions.js

@@ -2806,7 +2806,6 @@ function tabProcess(arrayItems) {
                         $(menuList).appendTo($('.category-'+v.category_id));
                     }
                 }
-                $('#side-menu').metisMenu({ toggle: false });
 				switch (v.type) {
 					case 0:
 					case '0':
@@ -2851,6 +2850,7 @@ function tabProcess(arrayItems) {
 				}
 			}
 		});
+		$('#side-menu').metisMenu({ toggle: activeInfo.settings.misc.autoCollapseCategories });
 		getDefault(defaultTabName,defaultTabType);
 	}else{
 		noTabs(arrayItems);
@@ -10708,4 +10708,4 @@ function launch(){
 			orgErrorAlert('<h3>Webserver Error:</h3>' + xhr.responseText);
 		}
 	});
-}
+}