diff options
author | Julien Tant <julien@craftyx.fr> | 2018-08-13 21:04:39 +0200 |
---|---|---|
committer | Lauris BH <lauris@nix.lv> | 2018-08-13 22:04:39 +0300 |
commit | 7781e8cef2dfe73d71be7804f4c5a7c5f1995d31 (patch) | |
tree | 7bbe6d2a031655478538e152912182f5ad3500eb /templates/repo/issue | |
parent | 52c2cb15db77a381880db7e44f133a49b3516dd5 (diff) | |
download | gitea-7781e8cef2dfe73d71be7804f4c5a7c5f1995d31.tar.gz gitea-7781e8cef2dfe73d71be7804f4c5a7c5f1995d31.zip |
Disable merging a WIP Pull request (#4529)
* prevent pull request to be merged when PR is a WIP
* add tests
* add helper to prepend WIP: in PR title
* move default wip prefixes into settings
* use configurable WIP prefixes in javascript and default to first one in templates
* add documentation
* add unit test on pull model
Signed-off-by: Julien Tant <julien@craftyx.fr>
Diffstat (limited to 'templates/repo/issue')
-rw-r--r-- | templates/repo/issue/new_form.tmpl | 9 | ||||
-rw-r--r-- | templates/repo/issue/view_content/pull.tmpl | 6 |
2 files changed, 14 insertions, 1 deletions
diff --git a/templates/repo/issue/new_form.tmpl b/templates/repo/issue/new_form.tmpl index e904ca4ba7..943a9b2467 100644 --- a/templates/repo/issue/new_form.tmpl +++ b/templates/repo/issue/new_form.tmpl @@ -13,7 +13,10 @@ </a> <div class="ui segment content"> <div class="field"> - <input name="title" placeholder="{{.i18n.Tr "repo.milestones.title"}}" value="{{.title}}" tabindex="3" autofocus required> + <input name="title" id="issue_title" placeholder="{{.i18n.Tr "repo.milestones.title"}}" value="{{.title}}" tabindex="3" autofocus required> + {{if .PageIsComparePull}} + <span class="title_wip_desc">{{.i18n.Tr "repo.pulls.title_wip_desc" (index .PullRequestWorkInProgressPrefixes 0) | Safe}}</span> + {{end}} </div> {{template "repo/issue/comment_tab" .}} <div class="text right"> @@ -150,3 +153,7 @@ </div> </div> </form> +{{if .PageIsComparePull}} + <script>window.wipPrefixes = {{.PullRequestWorkInProgressPrefixes}}</script> +{{end}} + diff --git a/templates/repo/issue/view_content/pull.tmpl b/templates/repo/issue/view_content/pull.tmpl index 9c9dd290a3..92bfc86cb4 100644 --- a/templates/repo/issue/view_content/pull.tmpl +++ b/templates/repo/issue/view_content/pull.tmpl @@ -2,6 +2,7 @@ <a class="avatar text {{if .Issue.PullRequest.HasMerged}}purple {{else if .Issue.IsClosed}}grey + {{else if .IsPullWorkInProgress}}grey {{else if .IsPullRequestBroken}}red {{else if .Issue.PullRequest.IsChecking}}yellow {{else if .Issue.PullRequest.CanAutoMerge}}green @@ -27,6 +28,11 @@ <span class="octicon octicon-x"></span> {{$.i18n.Tr "repo.pulls.data_broken"}} </div> + {{else if .IsPullWorkInProgress}} + <div class="item text grey"> + <span class="octicon octicon-x"></span> + {{$.i18n.Tr "repo.pulls.cannot_merge_work_in_progress" .WorkInProgressPrefix | Str2html}} + </div> {{else if .Issue.PullRequest.IsChecking}} <div class="item text yellow"> <span class="octicon octicon-sync"></span> |