diff options
author | ybosy <author@example.com> | 2017-04-07 10:46:35 +0200 |
---|---|---|
committer | Florian Zschocke <zschocke@gmx.de> | 2019-06-15 13:37:34 +0200 |
commit | 150ff287d220b93092e689c887a64b00a21a2693 (patch) | |
tree | 343bd9a2d64c1b28e5428aa419b54861524bac5e /src | |
parent | d05e9eeed11c36594b049b22705709d1ebfb97b9 (diff) | |
download | gitblit-150ff287d220b93092e689c887a64b00a21a2693.tar.gz gitblit-150ff287d220b93092e689c887a64b00a21a2693.zip |
collapsible group repositories
Diffstat (limited to 'src')
5 files changed, 106 insertions, 3 deletions
diff --git a/src/main/distrib/data/defaults.properties b/src/main/distrib/data/defaults.properties index 9c597903..bada3350 100644 --- a/src/main/distrib/data/defaults.properties +++ b/src/main/distrib/data/defaults.properties @@ -2154,3 +2154,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 diff --git a/src/main/java/com/gitblit/wicket/pages/BasePage.html b/src/main/java/com/gitblit/wicket/pages/BasePage.html index 4dbc2e57..49810ddc 100644 --- a/src/main/java/com/gitblit/wicket/pages/BasePage.html +++ b/src/main/java/com/gitblit/wicket/pages/BasePage.html @@ -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>
\ No newline at end of file diff --git a/src/main/java/com/gitblit/wicket/panels/RepositoriesPanel.html b/src/main/java/com/gitblit/wicket/panels/RepositoriesPanel.html index 2de52b09..7c3b3082 100644 --- a/src/main/java/com/gitblit/wicket/panels/RepositoriesPanel.html +++ b/src/main/java/com/gitblit/wicket/panels/RepositoriesPanel.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>
diff --git a/src/main/java/com/gitblit/wicket/panels/RepositoriesPanel.java b/src/main/java/com/gitblit/wicket/panels/RepositoriesPanel.java index c3f07099..aab602e5 100644 --- a/src/main/java/com/gitblit/wicket/panels/RepositoriesPanel.java +++ b/src/main/java/com/gitblit/wicket/panels/RepositoriesPanel.java @@ -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);
}
}
diff --git a/src/main/resources/gitblit/js/collapsible-table.js b/src/main/resources/gitblit/js/collapsible-table.js new file mode 100644 index 00000000..538b412e --- /dev/null +++ b/src/main/resources/gitblit/js/collapsible-table.js @@ -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();
+ }
+ });
+});
\ No newline at end of file |