# Common unit suffixes of k, m, or g are supported.
# SINCE 1.7.0
filestore.maxUploadSize = -1
+
+# Specify the behaviour of the Repository groups on the "Repositories"
+# page, specifically whether they can be collapsed and expanded, and
+# their default state on loading the page.
+# Only on repositoryListType grouped
+#
+# Values (case-insensitive):
+# disabled - Repository groups cannot collapsed; maintains behaviour
+# from previous versions of GitBlit.
+# expanded - On loading the page all repository groups are expanded.
+# collapsed - On loading the page all repository groups are collapsed.
+#
+# SINCE 1.9.0
+web.collapsibleRepositoryGroups = disabled
\r
<!-- Include scripts at end for faster page loading -->\r
<script type="text/javascript" src="bootstrap/js/jquery.js"></script>\r
- <script type="text/javascript" src="bootstrap/js/bootstrap.js"></script> \r
+ <script type="text/javascript" src="bootstrap/js/bootstrap.js"></script> \r
+ <script type="text/javascript" src="gitblit/js/collapsible-table.js"></script>\r
<wicket:container wicket:id="bottomScripts"></wicket:container>\r
</body>\r
</html>
\ No newline at end of file
</tbody>\r
</table>\r
\r
+ <wicket:fragment wicket:id="emptyFragment">\r
+ </wicket:fragment>\r
+\r
<wicket:fragment wicket:id="repoIconFragment">\r
<span class="octicon octicon-centered octicon-repo"></span>\r
</wicket:fragment>\r
</tr>\r
</wicket:fragment>\r
\r
+ <wicket:fragment wicket:id="tableAllCollapsible">\r
+ <i title="Click to expand all" class="fa fa-plus-square-o table-openall-collapsible" aria-hidden="true" style="padding-right:3px;cursor:pointer;"></i>\r
+ <i title="Click to collapse all" class="fa fa-minus-square-o table-closeall-collapsible" aria-hidden="true" style="padding-right:3px;cursor:pointer;"></i>\r
+ </wicket:fragment>\r
+ \r
<wicket:fragment wicket:id="groupRepositoryHeader">\r
<tr>\r
<th class="left">\r
+ <span wicket:id="allCollapsible"></span>\r
<img style="vertical-align: middle;" src="git-black-16x16.png"/>\r
<wicket:message key="gb.repository">Repository</wicket:message>\r
</th>\r
</tr>\r
</wicket:fragment>\r
\r
+ <wicket:fragment wicket:id="tableGroupMinusCollapsible">\r
+ <i title="Click to expand/collapse" class="fa fa-minus-square-o table-group-collapsible" aria-hidden="true" style="padding-right:3px;cursor:pointer;"></i>\r
+ </wicket:fragment>\r
+ \r
+ <wicket:fragment wicket:id="tableGroupPlusCollapsible">\r
+ <i title="Click to expand/collapse" class="fa fa-plus-square-o table-group-collapsible" aria-hidden="true" style="padding-right:3px;cursor:pointer;"></i>\r
+ </wicket:fragment>\r
+ \r
<wicket:fragment wicket:id="groupRepositoryRow">\r
- <td colspan="1"><span wicket:id="groupName">[group name]</span></td>\r
+ <td colspan="1"><span wicket:id="groupCollapsible"></span><span wicket:id="groupName">[group name]</span></td>\r
<td colspan="6" style="padding: 2px;"><span class="hidden-phone" style="font-weight:normal;color:#666;" wicket:id="groupDescription">[description]</span></td>\r
</wicket:fragment>\r
\r
public class RepositoriesPanel extends BasePanel {\r
\r
private static final long serialVersionUID = 1L;\r
+ \r
+ private enum CollapsibleRepositorySetting {\r
+ DISABLED,\r
+\r
+ EXPANDED,\r
+\r
+ COLLAPSED;\r
+\r
+ public static CollapsibleRepositorySetting get(String name) {\r
+ CollapsibleRepositorySetting returnVal = CollapsibleRepositorySetting.DISABLED;\r
+ for (CollapsibleRepositorySetting setting : values()) {\r
+ if (setting.name().equalsIgnoreCase(name)) {\r
+ returnVal = setting;\r
+ break;\r
+ }\r
+ }\r
+ return returnVal;\r
+ }\r
+ }\r
\r
public RepositoriesPanel(String wicketId, final boolean showAdmin, final boolean showManagement,\r
List<RepositoryModel> models, boolean enableLinks,\r
\r
final boolean linksActive = enableLinks;\r
final boolean showSize = app().settings().getBoolean(Keys.web.showRepositorySizes, true);\r
+ final String collapsibleRespositorySetting = app().settings().getString(Keys.web.collapsibleRepositoryGroups, null);\r
+ final CollapsibleRepositorySetting collapsibleRepoGroups = CollapsibleRepositorySetting.get(collapsibleRespositorySetting);\r
\r
final UserModel user = GitBlitWebSession.get().getUser();\r
\r
GroupRepositoryModel groupRow = (GroupRepositoryModel) entry;\r
currGroupName = entry.name;\r
Fragment row = new Fragment("rowContent", "groupRepositoryRow", this);\r
+ if(collapsibleRepoGroups == CollapsibleRepositorySetting.EXPANDED) {\r
+ Fragment groupCollapsible = new Fragment("groupCollapsible", "tableGroupMinusCollapsible", this);\r
+ row.add(groupCollapsible);\r
+ } else if(collapsibleRepoGroups == CollapsibleRepositorySetting.COLLAPSED) {\r
+ Fragment groupCollapsible = new Fragment("groupCollapsible", "tableGroupPlusCollapsible", this);\r
+ row.add(groupCollapsible);\r
+ } else {\r
+ Fragment groupCollapsible = new Fragment("groupCollapsible", "emptyFragment", this);\r
+ row.add(groupCollapsible);\r
+ }\r
item.add(row);\r
\r
String name = groupRow.name;\r
row.add(new LinkPanel("groupName", null, groupRow.toString(), ProjectPage.class, WicketUtils.newProjectParameter(entry.name)));\r
row.add(new Label("groupDescription", entry.description == null ? "":entry.description));\r
}\r
- WicketUtils.setCssClass(item, "group");\r
+ WicketUtils.setCssClass(item, "group collapsible");\r
// reset counter so that first row is light background\r
counter = 0;\r
return;\r
} else {\r
// not sortable\r
Fragment fragment = new Fragment("headerContent", "groupRepositoryHeader", this);\r
+ if(collapsibleRepoGroups == CollapsibleRepositorySetting.EXPANDED || \r
+ collapsibleRepoGroups == CollapsibleRepositorySetting.COLLAPSED) {\r
+ Fragment allCollapsible = new Fragment("allCollapsible", "tableAllCollapsible", this);\r
+ fragment.add(allCollapsible);\r
+ } else {\r
+ Fragment allCollapsible = new Fragment("allCollapsible", "emptyFragment", this);\r
+ fragment.add(allCollapsible);\r
+ }\r
add(fragment);\r
}\r
}\r
--- /dev/null
+$(function() {\r
+ $('i.table-group-collapsible')\r
+ .click(function(){\r
+ $(this).closest('tr.group.collapsible').nextUntil('tr.group.collapsible').toggle();\r
+ $(this).toggleClass('fa-minus-square-o');\r
+ $(this).toggleClass('fa-plus-square-o');\r
+ });\r
+ \r
+ $('i.table-openall-collapsible')\r
+ .click(function(){\r
+ $('tr.group.collapsible').first().find('i').addClass('fa-minus-square-o');\r
+ $('tr.group.collapsible').first().find('i').removeClass('fa-plus-square-o');\r
+ $('tr.group.collapsible').first().nextAll('tr:not(tr.group.collapsible)').show();\r
+ $('tr.group.collapsible').first().nextAll('tr.group.collapsible').find('i').addClass('fa-minus-square-o');\r
+ $('tr.group.collapsible').first().nextAll('tr.group.collapsible').find('i').removeClass('fa-plus-square-o');\r
+ });\r
+ \r
+ $('i.table-closeall-collapsible')\r
+ .click(function(){\r
+ $('tr.group.collapsible').first().find('i').addClass('fa-plus-square-o');\r
+ $('tr.group.collapsible').first().find('i').removeClass('fa-minus-square-o');\r
+ $('tr.group.collapsible').first().nextAll('tr:not(tr.group.collapsible)').hide();\r
+ $('tr.group.collapsible').first().nextAll('tr.group.collapsible').find('i').addClass('fa-plus-square-o');\r
+ $('tr.group.collapsible').first().nextAll('tr.group.collapsible').find('i').removeClass('fa-minus-square-o');\r
+ });\r
+ \r
+ $( document ).ready(function() {\r
+ if($('tr.group.collapsible').first().find('i').hasClass('fa-plus-square-o')) {\r
+ $('tr.group.collapsible').first().nextAll('tr:not(tr.group.collapsible)').hide();\r
+ }\r
+ });\r
+});
\ No newline at end of file