diff options
author | Florian Zschocke <zschocke@gmx.de> | 2019-06-15 14:34:29 +0200 |
---|---|---|
committer | Florian Zschocke <zschocke@gmx.de> | 2019-06-15 14:50:50 +0200 |
commit | 0bace7e0323ed7f4c7e773f647f6d73f563dea38 (patch) | |
tree | df45d95ca490717c4c4157f326f6e7abfd3a550a /src/main/resources | |
parent | 150ff287d220b93092e689c887a64b00a21a2693 (diff) | |
download | gitblit-0bace7e0323ed7f4c7e773f647f6d73f563dea38.tar.gz gitblit-0bace7e0323ed7f4c7e773f647f6d73f563dea38.zip |
Add support nested groups on the Repositories page
Fix for #725.
Also covers #527.
This is a squashed commit of the following commits,
merging and closing pull request #1267:
commit 55fee41769ffab1aff59344fe117d481687aa743
Author: Martin Spielmann <mail@martinspielmann.de>
Date: Mon Nov 6 17:19:53 2017 +0100
declared local variable final to fix travis build
commit 131e4d14a48c2a3fdce621fa54637de50684d040
Author: Martin Spielmann <mail@martinspielmann.de>
Date: Mon Nov 6 14:11:55 2017 +0100
fix formatting (use tab for identation)
commit 8da5f6d5967894f157251c320928acdab3a451e7
Author: Martin Spielmann <mail@martinspielmann.de>
Date: Mon Nov 6 13:45:39 2017 +0100
Add repositoryListType tree. Addresses #725, 527 and includes #1224
commit 6c061651fb95212ae242dbca06c8d9ef80146201
Merge: f365daa3 40ee9653
Author: Martin Spielmann <mail@martinspielmann.de>
Date: Sat Nov 4 13:19:08 2017 +0100
Merge remote-tracking branch 'collapsible/ticket/527' into 725_nested_repos
commit f365daa3b1d6be135365f9b11bdece320beabf4e
Author: Martin Spielmann <mail@martinspielmann.de>
Date: Sat Nov 4 13:10:24 2017 +0100
first working version of tree model
Diffstat (limited to 'src/main/resources')
-rw-r--r-- | src/main/resources/gitblit/js/collapsible-table.js | 55 |
1 files changed, 47 insertions, 8 deletions
diff --git a/src/main/resources/gitblit/js/collapsible-table.js b/src/main/resources/gitblit/js/collapsible-table.js index 538b412e..ca89b8fd 100644 --- a/src/main/resources/gitblit/js/collapsible-table.js +++ b/src/main/resources/gitblit/js/collapsible-table.js @@ -1,32 +1,71 @@ $(function() {
$('i.table-group-collapsible')
.click(function(){
- $(this).closest('tr.group.collapsible').nextUntil('tr.group.collapsible').toggle();
+ var nodeId = $(this).closest('tr.group.collapsible.tree').data('nodeId');
+ if(nodeId!==undefined){
+ //we are in tree view
+ if($(this).hasClass('fa-minus-square-o')){
+ $(this).closest('tr.group.collapsible.tree').nextAll('tr.child-of-'+nodeId).hide();
+ $(this).closest('tr.group.collapsible.tree').nextAll('tr.child-of-'+nodeId).addClass('hidden-by-'+nodeId);
+ }else{
+ $(this).closest('tr.group.collapsible.tree').nextAll('tr.child-of-'+nodeId).removeClass('hidden-by-'+nodeId);
+ $(this).closest('tr.group.collapsible.tree').nextAll('tr.child-of-'+nodeId+':not([class*="hidden-by-"])').show();
+ }
+ }else{
+ $(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:not(tr.group.collapsible),tr.group.collapsible.tree').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');
+
+ var nodeId = $('tr.group.collapsible.tree').data('nodeId');
+ if(nodeId!==undefined){
+ //we are in tree view
+ $('tr[class*="child-of-"]').removeClass(function(index, className){
+ return (className.match(/\hidden-by-\S+/g)||[]).join(' ');
+ });
+ $('tr.group.collapsible > i').addClass('fa-minus-square-o');
+ $('tr.group.collapsible > 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:not(tr.group.collapsible),tr.group.collapsible.tree').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');
+
+ var nodeId = $('tr.group.collapsible.tree').first().data('nodeId');
+ if(nodeId!==undefined){
+ //we are in tree view, hide all sub trees
+ $('tr[class*="child-of-"]').each(function(){
+ var row = $(this);
+ var classList = row.attr('class').split('/\s+/');
+ $.each(classList, function(index, c){
+ if(c.match(/^child-of-*/)){
+ row.addClass(c.replace(/^child-of-(\d)/, 'hidden-by-$1'));
+ }
+ });
+ });
+ $('tr.group.collapsible i').addClass('fa-plus-square-o');
+ $('tr.group.collapsible 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();
+ $('tr.group.collapsible').first().nextAll('tr:not(tr.group.collapsible),tr.group.collapsible.tree').hide();
}
});
-});
\ No newline at end of file +}); |