File tree Expand file tree Collapse file tree 2 files changed +21
-4
lines changed Expand file tree Collapse file tree 2 files changed +21
-4
lines changed Original file line number Diff line number Diff line change 2
2
{{.i18n.Tr "settings.manage_ssh_keys"}}
3
3
<div class="ui right">
4
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">
5
+ <div id="add-ssh-button" class="ui blue tiny show-panel button" data-toggle -button="#cancel-ssh-button" data-panel="#add-ssh-key-panel">
6
6
{{.i18n.Tr "settings.add_key"}}
7
7
</div>
8
8
{{else}}
9
9
<div class="ui blue tiny button disabled">{{.i18n.Tr "settings.ssh_disabled"}}</div>
10
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;">
11
+ <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;">
12
12
{{.i18n.Tr "cancel"}}
13
13
</button>
14
14
</div>
Original file line number Diff line number Diff line change @@ -283,13 +283,30 @@ export function initGlobalLinkActions() {
283
283
} ) ;
284
284
}
285
285
286
+ function handlePanelButtonToggle ( $btn ) {
287
+ const toggleButton = $btn . data ( 'toggle-button' ) ;
288
+ if ( ! toggleButton ) return ;
289
+ $ ( toggleButton ) . show ( ) ;
290
+ $btn . hide ( ) ;
291
+ }
292
+
286
293
export function initGlobalButtons ( ) {
287
294
$ ( '.show-panel.button' ) . on ( 'click' , function ( ) {
288
- $ ( $ ( this ) . data ( 'panel' ) ) . show ( ) ;
295
+ if ( $ ( $ ( this ) . data ( 'panel' ) ) . is ( ":visible" ) ) {
296
+ $ ( $ ( this ) . data ( 'panel' ) ) . hide ( ) ;
297
+ } else {
298
+ $ ( $ ( this ) . data ( 'panel' ) ) . show ( ) ;
299
+ }
300
+ handlePanelButtonToggle ( $ ( this ) ) ;
289
301
} ) ;
290
302
291
303
$ ( '.hide-panel.button' ) . on ( 'click' , function ( ) {
292
- $ ( $ ( this ) . data ( 'panel' ) ) . hide ( ) ;
304
+ if ( $ ( $ ( this ) . data ( 'panel' ) ) . is ( ":visible" ) ) {
305
+ $ ( $ ( this ) . data ( 'panel' ) ) . hide ( ) ;
306
+ } else {
307
+ $ ( $ ( this ) . data ( 'panel' ) ) . show ( ) ;
308
+ }
309
+ handlePanelButtonToggle ( $ ( this ) ) ;
293
310
} ) ;
294
311
295
312
$ ( '.swap.button' ) . on ( 'click' , function ( ) {
You can’t perform that action at this time.
0 commit comments