Skip to content

Commit 39d8d9d

Browse files
committed
Move form into list
1 parent 441f43b commit 39d8d9d

File tree

2 files changed

+23
-23
lines changed

2 files changed

+23
-23
lines changed

templates/user/settings/keys_ssh.tmpl

Lines changed: 18 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,20 @@
1-
<div {{if not .HasSSHError}}class="hide"{{end}} id="add-ssh-key-panel">
2-
<h4 class="ui top attached header">
3-
{{.i18n.Tr "settings.add_new_key"}}
4-
<div class="ui right">
5-
<button class="ui red tiny hide-panel button" data-panel="#add-ssh-key-panel">
6-
{{.i18n.Tr "cancel"}}
7-
</button>
8-
</div>
9-
</h4>
10-
<div class="ui attached segment">
1+
<h4 class="ui top attached header">
2+
{{.i18n.Tr "settings.manage_ssh_keys"}}
3+
<div class="ui right">
4+
{{if not .DisableSSH }}
5+
<div id="add-ssh-button" class="ui blue tiny show-panel swap button" data-show-button="#cancel-ssh-button" data-panel="#add-ssh-key-panel">
6+
{{.i18n.Tr "settings.add_key"}}
7+
</div>
8+
{{else}}
9+
<div class="ui blue tiny button disabled">{{.i18n.Tr "settings.ssh_disabled"}}</div>
10+
{{end}}
11+
<button id="cancel-ssh-button" class="ui red tiny hide-panel swap button" data-show-button="#add-ssh-button" data-panel="#add-ssh-key-panel" style="display: none;">
12+
{{.i18n.Tr "cancel"}}
13+
</button>
14+
</div>
15+
</h4>
16+
<div class="ui attached segment">
17+
<div class="{{if not .HasSSHError}}hide{{end}} mb-4" id="add-ssh-key-panel">
1118
<form class="ui form" action="{{.Link}}" method="post">
1219
{{.CsrfTokenHtml}}
1320
<div class="field {{if .Err_Title}}error{{end}}">
@@ -24,19 +31,7 @@
2431
</button>
2532
</form>
2633
</div>
27-
</div>
28-
<h4 class="ui top attached header">
29-
{{.i18n.Tr "settings.manage_ssh_keys"}}
30-
<div class="ui right">
31-
{{if not .DisableSSH }}
32-
<div class="ui blue tiny show-panel button" data-panel="#add-ssh-key-panel">{{.i18n.Tr "settings.add_key"}}</div>
33-
{{else}}
34-
<div class="ui blue tiny button disabled">{{.i18n.Tr "settings.ssh_disabled"}}</div>
35-
{{end}}
36-
</div>
37-
</h4>
38-
<div class="ui attached segment">
39-
<div class="ui key list">
34+
<div class="ui key list mt-0">
4035
<div class="item">
4136
{{.i18n.Tr "settings.ssh_desc"}}
4237
</div>

web_src/js/features/common-global.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -292,6 +292,11 @@ export function initGlobalButtons() {
292292
$($(this).data('panel')).hide();
293293
});
294294

295+
$('.swap.button').on('click', function () {
296+
$($(this).data('show-button')).show();
297+
$(this).hide();
298+
});
299+
295300
$('.show-modal.button').on('click', function () {
296301
$($(this).data('modal')).modal('show');
297302
const colorPickers = $($(this).data('modal')).find('.color-picker');

0 commit comments

Comments
 (0)