فهرست منبع

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 سال پیش
والد
کامیت
fa954cc8f3

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

@@ -406,6 +406,14 @@
 			buildMosaic(oRawDatas);
 			buildMosaic(oRawDatas);
 			hideMosaicLoader();
 			hideMosaicLoader();
 			registerFilterListeners();
 			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>
 	</script>
 {% endblock %}
 {% endblock %}

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

@@ -410,6 +410,14 @@
 			hideTreeLoader();
 			hideTreeLoader();
 			registerFilterListeners();
 			registerFilterListeners();
 			collapseAll();
 			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 %}
 			{% if sSearchValue is not null %}
 				// Filters from default value
 				// Filters from default value