@@ -2588,13 +2588,19 @@ webui.NewChangedFilesView = function(workspaceView) {
25882588 } ) ;
25892589 $ ( "#commitBtn" ) . off ( "click" ) ;
25902590 $ ( "#commitBtn" ) . on ( "click" , function ( ) {
2591- if ( selectedItemsFromOtherUser . length > 0 ) {
2592- self . confirmActionOnOtherUsersChanges ( "commit" ) ;
2593- } else {
2594- var commitMessage = $ ( '#commitMsg' ) . val ( ) ;
2595- self . commit ( commitMessage , $ ( "#commitMsgDetail" ) . val ( ) ) ;
2596- }
2597-
2591+ $ . get ( "api/basic-and-default" , function ( data ) {
2592+ var basicAndDefault = JSON . parse ( data ) [ "basic-and-default" ]
2593+ if ( basicAndDefault == "1" ) {
2594+ self . noCommitsOnDefault ( ) ;
2595+ } else {
2596+ if ( selectedItemsFromOtherUser . length > 0 ) {
2597+ self . confirmActionOnOtherUsersChanges ( "commit" ) ;
2598+ } else {
2599+ var commitMessage = $ ( '#commitMsg' ) . val ( ) ;
2600+ self . commit ( commitMessage , $ ( "#commitMsgDetail" ) . val ( ) ) ;
2601+ }
2602+ }
2603+ } )
25982604 } ) ;
25992605
26002606 $ ( "#amendBtn" ) . off ( "click" ) ;
@@ -2739,6 +2745,54 @@ webui.NewChangedFilesView = function(workspaceView) {
27392745 } ) ;
27402746 }
27412747
2748+ self . noCommitsOnDefault = function ( ) {
2749+ function removePopup ( popup ) {
2750+ $ ( popup ) . children ( ".modal-fade" ) . modal ( "hide" ) ;
2751+ $ ( ".modal-backdrop" ) . remove ( ) ;
2752+ $ ( "#noCommitsDefault" ) . remove ( ) ;
2753+ }
2754+
2755+ var popup = $ (
2756+ '<div class="modal fade" tabindex="-1" id="noCommitsDefault" role="dialog" data-backdrop="static">' +
2757+ '<div class="modal-dialog modal-md" role="document">' +
2758+ '<div class="modal-content">' +
2759+ '<div class="modal-header">' +
2760+ '<h5 class="modal-title">Cannot commit to Default Branch</h5>' +
2761+ '<button type="button" class="btn btn-default close" data-dismiss="modal">' + webui . largeXIcon + '</button>' +
2762+ '</div>' +
2763+ '<div class="modal-body">' +
2764+ '<div class="row">' +
2765+ '<div class="col-sm-1">' +
2766+ webui . warningIcon +
2767+ '</div>' +
2768+ '<div class="col-sm-11">' +
2769+ '<p>You cannot commit to the default merge branch while using basic mode. Please switch to another branch.</p>' +
2770+ '</div>' +
2771+ '</div>' +
2772+ '</div>' +
2773+ '<div class="modal-footer"></div>' +
2774+ '</div>' +
2775+ '</div>' +
2776+ '</div>'
2777+ ) [ 0 ] ;
2778+
2779+ $ ( "body" ) . append ( popup ) ;
2780+
2781+ var popupFooter = $ ( ".modal-footer" , popup ) [ 0 ] ;
2782+ webui . detachChildren ( popupFooter ) ;
2783+
2784+ $ (
2785+ '<button class="btn btn-sm btn-secondary action-btn" id="noCommitDefaultButton">Ok</button>'
2786+ ) . appendTo ( popupFooter ) ;
2787+
2788+ $ ( popup ) . modal ( 'show' ) ;
2789+
2790+ $ ( "#noCommitsDefault" ) . find ( ".close, #noCommitDefaultButton" ) . click ( function ( ) {
2791+ removePopup ( popup ) ;
2792+ } )
2793+
2794+ } ;
2795+
27422796 self . confirmActionOnOtherUsersChanges = function ( action ) {
27432797 function removeWarningModal ( popup ) {
27442798 $ ( popup ) . children ( ".modal-fade" ) . modal ( "hide" ) ;
0 commit comments