diff options
author | qwerty287 <80460567+qwerty287@users.noreply.github.com> | 2021-10-28 12:55:48 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-10-28 18:55:48 +0800 |
commit | f46e67b519eb65f6feb8abd04c5c896bfd2001ea (patch) | |
tree | 52c8aca12501b756d6fd050db41dd8d967ff344a /templates | |
parent | 54243eed8d9f9347785356c5a42510f918a2d258 (diff) | |
download | gitea-f46e67b519eb65f6feb8abd04c5c896bfd2001ea.tar.gz gitea-f46e67b519eb65f6feb8abd04c5c896bfd2001ea.zip |
Move key forms before list and add cancel button (#17432)
* Move GPG form before list and add cancel button
* Move SSH form before list and add cancel button
Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
Diffstat (limited to 'templates')
-rw-r--r-- | templates/repo/settings/deploy_keys.tmpl | 38 | ||||
-rw-r--r-- | templates/user/settings/keys_gpg.tmpl | 72 | ||||
-rw-r--r-- | templates/user/settings/keys_ssh.tmpl | 56 |
3 files changed, 78 insertions, 88 deletions
diff --git a/templates/repo/settings/deploy_keys.tmpl b/templates/repo/settings/deploy_keys.tmpl index 68ab36b593..019a62b5f1 100644 --- a/templates/repo/settings/deploy_keys.tmpl +++ b/templates/repo/settings/deploy_keys.tmpl @@ -4,16 +4,18 @@ {{template "repo/settings/navbar" .}} <div class="ui container"> {{template "base/alert" .}} - <div {{if not .HasError}}class="hide"{{end}} id="add-deploy-key-panel"> - <h4 class="ui top attached header"> - {{.i18n.Tr "repo.settings.add_deploy_key"}} - <div class="ui right"> - <button class="ui red tiny hide-panel button" data-panel="#add-deploy-key-panel"> - {{.i18n.Tr "cancel"}} - </button> - </div> - </h4> - <div class="ui attached segment"> + <h4 class="ui top attached header"> + {{.i18n.Tr "repo.settings.deploy_keys"}} + <div class="ui right"> + {{if not .DisableSSH}} + <div class="ui blue tiny show-panel button" data-panel="#add-deploy-key-panel">{{.i18n.Tr "repo.settings.add_deploy_key"}}</div> + {{else}} + <div class="ui blue tiny button disabled">{{.i18n.Tr "settings.ssh_disabled"}}</div> + {{end}} + </div> + </h4> + <div class="ui attached segment"> + <div class="{{if not .HasError}}hide{{end}} mb-4" id="add-deploy-key-panel"> <form class="ui form" action="{{.Link}}" method="post"> {{.CsrfTokenHtml}} <div class="field"> @@ -39,21 +41,11 @@ <button class="ui green button"> {{.i18n.Tr "repo.settings.add_deploy_key"}} </button> + <button class="ui hide-panel button" data-panel="#add-deploy-key-panel"> + {{.i18n.Tr "cancel"}} + </button> </form> </div> - <br> - </div> - <h4 class="ui top attached header"> - {{.i18n.Tr "repo.settings.deploy_keys"}} - <div class="ui right"> - {{if not .DisableSSH}} - <div class="ui blue tiny show-panel button" data-panel="#add-deploy-key-panel">{{.i18n.Tr "repo.settings.add_deploy_key"}}</div> - {{else}} - <div class="ui blue tiny button disabled">{{.i18n.Tr "settings.ssh_disabled"}}</div> - {{end}} - </div> - </h4> - <div class="ui attached segment"> {{if .Deploykeys}} <div class="ui key list"> {{range .Deploykeys}} diff --git a/templates/user/settings/keys_gpg.tmpl b/templates/user/settings/keys_gpg.tmpl index c840801e5a..20ccea9f00 100644 --- a/templates/user/settings/keys_gpg.tmpl +++ b/templates/user/settings/keys_gpg.tmpl @@ -5,7 +5,41 @@ </div> </h4> <div class="ui attached segment"> - <div class="ui key list"> + <div class="{{if not .HasGPGError}}hide{{end}} mb-4" id="add-gpg-key-panel"> + <form class="ui form{{if .HasGPGError}} error{{end}}" action="{{.Link}}" method="post"> + {{.CsrfTokenHtml}} + <input type="hidden" name="title" value="none"> + <div class="field {{if .Err_Content}}error{{end}}"> + <label for="content">{{.i18n.Tr "settings.key_content"}}</label> + <textarea id="gpg-key-content" name="content" placeholder="{{.i18n.Tr "settings.key_content_gpg_placeholder"}}" required>{{.content}}</textarea> + </div> + {{if .Err_Signature}} + <div class="ui error message"> + <p>{{.i18n.Tr "settings.gpg_token_required"}}</p> + </div> + <div class="field"> + <label for="token">{{.i18n.Tr "setting.gpg_token"}} + <input readonly="" value="{{.TokenToSign}}"> + <div class="help"> + <p>{{.i18n.Tr "settings.gpg_token_help"}}</p> + <p><code>{{$.i18n.Tr "settings.gpg_token_code" .TokenToSign .KeyID}}</code></p> + </div> + </div> + <div class="field"> + <label for="signature">{{.i18n.Tr "settings.gpg_token_signature"}}</label> + <textarea id="gpg-key-signature" name="signature" placeholder="{{.i18n.Tr "settings.key_signature_gpg_placeholder"}}" required>{{.signature}}</textarea> + </div> + {{end}} + <input name="type" type="hidden" value="gpg"> + <button class="ui green button"> + {{.i18n.Tr "settings.add_key"}} + </button> + <button class="ui hide-panel button" data-panel="#add-gpg-key-panel"> + {{.i18n.Tr "cancel"}} + </button> + </form> + </div> + <div class="ui key list mt-0"> <div class="item"> {{.i18n.Tr "settings.gpg_desc"}} </div> @@ -76,42 +110,6 @@ </div> <br> <p>{{.i18n.Tr "settings.gpg_helper" "https://docs.github.com/en/free-pro-team@latest/github/authenticating-to-github/about-commit-signature-verification#gpg-commit-signature-verification" | Str2html}}</p> -<div {{if not .HasGPGError}}class="hide"{{end}} id="add-gpg-key-panel"> - <h4 class="ui top attached header"> - {{.i18n.Tr "settings.add_new_gpg_key"}} - </h4> - <div class="ui attached segment"> - <form class="ui form{{if .HasGPGError}} error{{end}}" action="{{.Link}}" method="post"> - {{.CsrfTokenHtml}} - <input type="hidden" name="title" value="none"> - <div class="field {{if .Err_Content}}error{{end}}"> - <label for="content">{{.i18n.Tr "settings.key_content"}}</label> - <textarea id="gpg-key-content" name="content" placeholder="{{.i18n.Tr "settings.key_content_gpg_placeholder"}}" required>{{.content}}</textarea> - </div> - {{if .Err_Signature}} - <div class="ui error message"> - <p>{{.i18n.Tr "settings.gpg_token_required"}}</p> - </div> - <div class="field"> - <label for="token">{{.i18n.Tr "setting.gpg_token"}} - <input readonly="" value="{{.TokenToSign}}"> - <div class="help"> - <p>{{.i18n.Tr "settings.gpg_token_help"}}</p> - <p><code>{{$.i18n.Tr "settings.gpg_token_code" .TokenToSign .KeyID}}</code></p> - </div> - </div> - <div class="field"> - <label for="signature">{{.i18n.Tr "settings.gpg_token_signature"}}</label> - <textarea id="gpg-key-signature" name="signature" placeholder="{{.i18n.Tr "settings.key_signature_gpg_placeholder"}}" required>{{.signature}}</textarea> - </div> - {{end}} - <input name="type" type="hidden" value="gpg"> - <button class="ui green button"> - {{.i18n.Tr "settings.add_key"}} - </button> - </form> - </div> -</div> <div class="ui small basic delete modal" id="delete-gpg"> <div class="ui icon header"> diff --git a/templates/user/settings/keys_ssh.tmpl b/templates/user/settings/keys_ssh.tmpl index 3d05578666..b87318c789 100644 --- a/templates/user/settings/keys_ssh.tmpl +++ b/templates/user/settings/keys_ssh.tmpl @@ -1,15 +1,37 @@ <h4 class="ui top attached header"> {{.i18n.Tr "settings.manage_ssh_keys"}} <div class="ui right"> - {{if not .DisableSSH }} - <div class="ui blue tiny show-panel button" data-panel="#add-ssh-key-panel">{{.i18n.Tr "settings.add_key"}}</div> - {{else}} - <div class="ui blue tiny button disabled">{{.i18n.Tr "settings.ssh_disabled"}}</div> - {{end}} + {{if not .DisableSSH }} + <div id="add-ssh-button" class="ui blue tiny show-panel button" data-panel="#add-ssh-key-panel"> + {{.i18n.Tr "settings.add_key"}} + </div> + {{else}} + <div class="ui blue tiny button disabled">{{.i18n.Tr "settings.ssh_disabled"}}</div> + {{end}} </div> </h4> <div class="ui attached segment"> - <div class="ui key list"> + <div class="{{if not .HasSSHError}}hide{{end}} mb-4" id="add-ssh-key-panel"> + <form class="ui form" action="{{.Link}}" method="post"> + {{.CsrfTokenHtml}} + <div class="field {{if .Err_Title}}error{{end}}"> + <label for="title">{{.i18n.Tr "settings.key_name"}}</label> + <input id="ssh-key-title" name="title" value="{{.title}}" autofocus required> + </div> + <div class="field {{if .Err_Content}}error{{end}}"> + <label for="content">{{.i18n.Tr "settings.key_content"}}</label> + <textarea id="ssh-key-content" name="content" placeholder="{{.i18n.Tr "settings.key_content_ssh_placeholder"}}" required>{{.content}}</textarea> + </div> + <input name="type" type="hidden" value="ssh"> + <button class="ui green button"> + {{.i18n.Tr "settings.add_key"}} + </button> + <button id="cancel-ssh-button" class="ui hide-panel button" data-panel="#add-ssh-key-panel"> + {{.i18n.Tr "cancel"}} + </button> + </form> + </div> + <div class="ui key list mt-0"> <div class="item"> {{.i18n.Tr "settings.ssh_desc"}} </div> @@ -38,28 +60,6 @@ </div> <br> <p>{{.i18n.Tr "settings.ssh_helper" "https://docs.github.com/en/free-pro-team@latest/github/authenticating-to-github/connecting-to-github-with-ssh" "https://docs.github.com/en/free-pro-team@latest/github/authenticating-to-github/troubleshooting-ssh" | Str2html}}</p> -<div {{if not .HasSSHError}}class="hide"{{end}} id="add-ssh-key-panel"> - <h4 class="ui top attached header"> - {{.i18n.Tr "settings.add_new_key"}} - </h4> - <div class="ui attached segment"> - <form class="ui form" action="{{.Link}}" method="post"> - {{.CsrfTokenHtml}} - <div class="field {{if .Err_Title}}error{{end}}"> - <label for="title">{{.i18n.Tr "settings.key_name"}}</label> - <input id="ssh-key-title" name="title" value="{{.title}}" autofocus required> - </div> - <div class="field {{if .Err_Content}}error{{end}}"> - <label for="content">{{.i18n.Tr "settings.key_content"}}</label> - <textarea id="ssh-key-content" name="content" placeholder="{{.i18n.Tr "settings.key_content_ssh_placeholder"}}" required>{{.content}}</textarea> - </div> - <input name="type" type="hidden" value="ssh"> - <button class="ui green button"> - {{.i18n.Tr "settings.add_key"}} - </button> - </form> - </div> -</div> <div class="ui small basic delete modal" id="delete-ssh"> <div class="ui icon header"> |