diff --git a/integrations/pull_merge_test.go b/integrations/pull_merge_test.go
index c50913383..cfe8b4afe 100644
--- a/integrations/pull_merge_test.go
+++ b/integrations/pull_merge_test.go
@@ -37,10 +37,8 @@ func testPullMerge(t *testing.T, session *TestSession, user, repo, pullnum strin
req := NewRequest(t, "GET", path.Join(user, repo, "pulls", pullnum))
resp := session.MakeRequest(t, req, http.StatusOK)
- // Click the little green button to create a pull
htmlDoc := NewHTMLParser(t, resp.Body)
- link, exists := htmlDoc.doc.Find(".ui.form." + string(mergeStyle) + "-fields > form").Attr("action")
- assert.True(t, exists, "The template has changed")
+ link := path.Join(user, repo, "pulls", pullnum, "merge")
req = NewRequestWithValues(t, "POST", link, map[string]string{
"_csrf": htmlDoc.GetCSRF(),
"do": string(mergeStyle),
@@ -57,7 +55,7 @@ func testPullCleanUp(t *testing.T, session *TestSession, user, repo, pullnum str
// Click the little green button to create a pull
htmlDoc := NewHTMLParser(t, resp.Body)
link, exists := htmlDoc.doc.Find(".timeline-item .delete-button").Attr("data-url")
- assert.True(t, exists, "The template has changed")
+ assert.True(t, exists, "The template has changed, can not find delete button url")
req = NewRequestWithValues(t, "POST", link, map[string]string{
"_csrf": htmlDoc.GetCSRF(),
})
diff --git a/models/repo/repo_unit.go b/models/repo/repo_unit.go
index 0f6b41933..de79eb1c9 100644
--- a/models/repo/repo_unit.go
+++ b/models/repo/repo_unit.go
@@ -150,24 +150,6 @@ func (cfg *PullRequestsConfig) GetDefaultMergeStyle() MergeStyle {
return MergeStyleMerge
}
-// AllowedMergeStyleCount returns the total count of allowed merge styles for the PullRequestsConfig
-func (cfg *PullRequestsConfig) AllowedMergeStyleCount() int {
- count := 0
- if cfg.AllowMerge {
- count++
- }
- if cfg.AllowRebase {
- count++
- }
- if cfg.AllowRebaseMerge {
- count++
- }
- if cfg.AllowSquash {
- count++
- }
- return count
-}
-
// BeforeSet is invoked from XORM before setting the value of a field of this object.
func (r *RepoUnit) BeforeSet(colName string, val xorm.Cell) {
switch colName {
diff --git a/templates/repo/issue/view_content/pull.tmpl b/templates/repo/issue/view_content/pull.tmpl
index 195da6bf8..c764138fa 100644
--- a/templates/repo/issue/view_content/pull.tmpl
+++ b/templates/repo/issue/view_content/pull.tmpl
@@ -322,176 +322,69 @@
{{$prUnit := .Repository.MustGetUnit $.UnitTypePullRequests}}
{{$approvers := .Issue.PullRequest.GetApprovers}}
{{if or $prUnit.PullRequestsConfig.AllowMerge $prUnit.PullRequestsConfig.AllowRebase $prUnit.PullRequestsConfig.AllowRebaseMerge $prUnit.PullRequestsConfig.AllowSquash}}
+
- {{if $prUnit.PullRequestsConfig.AllowMerge}}
-
- {{end}}
- {{if $prUnit.PullRequestsConfig.AllowRebase}}
-
- {{end}}
- {{if $prUnit.PullRequestsConfig.AllowRebaseMerge}}
-
- {{end}}
- {{if $prUnit.PullRequestsConfig.AllowSquash}}
-
- {{end}}
- {{if and $prUnit.PullRequestsConfig.AllowManualMerge $.IsRepoAdmin}}
-
- {{end}}
-
+
+
+
+
+
{{if .ShowMergeInstructions}}
- {{$.i18n.Tr "repo.pulls.merge_instruction_hint" | Safe}}
+ {{$.i18n.Tr "repo.pulls.merge_instruction_hint" | Safe}}
{{$.i18n.Tr "step1"}}
{{$.i18n.Tr "repo.pulls.merge_instruction_step1_desc"}}
diff --git a/web_src/js/components/PullRequestMergeForm.vue b/web_src/js/components/PullRequestMergeForm.vue
new file mode 100644
index 000000000..40398a65c
--- /dev/null
+++ b/web_src/js/components/PullRequestMergeForm.vue
@@ -0,0 +1,127 @@
+
+
+
+
+
+
+
diff --git a/web_src/js/features/repo-issue-pr-form.js b/web_src/js/features/repo-issue-pr-form.js
new file mode 100644
index 000000000..747e4f467
--- /dev/null
+++ b/web_src/js/features/repo-issue-pr-form.js
@@ -0,0 +1,12 @@
+import Vue from 'vue';
+import PullRequestMergeForm from '../components/PullRequestMergeForm.vue';
+
+export default function initPullRequestMergeForm() {
+ const el = document.getElementById('pull-request-merge-form');
+ if (!el) return;
+
+ const View = Vue.extend({
+ render: (createElement) => createElement(PullRequestMergeForm),
+ });
+ new View().$mount(el);
+}
diff --git a/web_src/js/features/repo-issue.js b/web_src/js/features/repo-issue.js
index 4e077c14e..bdd616f07 100644
--- a/web_src/js/features/repo-issue.js
+++ b/web_src/js/features/repo-issue.js
@@ -234,32 +234,6 @@ export function initRepoIssueStatusButton() {
});
}
-export function initRepoPullRequestMerge() {
- // Pull Request merge button
- const $mergeButton = $('.merge-button > button');
- $mergeButton.on('click', function (e) {
- e.preventDefault();
- $(`.${$(this).data('do')}-fields`).show();
- $(this).parent().hide();
- $('.instruct-toggle').hide();
- $('.instruct-content').hide();
- });
- $('.merge-button > .dropdown').dropdown({
- onChange(_text, _value, $choice) {
- if ($choice.data('do')) {
- $mergeButton.find('.button-text').text($choice.text());
- $mergeButton.data('do', $choice.data('do'));
- }
- }
- });
- $('.merge-cancel').on('click', function (e) {
- e.preventDefault();
- $(this).closest('.form').hide();
- $mergeButton.parent().show();
- $('.instruct-toggle').show();
- });
-}
-
export function initRepoPullRequestUpdate() {
// Pull Request update button
const $pullUpdateButton = $('.update-button > button');
diff --git a/web_src/js/features/repo-legacy.js b/web_src/js/features/repo-legacy.js
index b7e6206e5..a24d1b974 100644
--- a/web_src/js/features/repo-legacy.js
+++ b/web_src/js/features/repo-legacy.js
@@ -8,7 +8,7 @@ import {
initRepoIssueComments, initRepoIssueDependencyDelete,
initRepoIssueReferenceIssue, initRepoIssueStatusButton,
initRepoIssueTitleEdit,
- initRepoIssueWipToggle, initRepoPullRequestMerge, initRepoPullRequestUpdate,
+ initRepoIssueWipToggle, initRepoPullRequestUpdate,
updateIssuesMeta,
} from './repo-issue.js';
import {initUnicodeEscapeButton} from './repo-unicode-escape.js';
@@ -28,6 +28,7 @@ import createDropzone from './dropzone.js';
import {initCommentContent, initMarkupContent} from '../markup/content.js';
import {initCompReactionSelector} from './comp/ReactionSelector.js';
import {initRepoSettingBranches} from './repo-settings.js';
+import initRepoPullRequestMergeForm from './repo-issue-pr-form.js';
const {csrfToken} = window.config;
@@ -507,9 +508,10 @@ export function initRepository() {
initRepoIssueDependencyDelete();
initRepoIssueCodeCommentCancel();
initRepoIssueStatusButton();
- initRepoPullRequestMerge();
initRepoPullRequestUpdate();
initCompReactionSelector();
+
+ initRepoPullRequestMergeForm();
}
// Pull request