Skip to content

Commit

Permalink
Improve html, rm js
Browse files Browse the repository at this point in the history
  • Loading branch information
qwerty287 committed Oct 26, 2021
1 parent 266ed1f commit 2d37e9b
Show file tree
Hide file tree
Showing 4 changed files with 33 additions and 63 deletions.
38 changes: 15 additions & 23 deletions templates/repo/settings/deploy_keys.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -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">
Expand All @@ -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}}
Expand Down
31 changes: 12 additions & 19 deletions templates/user/settings/keys_gpg.tmpl
Original file line number Diff line number Diff line change
@@ -1,13 +1,11 @@
<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"}}
<div class="ui right">
<button class="ui red tiny hide-panel button" data-panel="#add-gpg-key-panel">
{{.i18n.Tr "cancel"}}
</button>
</div>
</h4>
<div class="ui attached segment">
<h4 class="ui top attached header">
{{.i18n.Tr "settings.manage_gpg_keys"}}
<div class="ui right">
<div class="ui blue tiny show-panel button" data-panel="#add-gpg-key-panel">{{.i18n.Tr "settings.add_key"}}</div>
</div>
</h4>
<div class="ui attached segment">
<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">
Expand Down Expand Up @@ -36,17 +34,12 @@
<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>
<h4 class="ui top attached header">
{{.i18n.Tr "settings.manage_gpg_keys"}}
<div class="ui right">
<div class="ui blue tiny show-panel button" data-panel="#add-gpg-key-panel">{{.i18n.Tr "settings.add_key"}}</div>
</div>
</h4>
<div class="ui attached segment">
<div class="ui key list">
<div class="ui key list mt-0">
<div class="item">
{{.i18n.Tr "settings.gpg_desc"}}
</div>
Expand Down
8 changes: 4 additions & 4 deletions templates/user/settings/keys_ssh.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,12 @@
{{.i18n.Tr "settings.manage_ssh_keys"}}
<div class="ui right">
{{if not .DisableSSH }}
<div id="add-ssh-button" class="ui blue tiny show-panel button" data-toggle-button="#cancel-ssh-button" data-panel="#add-ssh-key-panel">
<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}}
<button id="cancel-ssh-button" class="ui red tiny hide-panel button" data-toggle-button="#add-ssh-button" data-panel="#add-ssh-key-panel" style="display: none;">
{{.i18n.Tr "cancel"}}
</button>
</div>
</h4>
<div class="ui attached segment">
Expand All @@ -29,6 +26,9 @@
<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">
Expand Down
19 changes: 2 additions & 17 deletions web_src/js/features/common-global.js
Original file line number Diff line number Diff line change
Expand Up @@ -292,26 +292,11 @@ function handlePanelButtonToggle($btn) {

export function initGlobalButtons() {
$('.show-panel.button').on('click', function () {
if ($($(this).data('panel')).is(":visible")) {
$($(this).data('panel')).hide();
} else {
$($(this).data('panel')).show();
}
handlePanelButtonToggle($(this));
$($(this).data('panel')).show();
});

$('.hide-panel.button').on('click', function () {
if ($($(this).data('panel')).is(":visible")) {
$($(this).data('panel')).hide();
} else {
$($(this).data('panel')).show();
}
handlePanelButtonToggle($(this));
});

$('.swap.button').on('click', function () {
$($(this).data('show-button')).show();
$(this).hide();
$($(this).data('panel')).hide();
});

$('.show-modal.button').on('click', function () {
Expand Down

0 comments on commit 2d37e9b

Please sign in to comment.