@@ -329,19 +329,23 @@ webui.SideBarView = function(mainView, noEventHandlers) {
329
329
+ refname
330
330
+ '</button>' ) . appendTo ( cardHeader ) ;
331
331
332
+ var collapseDiv = $ ( '<div id="collapse-' + itemId + '" class="accordion-collapse collapse" aria-labelledby="heading-' + itemId + '" data-parent="#accordion-' + id + '-' + idPostfix + '">' ) . appendTo ( cardDiv ) ;
332
333
if ( ref [ 0 ] != "*" ) {
333
- var collapseDiv = $ ( '<div id="collapse-' + itemId + '" class="accordion-collapse collapse" aria-labelledby="heading-' + itemId + '" data-parent="#accordion-' + id + '-' + idPostfix + '">' ) . appendTo ( cardDiv ) ;
334
334
var cardBody = $ ( '<div class="card-body">' +
335
335
'<div class="d-grid gap-2 col-12 mx-auto">' +
336
336
'<button class="btn btn-xs btn-primary btn-block btn-checkout-local-branch mt-1">Checkout Branch</button>' +
337
337
'<button class="btn btn-xs btn-warning btn-block btn-merge-branch">Merge Branch</button>' +
338
+ '<button class="btn btn-xs btn-warning btn-block btn-push-branch">Push Branch</button>' +
338
339
'<button class="btn btn-xs btn-danger btn-block btn-delete-branch">Delete Branch</button>' +
339
340
'</div>' +
340
341
'</div>' ) . appendTo ( collapseDiv ) ;
341
- }
342
-
343
- if ( ref [ 0 ] == "*" ) {
342
+ } else {
344
343
$ ( button ) . addClass ( "branch-current" ) ;
344
+ var cardBody = $ ( '<div class="card-body">' +
345
+ '<div class="d-grid gap-2 col-12 mx-auto">' +
346
+ '<button class="btn btn-xs btn-warning btn-block btn-push-branch">Push Branch</button>' +
347
+ '</div>' +
348
+ '</div>' ) . appendTo ( collapseDiv ) ;
345
349
}
346
350
} else {
347
351
var refname = ref . replaceAll ( '/' , '-' ) ;
@@ -642,6 +646,14 @@ webui.SideBarView = function(mainView, noEventHandlers) {
642
646
webui . git ( "merge --no-commit --no-ff " + refName , "" , self . upToDateHandler , callTestMergeHandler , callTestMergeHandler ) ;
643
647
}
644
648
649
+ /// pushes the selected local branch to "origin"
650
+ self . pushBranch = function ( e ) {
651
+ e . preventDefault ( ) ;
652
+ var refName = $ ( this ) . parent ( ) . parent ( ) . parent ( ) . siblings (
653
+ ".card-header" ) . children ( "button" ) . html ( ) ;
654
+ webui . git ( `push -u origin ${ refName } ` , "" , self . upToDateHandler )
655
+ }
656
+
645
657
self . goToSettingsPage = function ( ) {
646
658
window . location . replace ( webui . settingsURL ) ;
647
659
}
@@ -667,7 +679,7 @@ webui.SideBarView = function(mainView, noEventHandlers) {
667
679
$ ( self . buildAccordion ( section , refs , id , undefined , "popup" ) ) . appendTo ( popupContent ) ;
668
680
// Hide popup when the user selects a branch operation
669
681
// Then execute the required operation with other even listeners
670
- $ ( popupContent ) . find ( ".btn-delete-branch, .btn-checkout-local-branch, .btn-checkout-remote-branch, .btn-merge-remote-branch, .btn-merge-branch" ) . click ( function ( ) {
682
+ $ ( popupContent ) . find ( ".btn-delete-branch, .btn-checkout-local-branch, .btn-checkout-remote-branch, .btn-merge-remote-branch, .btn-merge-branch, .btn-push-branch " ) . click ( function ( ) {
671
683
$ ( popup ) . modal ( 'hide' ) ;
672
684
} ) ;
673
685
}
@@ -748,6 +760,7 @@ webui.SideBarView = function(mainView, noEventHandlers) {
748
760
749
761
if ( ! noEventHandlers ) {
750
762
$ ( document ) . on ( 'click' , '.btn-checkout-local-branch' , self . checkoutBranch ) ;
763
+ $ ( document ) . on ( 'click' , '.btn-push-branch' , self . pushBranch ) ;
751
764
$ ( document ) . on ( 'click' , '.btn-checkout-remote-branch' , self . checkoutBranch ) ;
752
765
753
766
$ ( document ) . on ( 'click' , '.btn-delete-branch' , self . deleteLocalBranch ) ;
0 commit comments