Skip to content

Commit 323d760

Browse files
committed
Fix various broken shortcuts. 'Enter' key in add/edit forms, Ctr+Backspace and others
1 parent 4c44033 commit 323d760

File tree

7 files changed

+64
-29
lines changed

7 files changed

+64
-29
lines changed

web/css/styles.min.css

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1616,6 +1616,7 @@ div.l-content > div.l-separator:nth-of-type(4) {
16161616
}
16171617
.units.active .l-unit.focus {
16181618
border-left: 2px solid #5edad0;
1619+
background-color: #eff5fc;
16191620
}
16201621
.units.active .l-unit.focus .l-unit__name {
16211622
color: #36b3a9;

web/js/init.js

Lines changed: 52 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -180,8 +180,8 @@ $(document).ready(function(){
180180
VE.helpers.createConfirmationDialog($('.confirmation-text-redirect'), '', $('form#vstobjects input.cancel').attr('onclick').replace("location.href='", "").replace("'",""));
181181
} else if($('form#vstobjects .button.cancel')[0]){
182182
location.href=$('form#vstobjects input.cancel').attr('onclick').replace("location.href='", "").replace("'","");
183-
} else if($('#vstobjects a.button.cancel')[0]){
184-
location.href=$('#vstobjects a.button.cancel').attr('href');
183+
} else if($('a.ui-button.cancel')[0]){
184+
location.href=$('a.ui-button.cancel').attr('href');
185185
}
186186
}, {
187187
'type': 'keydown',
@@ -225,10 +225,14 @@ $(document).ready(function(){
225225
});
226226

227227
shortcut.add("1", function(){
228+
var target = $('.l-stat .l-stat__col:nth-of-type(1) a')
229+
if(target.length != 1){
230+
return;
231+
}
228232
if(VE.tmp.form_changed){
229-
VE.helpers.createConfirmationDialog($('.confirmation-text-redirect'), '', $('.l-stat .l-stat__col:nth-of-type(1) a').attr('href'));
233+
VE.helpers.createConfirmationDialog($('.confirmation-text-redirect'), '', target.attr('href'));
230234
} else {
231-
location.href=$('.l-stat .l-stat__col:nth-of-type(1) a').attr('href');
235+
location.href=target.attr('href');
232236
}
233237
}, {
234238
'type': 'keydown',
@@ -239,10 +243,14 @@ $(document).ready(function(){
239243
);
240244

241245
shortcut.add("2", function(){
246+
var target = $('.l-stat .l-stat__col:nth-of-type(2) a')
247+
if(target.length != 1){
248+
return;
249+
}
242250
if(VE.tmp.form_changed){
243-
VE.helpers.createConfirmationDialog($('.confirmation-text-redirect'), '', $('.l-stat .l-stat__col:nth-of-type(2) a').attr('href'));
251+
VE.helpers.createConfirmationDialog($('.confirmation-text-redirect'), '', target.attr('href'));
244252
} else {
245-
location.href=$('.l-stat .l-stat__col:nth-of-type(2) a').attr('href');
253+
location.href=target.attr('href');
246254
}
247255
}, {
248256
'type': 'keydown',
@@ -253,10 +261,14 @@ $(document).ready(function(){
253261
);
254262

255263
shortcut.add("3", function(){
264+
var target = $('.l-stat .l-stat__col:nth-of-type(3) a')
265+
if(target.length != 1){
266+
return;
267+
}
256268
if(VE.tmp.form_changed){
257-
VE.helpers.createConfirmationDialog($('.confirmation-text-redirect'), '', $('.l-stat .l-stat__col:nth-of-type(3) a').attr('href'));
269+
VE.helpers.createConfirmationDialog($('.confirmation-text-redirect'), '', target.attr('href'));
258270
} else {
259-
location.href=$('.l-stat .l-stat__col:nth-of-type(3) a').attr('href');
271+
location.href=target.attr('href');
260272
}
261273
}, {
262274
'type': 'keydown',
@@ -267,10 +279,14 @@ $(document).ready(function(){
267279
);
268280

269281
shortcut.add("4", function(){
282+
var target = $('.l-stat .l-stat__col:nth-of-type(4) a')
283+
if(target.length != 1){
284+
return;
285+
}
270286
if(VE.tmp.form_changed){
271-
VE.helpers.createConfirmationDialog($('.confirmation-text-redirect'), '', $('.l-stat .l-stat__col:nth-of-type(4) a').attr('href'));
287+
VE.helpers.createConfirmationDialog($('.confirmation-text-redirect'), '', target.attr('href'));
272288
} else {
273-
location.href=$('.l-stat .l-stat__col:nth-of-type(4) a').attr('href');
289+
location.href=target.attr('href');
274290
}
275291
}, {
276292
'type': 'keydown',
@@ -281,10 +297,14 @@ $(document).ready(function(){
281297
);
282298

283299
shortcut.add("5", function(){
300+
var target = $('.l-stat .l-stat__col:nth-of-type(5) a')
301+
if(target.length != 1){
302+
return;
303+
}
284304
if(VE.tmp.form_changed){
285-
VE.helpers.createConfirmationDialog($('.confirmation-text-redirect'), '', $('.l-stat .l-stat__col:nth-of-type(5) a').attr('href'));
305+
VE.helpers.createConfirmationDialog($('.confirmation-text-redirect'), '', target.attr('href'));
286306
} else {
287-
location.href=$('.l-stat .l-stat__col:nth-of-type(5) a').attr('href');
307+
location.href=target.attr('href');
288308
}
289309
}, {
290310
'type': 'keydown',
@@ -295,10 +315,14 @@ $(document).ready(function(){
295315
);
296316

297317
shortcut.add("6", function(){
318+
var target = $('.l-stat .l-stat__col:nth-of-type(6) a')
319+
if(target.length != 1){
320+
return;
321+
}
298322
if(VE.tmp.form_changed){
299-
VE.helpers.createConfirmationDialog($('.confirmation-text-redirect'), '', $('.l-stat .l-stat__col:nth-of-type(6) a').attr('href'));
323+
VE.helpers.createConfirmationDialog($('.confirmation-text-redirect'), '', target.attr('href'));
300324
} else {
301-
location.href=$('.l-stat .l-stat__col:nth-of-type(6) a').attr('href');
325+
location.href=target.attr('href');
302326
}
303327
}, {
304328
'type': 'keydown',
@@ -309,10 +333,14 @@ $(document).ready(function(){
309333
);
310334

311335
shortcut.add("7", function(){
336+
var target = $('.l-stat .l-stat__col:nth-of-type(7) a')
337+
if(target.length != 1){
338+
return;
339+
}
312340
if(VE.tmp.form_changed){
313-
VE.helpers.createConfirmationDialog($('.confirmation-text-redirect'), '', $('.l-stat .l-stat__col:nth-of-type(7) a').attr('href'));
341+
VE.helpers.createConfirmationDialog($('.confirmation-text-redirect'), '', target.attr('href'));
314342
} else {
315-
location.href=$('.l-stat .l-stat__col:nth-of-type(7) a').attr('href');
343+
location.href=target.attr('href');
316344
}
317345
}, {
318346
'type': 'keydown',
@@ -490,7 +518,12 @@ $(document).ready(function(){
490518
}
491519
);
492520

493-
shortcut.add("Enter", function(){
521+
shortcut.add("Enter", function(evt){
522+
523+
if (evt.target.tagName == 'INPUT' && evt.target.form.id == 'vstobjects'){
524+
$('form#vstobjects').submit();
525+
}
526+
494527
if(VE.tmp.form_changed){
495528
if(!$('.ui-dialog').is(':visible')){
496529
VE.helpers.createConfirmationDialog($('.confirmation-text-redirect')[0], '', $(VE.navigation.state.menu_selector + '.focus a').attr('href'));
@@ -511,8 +544,8 @@ $(document).ready(function(){
511544
}
512545
}, {
513546
'type': 'keydown',
514-
'propagate': false,
515-
'disable_in_input': true,
547+
'propagate': true,
548+
'disable_in_input': false,
516549
'target': document
517550
}
518551
);

web/templates/admin/list_backup.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@
8080
<div class="l-unit-toolbar__col l-unit-toolbar__col--right noselect">
8181
<div class="actions-panel clearfix">
8282
<div class="actions-panel__col actions-panel__download shortcut-d" key-action="href"><a href="/download/backup/?backup=<?=$key?>&token=<?=$_SESSION['token']?>" title="<?=__('download')?>"><i class="fas fa-file-download status-icon lightblue status-icon dim"></i></a></div>
83-
<div class="actions-panel__col actions-panel__list shortcut-d" key-action="href"><a href="/list/backup/?backup=<?=$key?>&token=<?=$_SESSION['token']?>" title="<?=__('restore')?>"><i class="fas fa-undo status-icon green status-icon dim"></i></a></div>
83+
<div class="actions-panel__col actions-panel__list shortcut-enter" key-action="href"><a href="/list/backup/?backup=<?=$key?>&token=<?=$_SESSION['token']?>" title="<?=__('restore')?>"><i class="fas fa-undo status-icon green status-icon dim"></i></a></div>
8484
<div class="actions-panel__col actions-panel__delete shortcut-delete" key-action="js">
8585
<a id="delete_link_<?=$i?>" class="data-controls do_delete" title="<?=__('delete')?>">
8686
<i class="fas fa-trash status-icon red status-icon dim do_delete"></i>

web/templates/admin/list_cron.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@
9292
<div class="clearfix l-unit__stat-col--left compact-2 text-right">
9393
<div class="l-unit-toolbar__col l-unit-toolbar__col--right noselect">
9494
<div class="actions-panel clearfix">
95-
<div class="actions-panel__col actions-panel__download shortcut-d" key-action="href"><a href="/edit/cron/?job=<?=$data[$key]['JOB']?>&token=<?=$_SESSION['token']?>" title="<?=__('Editing Cron Job')?>"><i class="fas fa-pencil-alt status-icon orange status-icon dim"></i></a></div>
95+
<div class="actions-panel__col actions-panel__download shortcut-enter" key-action="href"><a href="/edit/cron/?job=<?=$data[$key]['JOB']?>&token=<?=$_SESSION['token']?>" title="<?=__('Editing Cron Job')?>"><i class="fas fa-pencil-alt status-icon orange status-icon dim"></i></a></div>
9696
<div class="actions-panel__col actions-panel__suspend shortcut-s" key-action="js">
9797
<a id="<?=$spnd_action ?>_link_<?=$i?>" class="data-controls do_<?=$spnd_action?>" title="<?=__($spnd_action)?>">
9898
<i class="fas fa-pause status-icon highlight status-icon dim do_<?=$spnd_action?>"></i>

web/templates/admin/list_services.html

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,9 @@
106106
</div>
107107
<div class="clearfix l-unit__stat-col--left wide-2"><b><a href="/edit/server/<? echo $key ?>/" title="<?=__('edit')?>"><?=$key?></a></b></div>
108108
<div class="clearfix l-unit__stat-col--left text-center compact-2">
109+
<div class="actions-panel__col actions-panel__edit shortcut-enter" key-action="href">
109110
<a href="/edit/server/<? echo $key ?>/" title="<?=__('edit')?>"><i class="fas fa-pencil-alt status-icon orange status-icon dim icon-large"></i></a>
111+
</div>
110112
<a href="/restart/service/?srv=<?=$key?>&token=<?=$_SESSION['token']?>" title="<?=__('restart')?>"><i class="data-controls fas fa-undo status-icon highlight status-icon dim icon-large"></i></a>
111113
<a href="/<?php echo $action ?>/service/?srv=<?=$key?>&token=<?=$_SESSION['token']?>" title="<?=__($action)?>"><i class="fas fa-pause status-icon red status-icon dim icon-large"></i></a>
112114
</div>

web/templates/footer.html

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -15,13 +15,12 @@
1515
<li><span class="key">Ctrl + Enter</span><?=__('Save Form')?></li>
1616
<li><span class="key">Ctrl + Backspace</span><?=__('Cancel saving form')?></li>
1717

18-
<li class="step-top"><span class="key">1</span><?=__('Go to USER list')?></li>
19-
<li><span class="key">2</span><?=__('Go to WEB list')?></li>
20-
<li><span class="key">3</span><?=__('Go to DNS list')?></li>
21-
<li><span class="key">4</span><?=__('Go to MAIL list')?></li>
22-
<li><span class="key">5</span><?=__('Go to DB list')?></li>
23-
<li><span class="key">6</span><?=__('Go to CRON list')?></li>
24-
<li><span class="key">7</span><?=__('Go to BACKUP list')?></li>
18+
<li class="step-top"><span class="key">1</span><?=__('Go to WEB list')?></li>
19+
<li><span class="key">2</span><?=__('Go to DNS list')?></li>
20+
<li><span class="key">3</span><?=__('Go to MAIL list')?></li>
21+
<li><span class="key">4</span><?=__('Go to DB list')?></li>
22+
<li><span class="key">5</span><?=__('Go to CRON list')?></li>
23+
<li><span class="key">6</span><?=__('Go to BACKUP list')?></li>
2524
</ul>
2625
<ul>
2726
<li><span class="key">f</span><?=__('Focus on search')?></li>

web/templates/user/list_cron.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@
9292
<div class="clearfix l-unit__stat-col--left compact-2 text-right">
9393
<div class="l-unit-toolbar__col l-unit-toolbar__col--right noselect">
9494
<div class="actions-panel clearfix">
95-
<div class="actions-panel__col actions-panel__download shortcut-d" key-action="href"><a href="/edit/cron/?job=<?=$data[$key]['JOB']?>&token=<?=$_SESSION['token']?>" title="<?=__('Editing Cron Job')?>"><i class="fas fa-pencil-alt status-icon orange status-icon dim"></i></a></div>
95+
<div class="actions-panel__col actions-panel__download shortcut-enter" key-action="href"><a href="/edit/cron/?job=<?=$data[$key]['JOB']?>&token=<?=$_SESSION['token']?>" title="<?=__('Editing Cron Job')?>"><i class="fas fa-pencil-alt status-icon orange status-icon dim"></i></a></div>
9696
<div class="actions-panel__col actions-panel__suspend shortcut-s" key-action="js">
9797
<a id="<?=$spnd_action ?>_link_<?=$i?>" class="data-controls do_<?=$spnd_action?>" title="<?=__($spnd_action)?>">
9898
<i class="fas fa-pause status-icon highlight status-icon dim do_<?=$spnd_action?>"></i>

0 commit comments

Comments
 (0)