@@ -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 |
@@ -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> |
@@ -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> | |||
@@ -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> | |||
@@ -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> | |||
@@ -58,6 +58,25 @@ import com.gitblit.wicket.pages.UserPage; | |||
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, | |||
@@ -66,6 +85,8 @@ public class RepositoriesPanel extends BasePanel { | |||
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(); | |||
@@ -160,6 +181,16 @@ public class RepositoriesPanel extends BasePanel { | |||
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; | |||
@@ -174,7 +205,7 @@ public class RepositoriesPanel extends BasePanel { | |||
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; | |||
@@ -319,6 +350,14 @@ public class RepositoriesPanel extends BasePanel { | |||
} 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); | |||
} | |||
} |
@@ -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(); | |||
} | |||
}); | |||
}); |