Przeglądaj źródła

Portal: BrowseBrick: First level automatically opens when there is only one item in it, in order to display its subitems.

The opening of the root level is visible by the user so he can understand he is in a sublevel, not wondering where the root level went.

git-svn-id: http://svn.code.sf.net/p/itop/code/trunk@4729 a333f486-631f-4898-b8df-5754b55c2be0
glajarige 8 lat temu
rodzic
commit
fa954cc8f3

+ 8 - 0
datamodels/2.x/itop-portal-base/portal/src/views/bricks/browse/mode_mosaic.html.twig

@@ -406,6 +406,14 @@
 			buildMosaic(oRawDatas);
 			hideMosaicLoader();
 			registerFilterListeners();
+
+			// Open first level if only one item
+			if($('#brick_content_mosaic > .mosaic-group[data-level-id="L"] > .mosaic-group-item').length == 1)
+			{
+			    setTimeout(function(){
+                    $('#brick_content_mosaic > .mosaic-group[data-level-id="L"] > .mosaic-group-item > .mosaic-item').trigger('click');
+				}, 300);
+			}
 		});
 	</script>
 {% endblock %}

+ 8 - 0
datamodels/2.x/itop-portal-base/portal/src/views/bricks/browse/mode_tree.html.twig

@@ -410,6 +410,14 @@
 			hideTreeLoader();
 			registerFilterListeners();
 			collapseAll();
+
+            // Open first level if only one item
+            if($('#brick_content_tree > .list-group-item').length == 1)
+            {
+                setTimeout(function(){
+                    $('#brick_content_tree > .list-group-item > .tree-toggle').trigger('click');
+                }, 300);
+            }
 			
 			{% if sSearchValue is not null %}
 				// Filters from default value