Skip to content

Commit 23b1d1e

Browse files
Merge branch 'main' into migration-credentials
2 parents cc7e1b8 + d5f2010 commit 23b1d1e

File tree

4 files changed

+46
-1
lines changed

4 files changed

+46
-1
lines changed

options/locale/locale_en-US.ini

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1977,6 +1977,10 @@ branch.restore = Restore Branch '%s'
19771977
branch.download = Download Branch '%s'
19781978
branch.included_desc = This branch is part of the default branch
19791979
branch.included = Included
1980+
branch.create_new_branch = Create branch from branch:
1981+
branch.confirm_create_branch = Create branch
1982+
branch.new_branch = Create new branch
1983+
branch.new_branch_from = Create new branch from '%s'
19801984

19811985
tag.create_tag = Create tag <strong>%s</strong>
19821986
tag.create_success = Tag '%s' has been created.

templates/repo/branch/list.tmpl

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,11 @@
2424
{{end}}
2525
</td>
2626
<td class="right aligned overflow-visible">
27+
{{if and $.IsWriter (not $.Repository.IsArchived) (not .IsDeleted)}}
28+
<div class="ui basic jump button icon poping up show-create-branch-modal" data-content="{{$.i18n.Tr "repo.branch.new_branch_from" ($.DefaultBranch)}}" data-variation="tiny inverted" data-branch-from="{{EscapePound $.DefaultBranch}}" data-modal="#create-branch-modal" data-position="top right">
29+
{{svg "octicon-git-branch"}}
30+
</div>
31+
{{end}}
2732
<div class="ui basic jump dropdown icon button poping up" data-content="{{$.i18n.Tr "repo.branch.download" ($.DefaultBranch)}}" data-variation="tiny inverted" data-position="top right">
2833
{{svg "octicon-download"}}
2934
<div class="menu">
@@ -102,6 +107,11 @@
102107
{{end}}
103108
</td>
104109
<td class="two wide right aligned overflow-visible">
110+
{{if and $.IsWriter (not $.Repository.IsArchived) (not .IsDeleted)}}
111+
<div class="ui basic jump button icon poping up show-create-branch-modal" data-branch-from="{{EscapePound .Name}}" data-content="{{$.i18n.Tr "repo.branch.new_branch_from" .Name}}" data-variation="tiny inverted" data-position="top right" data-modal="#create-branch-modal" data-name="{{.Name}}">
112+
{{svg "octicon-git-branch"}}
113+
</div>
114+
{{end}}
105115
{{if (not .IsDeleted)}}
106116
<div class="ui basic jump dropdown icon button poping up" data-content="{{$.i18n.Tr "repo.branch.download" (.Name)}}" data-variation="tiny inverted" data-position="top right">
107117
{{svg "octicon-download"}}
@@ -142,4 +152,30 @@
142152
</div>
143153
{{template "base/delete_modal_actions" .}}
144154
</div>
155+
156+
<div class="ui small modal" id="create-branch-modal">
157+
<div class="header">
158+
{{.i18n.Tr "repo.branch.new_branch"}}
159+
</div>
160+
<div class="content">
161+
<form class="ui form" id="create-branch-form" action="" data-base-action="{{.Link}}/_new/branch/" method="post">
162+
{{.CsrfTokenHtml}}
163+
<div class="field">
164+
<label>
165+
{{.i18n.Tr "repo.branch.create_new_branch"}}
166+
<span class="text" id="modal-create-branch-from-span"></span>
167+
</label>
168+
</div>
169+
<div class="required field">
170+
<label for="new_branch_name">{{.i18n.Tr "repo.branch.name"}}</label>
171+
<input id="new_branch_name" name="new_branch_name" required>
172+
</div>
173+
174+
<div class="text right actions">
175+
<div class="ui cancel button">{{.i18n.Tr "settings.cancel"}}</div>
176+
<button class="ui green button">{{.i18n.Tr "repo.branch.confirm_create_branch"}}</button>
177+
</div>
178+
</form>
179+
</div>
180+
</div>
145181
{{template "base/footer" .}}

templates/shared/issuelist.tmpl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@
6767
</a>
6868
{{end}}
6969
{{if .Ref}}
70-
<a class="ref" {{if $.RepoLink}}href="{{$.RepoLink}}{{index $.IssueRefURLs .ID}}"{{else}}href="{{AppSubUrl}}/{{.Repo.OwnerName}}/{{.Repo.Name}}{{index $.IssueRefURLs .ID}}"{{end}}>
70+
<a class="ref" {{if $.RepoLink}}href="{{index $.IssueRefURLs .ID}}"{{else}}href="{{AppSubUrl}}/{{.Repo.OwnerName}}/{{.Repo.Name}}{{index $.IssueRefURLs .ID}}"{{end}}>
7171
{{svg "octicon-git-branch" 14 "mr-2"}}{{index $.IssueRefEndNames .ID}}
7272
</a>
7373
{{end}}

web_src/js/index.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2658,6 +2658,11 @@ $(document).ready(async () => {
26582658
$('.show-panel.button').on('click', function () {
26592659
$($(this).data('panel')).show();
26602660
});
2661+
$('.show-create-branch-modal.button').on('click', function () {
2662+
$('#create-branch-form')[0].action = $('#create-branch-form').data('base-action') + $(this).data('branch-from');
2663+
$('#modal-create-branch-from-span').text($(this).data('branch-from'));
2664+
$($(this).data('modal')).modal('show');
2665+
});
26612666
$('.show-modal.button').on('click', function () {
26622667
$($(this).data('modal')).modal('show');
26632668
});

0 commit comments

Comments
 (0)