5858public class RepositoriesPanel extends BasePanel {
5959
6060 private static final long serialVersionUID = 1L ;
61+
62+ private enum CollapsibleRepositorySetting {
63+ DISABLED ,
64+
65+ EXPANDED ,
66+
67+ COLLAPSED ;
68+
69+ public static CollapsibleRepositorySetting get (String name ) {
70+ CollapsibleRepositorySetting returnVal = CollapsibleRepositorySetting .DISABLED ;
71+ for (CollapsibleRepositorySetting setting : values ()) {
72+ if (setting .name ().equalsIgnoreCase (name )) {
73+ returnVal = setting ;
74+ break ;
75+ }
76+ }
77+ return returnVal ;
78+ }
79+ }
6180
6281 public RepositoriesPanel (String wicketId , final boolean showAdmin , final boolean showManagement ,
6382 List <RepositoryModel > models , boolean enableLinks ,
@@ -66,6 +85,8 @@ public RepositoriesPanel(String wicketId, final boolean showAdmin, final boolean
6685
6786 final boolean linksActive = enableLinks ;
6887 final boolean showSize = app ().settings ().getBoolean (Keys .web .showRepositorySizes , true );
88+ final String collapsibleRespositorySetting = app ().settings ().getString (Keys .web .collapsibleRepositoryGroups , null );
89+ final CollapsibleRepositorySetting collapsibleRepoGroups = CollapsibleRepositorySetting .get (collapsibleRespositorySetting );
6990
7091 final UserModel user = GitBlitWebSession .get ().getUser ();
7192
@@ -160,6 +181,16 @@ public void populateItem(final Item<RepositoryModel> item) {
160181 GroupRepositoryModel groupRow = (GroupRepositoryModel ) entry ;
161182 currGroupName = entry .name ;
162183 Fragment row = new Fragment ("rowContent" , "groupRepositoryRow" , this );
184+ if (collapsibleRepoGroups == CollapsibleRepositorySetting .EXPANDED ) {
185+ Fragment groupCollapsible = new Fragment ("groupCollapsible" , "tableGroupMinusCollapsible" , this );
186+ row .add (groupCollapsible );
187+ } else if (collapsibleRepoGroups == CollapsibleRepositorySetting .COLLAPSED ) {
188+ Fragment groupCollapsible = new Fragment ("groupCollapsible" , "tableGroupPlusCollapsible" , this );
189+ row .add (groupCollapsible );
190+ } else {
191+ Fragment groupCollapsible = new Fragment ("groupCollapsible" , "emptyFragment" , this );
192+ row .add (groupCollapsible );
193+ }
163194 item .add (row );
164195
165196 String name = groupRow .name ;
@@ -174,7 +205,7 @@ public void populateItem(final Item<RepositoryModel> item) {
174205 row .add (new LinkPanel ("groupName" , null , groupRow .toString (), ProjectPage .class , WicketUtils .newProjectParameter (entry .name )));
175206 row .add (new Label ("groupDescription" , entry .description == null ? "" :entry .description ));
176207 }
177- WicketUtils .setCssClass (item , "group" );
208+ WicketUtils .setCssClass (item , "group collapsible " );
178209 // reset counter so that first row is light background
179210 counter = 0 ;
180211 return ;
@@ -319,6 +350,14 @@ public void populateItem(final Item<RepositoryModel> item) {
319350 } else {
320351 // not sortable
321352 Fragment fragment = new Fragment ("headerContent" , "groupRepositoryHeader" , this );
353+ if (collapsibleRepoGroups == CollapsibleRepositorySetting .EXPANDED ||
354+ collapsibleRepoGroups == CollapsibleRepositorySetting .COLLAPSED ) {
355+ Fragment allCollapsible = new Fragment ("allCollapsible" , "tableAllCollapsible" , this );
356+ fragment .add (allCollapsible );
357+ } else {
358+ Fragment allCollapsible = new Fragment ("allCollapsible" , "emptyFragment" , this );
359+ fragment .add (allCollapsible );
360+ }
322361 add (fragment );
323362 }
324363 }
0 commit comments