Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions src/main/distrib/data/defaults.properties
Original file line number Diff line number Diff line change
Expand Up @@ -2147,3 +2147,17 @@ filestore.storageFolder = ${baseFolder}/lfs
# 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
3 changes: 2 additions & 1 deletion src/main/java/com/gitblit/wicket/pages/BasePage.html
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,8 @@

<!-- Include scripts at end for faster page loading -->
<script type="text/javascript" src="bootstrap/js/jquery.js"></script>
<script type="text/javascript" src="bootstrap/js/bootstrap.js"></script>
<script type="text/javascript" src="bootstrap/js/bootstrap.js"></script>
<script type="text/javascript" src="gitblit/js/collapsible-table.js"></script>
<wicket:container wicket:id="bottomScripts"></wicket:container>
</body>
</html>
19 changes: 18 additions & 1 deletion src/main/java/com/gitblit/wicket/panels/RepositoriesPanel.html
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,9 @@
</tbody>
</table>

<wicket:fragment wicket:id="emptyFragment">
</wicket:fragment>

<wicket:fragment wicket:id="repoIconFragment">
<span class="octicon octicon-centered octicon-repo"></span>
</wicket:fragment>
Expand Down Expand Up @@ -72,9 +75,15 @@
</tr>
</wicket:fragment>

<wicket:fragment wicket:id="tableAllCollapsible">
<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>
<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>
</wicket:fragment>

<wicket:fragment wicket:id="groupRepositoryHeader">
<tr>
<th class="left">
<span wicket:id="allCollapsible"></span>
<img style="vertical-align: middle;" src="git-black-16x16.png"/>
<wicket:message key="gb.repository">Repository</wicket:message>
</th>
Expand All @@ -86,8 +95,16 @@
</tr>
</wicket:fragment>

<wicket:fragment wicket:id="tableGroupMinusCollapsible">
<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>
</wicket:fragment>

<wicket:fragment wicket:id="tableGroupPlusCollapsible">
<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>
</wicket:fragment>

<wicket:fragment wicket:id="groupRepositoryRow">
<td colspan="1"><span wicket:id="groupName">[group name]</span></td>
<td colspan="1"><span wicket:id="groupCollapsible"></span><span wicket:id="groupName">[group name]</span></td>
<td colspan="6" style="padding: 2px;"><span class="hidden-phone" style="font-weight:normal;color:#666;" wicket:id="groupDescription">[description]</span></td>
</wicket:fragment>

