aboutsummaryrefslogtreecommitdiffstats
path: root/templates/repo
diff options
context:
space:
mode:
authorzeripath <art27@cantab.net>2020-07-02 15:09:09 +0100
committerGitHub <noreply@github.com>2020-07-02 15:09:09 +0100
commit482ba937ed118d68448c5fe347ee7e43f5621c0b (patch)
tree328ac6693790909f816faedea45520493ac1f478 /templates/repo
parenta87a64e6a1f2e3e673fc24818bd17f7225f921f6 (diff)
downloadgitea-482ba937ed118d68448c5fe347ee7e43f5621c0b.tar.gz
gitea-482ba937ed118d68448c5fe347ee7e43f5621c0b.zip
Provide option to unlink a fork (#11858)
* Provide option to unlink a fork Fix #4566 Signed-off-by: Andrew Thornton <art27@cantab.net> * Apply suggestions from code review Co-authored-by: techknowlogick <matti@mdranta.net> * Add check that user can create repo Signed-off-by: Andrew Thornton <art27@cantab.net> * as per @cirnoT Signed-off-by: Andrew Thornton <art27@cantab.net> Co-authored-by: techknowlogick <matti@mdranta.net>
Diffstat (limited to 'templates/repo')
-rw-r--r--templates/repo/settings/options.tmpl109
1 files changed, 75 insertions, 34 deletions
diff --git a/templates/repo/settings/options.tmpl b/templates/repo/settings/options.tmpl
index c674fcf7f9..5666b8f956 100644
--- a/templates/repo/settings/options.tmpl
+++ b/templates/repo/settings/options.tmpl
@@ -358,17 +358,28 @@
</h4>
<div class="ui attached warning table danger segment">
{{if .Repository.IsMirror}}
- <div class="item">
- <div class="ui right">
- <button class="ui basic red show-modal button" data-modal="#convert-repo-modal">{{.i18n.Tr "repo.settings.convert"}}</button>
+ <div class="item">
+ <div class="ui right">
+ <button class="ui basic red show-modal button" data-modal="#convert-mirror-repo-modal">{{.i18n.Tr "repo.settings.convert"}}</button>
+ </div>
+ <div>
+ <h5>{{.i18n.Tr "repo.settings.convert"}}</h5>
+ <p>{{.i18n.Tr "repo.settings.convert_desc"}}</p>
+ </div>
</div>
- <div>
- <h5>{{.i18n.Tr "repo.settings.convert"}}</h5>
- <p>{{.i18n.Tr "repo.settings.convert_desc"}}</p>
+ <div class="ui divider"></div>
+ {{end}}
+ {{if and .Repository.IsFork .Repository.Owner.CanCreateRepo}}
+ <div class="item">
+ <div class="ui right">
+ <button class="ui basic red show-modal button" data-modal="#convert-fork-repo-modal">{{.i18n.Tr "repo.settings.convert_fork"}}</button>
+ </div>
+ <div>
+ <h5>{{.i18n.Tr "repo.settings.convert_fork"}}</h5>
+ <p>{{.i18n.Tr "repo.settings.convert_fork_desc"}}</p>
+ </div>
</div>
- </div>
-
- <div class="ui divider"></div>
+ <div class="ui divider"></div>
{{end}}
<div class="item">
<div class="ui right">
@@ -437,37 +448,67 @@
{{if .Permission.IsOwner}}
{{if .Repository.IsMirror}}
- <div class="ui small modal" id="convert-repo-modal">
- <div class="header">
- {{.i18n.Tr "repo.settings.convert"}}
- </div>
- <div class="content">
- <div class="ui warning message text left">
- {{.i18n.Tr "repo.settings.convert_notices_1"}}
+ <div class="ui small modal" id="convert-mirror-repo-modal">
+ <div class="header">
+ {{.i18n.Tr "repo.settings.convert"}}
</div>
- <form class="ui form" action="{{.Link}}" method="post">
- {{.CsrfTokenHtml}}
- <input type="hidden" name="action" value="convert">
- <div class="field">
- <label>
- {{.i18n.Tr "repo.settings.transfer_form_title"}}
- <span class="text red">{{.Repository.Name}}</span>
- </label>
- </div>
- <div class="required field">
- <label for="repo_name">{{.i18n.Tr "repo.repo_name"}}</label>
- <input id="repo_name" name="repo_name" required>
+ <div class="content">
+ <div class="ui warning message text left">
+ {{.i18n.Tr "repo.settings.convert_notices_1"}}
</div>
+ <form class="ui form" action="{{.Link}}" method="post">
+ {{.CsrfTokenHtml}}
+ <input type="hidden" name="action" value="convert">
+ <div class="field">
+ <label>
+ {{.i18n.Tr "repo.settings.transfer_form_title"}}
+ <span class="text red">{{.Repository.Name}}</span>
+ </label>
+ </div>
+ <div class="required field">
+ <label for="repo_name">{{.i18n.Tr "repo.repo_name"}}</label>
+ <input id="repo_name" name="repo_name" required>
+ </div>
- <div class="text right actions">
- <div class="ui cancel button">{{.i18n.Tr "settings.cancel"}}</div>
- <button class="ui red button">{{.i18n.Tr "repo.settings.convert_confirm"}}</button>
- </div>
- </form>
+ <div class="text right actions">
+ <div class="ui cancel button">{{.i18n.Tr "settings.cancel"}}</div>
+ <button class="ui red button">{{.i18n.Tr "repo.settings.convert_confirm"}}</button>
+ </div>
+ </form>
+ </div>
</div>
- </div>
{{end}}
+ {{if and .Repository.IsFork .Repository.Owner.CanCreateRepo}}
+ <div class="ui small modal" id="convert-fork-repo-modal">
+ <div class="header">
+ {{.i18n.Tr "repo.settings.convert_fork"}}
+ </div>
+ <div class="content">
+ <div class="ui warning message text left">
+ {{.i18n.Tr "repo.settings.convert_fork_notices_1"}}
+ </div>
+ <form class="ui form" action="{{.Link}}" method="post">
+ {{.CsrfTokenHtml}}
+ <input type="hidden" name="action" value="convert_fork">
+ <div class="field">
+ <label>
+ {{.i18n.Tr "repo.settings.transfer_form_title"}}
+ <span class="text red">{{.Repository.Name}}</span>
+ </label>
+ </div>
+ <div class="required field">
+ <label for="repo_name">{{.i18n.Tr "repo.repo_name"}}</label>
+ <input id="repo_name" name="repo_name" required>
+ </div>
+ <div class="text right actions">
+ <div class="ui cancel button">{{.i18n.Tr "settings.cancel"}}</div>
+ <button class="ui red button">{{.i18n.Tr "repo.settings.convert_fork_confirm"}}</button>
+ </div>
+ </form>
+ </div>
+ </div>
+ {{end}}
<div class="ui small modal" id="transfer-repo-modal">
<div class="header">
{{.i18n.Tr "repo.settings.transfer"}}