@@ -504,6 +504,56 @@ webui.SideBarView = function(mainView, noEventHandlers) {
504504 } )
505505 }
506506
507+ self . changeContext = function ( ) {
508+ function removePopup ( popup ) {
509+ $ ( popup ) . children ( ".modal-fade" ) . modal ( "hide" ) ;
510+ $ ( ".modal-backdrop" ) . remove ( ) ;
511+ $ ( "#changeContextModal" ) . remove ( ) ;
512+ }
513+
514+ var popup = $ (
515+ '<div class="modal fade" tab-index="-1" id="changeContextModal" role="dialog">' +
516+ '<div class="modal-dialog modal-md" role="document">' +
517+ '<div class="modal-content">' +
518+ '<div class="modal-header">' +
519+ '<h5 class="modal-title">Change Context</h5>' +
520+ '<button type="button" class="btn btn-default close" data-dismiss="modal">' + webui . largeXIcon + '</button>' +
521+ '</div>' +
522+ '<div class="modal-body"></div>' +
523+ '<div class="modal-footer"></div>' +
524+ '</div>' +
525+ '</div>' +
526+ '</div>'
527+ ) [ 0 ] ;
528+
529+ $ ( "body" ) . append ( popup ) ;
530+ var popupBody = $ ( ".modal-body" , popup ) [ 0 ] ;
531+ webui . detachChildren ( popupBody ) ;
532+
533+ $ (
534+ '<div class="">' +
535+ '<h6>Select context for Git Source Control</h6>' +
536+ '<select class="custom-select">' +
537+ '<option selected>context!</option>' +
538+ '</select>' +
539+ '</div>'
540+ ) . appendTo ( popupBody ) ;
541+
542+ var popupFooter = $ ( ".modal-footer" , popup ) [ 0 ] ;
543+ webui . detachChildren ( popupFooter ) ;
544+
545+ $ (
546+ '<button class="btn btn-sm btn-primary action-btn" id="chooseContextBtn">Choose Context</button>' +
547+ '<button class="btn btn-sm btn-secondary" id="cancelContextBtn">Cancel</button>'
548+ ) . appendTo ( popupFooter ) ;
549+
550+ $ ( popup ) . modal ( 'show' ) ;
551+
552+ $ ( '#changeContextModal' ) . find ( '#cancelContextBtn' , '.close' ) . click ( function ( ) {
553+ removePopup ( popup ) ;
554+ } ) ;
555+ }
556+
507557
508558 self . checkoutBranch = function ( branchType , refName ) {
509559 $ ( "#confirm-branch-checkout" ) . remove ( ) ;
@@ -798,7 +848,7 @@ webui.SideBarView = function(mainView, noEventHandlers) {
798848 '<section id="sidebar-tags">' +
799849 '<h4>Tags</h4>' +
800850 '</section>' +
801- '<section id="sidebar-context">' +
851+ '<section id="sidebar-context" data-toggle="tooltip" data-placement="right" title="Current Context" >' +
802852 '<h4>Change Context</h4>' +
803853 '</section>' +
804854 '<section id="sidebar-settings">' +
@@ -827,6 +877,7 @@ webui.SideBarView = function(mainView, noEventHandlers) {
827877 $ ( ".btn-add" , self . element ) . click ( self . createNewLocalBranch ) ;
828878 $ ( '.btn-prune-remote-branches' , self . element ) . click ( self . pruneRemoteBranches ) ;
829879 $ ( "#sidebar-settings" , self . element ) . click ( self . goToSettingsPage ) ;
880+ $ ( "#sidebar-context" , self . element ) . click ( self . changeContext ) ;
830881 }
831882 self . getPackageVersion ( ) ;
832883 self . fetchSection ( $ ( "#sidebar-local-branches" , self . element ) [ 0 ] , "Local Branches" , "local-branches" , "branch --verbose --verbose" ) ;
0 commit comments