Expand Down
41 changes: 40 additions & 1 deletion src/main/java/com/gitblit/wicket/panels/RepositoriesPanel.java
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,25 @@
public class RepositoriesPanel extends BasePanel {

private static final long serialVersionUID = 1L;

private enum CollapsibleRepositorySetting {
DISABLED,

EXPANDED,

COLLAPSED;

public static CollapsibleRepositorySetting get(String name) {
CollapsibleRepositorySetting returnVal = CollapsibleRepositorySetting.DISABLED;
for (CollapsibleRepositorySetting setting : values()) {
if (setting.name().equalsIgnoreCase(name)) {
returnVal = setting;
break;
}
}
return returnVal;
}
}

public RepositoriesPanel(String wicketId, final boolean showAdmin, final boolean showManagement,
List<RepositoryModel> models, boolean enableLinks,
Expand All @@ -66,6 +85,8 @@ public RepositoriesPanel(String wicketId, final boolean showAdmin, final boolean

final boolean linksActive = enableLinks;
final boolean showSize = app().settings().getBoolean(Keys.web.showRepositorySizes, true);
final String collapsibleRespositorySetting = app().settings().getString(Keys.web.collapsibleRepositoryGroups, null);
final CollapsibleRepositorySetting collapsibleRepoGroups = CollapsibleRepositorySetting.get(collapsibleRespositorySetting);

final UserModel user = GitBlitWebSession.get().getUser();

Expand Down Expand Up @@ -160,6 +181,16 @@ public void populateItem(final Item<RepositoryModel> item) {
GroupRepositoryModel groupRow = (GroupRepositoryModel) entry;
currGroupName = entry.name;
Fragment row = new Fragment("rowContent", "groupRepositoryRow", this);
if(collapsibleRepoGroups == CollapsibleRepositorySetting.EXPANDED) {
Fragment groupCollapsible = new Fragment("groupCollapsible", "tableGroupMinusCollapsible", this);
row.add(groupCollapsible);
} else if(collapsibleRepoGroups == CollapsibleRepositorySetting.COLLAPSED) {
Fragment groupCollapsible = new Fragment("groupCollapsible", "tableGroupPlusCollapsible", this);
row.add(groupCollapsible);
} else {
Fragment groupCollapsible = new Fragment("groupCollapsible", "emptyFragment", this);
row.add(groupCollapsible);
}
item.add(row);

String name = groupRow.name;
Expand All @@ -174,7 +205,7 @@ public void populateItem(final Item<RepositoryModel> item) {
row.add(new LinkPanel("groupName", null, groupRow.toString(), ProjectPage.class, WicketUtils.newProjectParameter(entry.name)));
row.add(new Label("groupDescription", entry.description == null ? "":entry.description));
}
WicketUtils.setCssClass(item, "group");
WicketUtils.setCssClass(item, "group collapsible");
// reset counter so that first row is light background
counter = 0;
return;
Expand Down Expand Up @@ -319,6 +350,14 @@ public void populateItem(final Item<RepositoryModel> item) {
} else {
// not sortable
Fragment fragment = new Fragment("headerContent", "groupRepositoryHeader", this);
if(collapsibleRepoGroups == CollapsibleRepositorySetting.EXPANDED ||
collapsibleRepoGroups == CollapsibleRepositorySetting.COLLAPSED) {
Fragment allCollapsible = new Fragment("allCollapsible", "tableAllCollapsible", this);
fragment.add(allCollapsible);
} else {
Fragment allCollapsible = new Fragment("allCollapsible", "emptyFragment", this);
fragment.add(allCollapsible);
}
add(fragment);
}
}
Expand Down
32 changes: 32 additions & 0 deletions src/main/resources/gitblit/js/collapsible-table.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
$(function() {
$('i.table-group-collapsible')
.click(function(){
$(this).closest('tr.group.collapsible').nextUntil('tr.group.collapsible').toggle();
$(this).toggleClass('fa-minus-square-o');
$(this).toggleClass('fa-plus-square-o');
});

$('i.table-openall-collapsible')
.click(function(){
$('tr.group.collapsible').first().find('i').addClass('fa-minus-square-o');
$('tr.group.collapsible').first().find('i').removeClass('fa-plus-square-o');
$('tr.group.collapsible').first().nextAll('tr:not(tr.group.collapsible)').show();
$('tr.group.collapsible').first().nextAll('tr.group.collapsible').find('i').addClass('fa-minus-square-o');
$('tr.group.collapsible').first().nextAll('tr.group.collapsible').find('i').removeClass('fa-plus-square-o');
});

$('i.table-closeall-collapsible')
.click(function(){
$('tr.group.collapsible').first().find('i').addClass('fa-plus-square-o');
$('tr.group.collapsible').first().find('i').removeClass('fa-minus-square-o');
$('tr.group.collapsible').first().nextAll('tr:not(tr.group.collapsible)').hide();
$('tr.group.collapsible').first().nextAll('tr.group.collapsible').find('i').addClass('fa-plus-square-o');
$('tr.group.collapsible').first().nextAll('tr.group.collapsible').find('i').removeClass('fa-minus-square-o');
});

$( document ).ready(function() {
if($('tr.group.collapsible').first().find('i').hasClass('fa-plus-square-o')) {
$('tr.group.collapsible').first().nextAll('tr:not(tr.group.collapsible)').hide();
}
});
});