File tree 3 files changed +11
-0
lines changed 3 files changed +11
-0
lines changed Original file line number Diff line number Diff line change @@ -2412,6 +2412,7 @@ branch.included_desc = This branch is part of the default branch
2412
2412
branch.included = Included
2413
2413
branch.create_new_branch = Create branch from branch:
2414
2414
branch.confirm_create_branch = Create branch
2415
+ branch.warning_rename_default_branch = You are renaming the default branch.
2415
2416
branch.rename_branch_to = Rename " %s" to:
2416
2417
branch.confirm_rename_branch = Rename branch
2417
2418
branch.create_branch_operation = Create branch
Original file line number Diff line number Diff line change 52
52
{{end}}
53
53
{{if and $.IsWriter (not $.Repository.IsArchived) (not .IsDeleted) (not $.IsMirror)}}
54
54
<button class="ui tertiary button show-modal show-rename-branch-modal gt-mx-3"
55
+ data-is-default-branch="true"
55
56
data-modal="#rename-branch-modal"
56
57
data-old-branch-name="{{$.DefaultBranch}}"
57
58
data-tooltip-content="{{$.locale.Tr "repo.branch.rename" ($.DefaultBranch)}}"
158
159
{{end}}
159
160
{{if and $.IsWriter (not $.Repository.IsArchived) (not .IsDeleted) (not $.IsMirror)}}
160
161
<button class="ui tertiary button show-modal show-rename-branch-modal gt-mx-3"
162
+ data-is-default-branch="false"
161
163
data-old-branch-name="{{.Name}}"
162
164
data-modal="#rename-branch-modal"
163
165
data-tooltip-content="{{$.locale.Tr "repo.branch.rename" (.Name)}}"
229
231
<form class="ui form" action="{{$.Repository.Link}}/settings/rename_branch" method="post">
230
232
<div class="content">
231
233
{{.CsrfTokenHtml}}
234
+ <div class="field default-branch-warning">
235
+ <span class="text red">{{.locale.Tr "repo.branch.warning_raname_default_branch"}}</span>
236
+ </div>
232
237
<div class="field">
233
238
<span class="text" data-rename-branch-to="{{.locale.Tr "repo.branch.rename_branch_to"}}"></span>
234
239
</div>
Original file line number Diff line number Diff line change 1
1
import $ from 'jquery' ;
2
+ import { toggleElem } from '../utils/dom.js' ;
2
3
3
4
export function initRepoBranchButton ( ) {
4
5
initRepoCreateBranchButton ( ) ;
@@ -31,6 +32,10 @@ function initRepoRenameBranchButton() {
31
32
const oldBranchName = $ ( this ) . attr ( 'data-old-branch-name' ) ;
32
33
$modal . find ( 'input[name=from]' ) . val ( oldBranchName ) ;
33
34
35
+ // display the warning that the branch which is chosen is the default branch
36
+ const $warn = $modal . find ( '.default-branch-warning' ) ;
37
+ toggleElem ( $warn , $ ( this ) . attr ( 'data-is-default-branch' ) === 'true' ) ;
38
+
34
39
const $text = $modal . find ( '[data-rename-branch-to]' ) ;
35
40
$text . text ( $text . attr ( 'data-rename-branch-to' ) . replace ( '%s' , oldBranchName ) ) ;
36
41
} ) ;
You can’t perform that action at this time.
0 commit comments