Răsfoiți Sursa

Fix various broken shortcuts. 'Enter' key in add/edit forms, Ctr+Backspace and others

Robert Zollner 6 ani în urmă
părinte
comite
323d7608ba

+ 1 - 0
web/css/styles.min.css

@@ -1616,6 +1616,7 @@ div.l-content > div.l-separator:nth-of-type(4) {
 }
 .units.active .l-unit.focus {
   border-left: 2px solid #5edad0;
+  background-color: #eff5fc;
 }
 .units.active .l-unit.focus .l-unit__name {
   color: #36b3a9;

+ 52 - 19
web/js/init.js

@@ -180,8 +180,8 @@ $(document).ready(function(){
                   VE.helpers.createConfirmationDialog($('.confirmation-text-redirect'), '', $('form#vstobjects input.cancel').attr('onclick').replace("location.href='", "").replace("'",""));
                 } else if($('form#vstobjects .button.cancel')[0]){
                   location.href=$('form#vstobjects input.cancel').attr('onclick').replace("location.href='", "").replace("'","");
-                } else if($('#vstobjects a.button.cancel')[0]){
-                  location.href=$('#vstobjects a.button.cancel').attr('href');
+                } else if($('a.ui-button.cancel')[0]){
+                  location.href=$('a.ui-button.cancel').attr('href');
                 }
               }, {
                   'type':             'keydown',
@@ -225,10 +225,14 @@ $(document).ready(function(){
               });
 
               shortcut.add("1", function(){
+                var target = $('.l-stat .l-stat__col:nth-of-type(1) a')
+                if(target.length != 1){
+                  return;
+                }
                 if(VE.tmp.form_changed){
-                  VE.helpers.createConfirmationDialog($('.confirmation-text-redirect'), '', $('.l-stat .l-stat__col:nth-of-type(1) a').attr('href'));
+                  VE.helpers.createConfirmationDialog($('.confirmation-text-redirect'), '', target.attr('href'));
                 } else {
-                  location.href=$('.l-stat .l-stat__col:nth-of-type(1) a').attr('href');
+                  location.href=target.attr('href');
                 }
               }, {
                   'type':             'keydown',
@@ -239,10 +243,14 @@ $(document).ready(function(){
               );
 
               shortcut.add("2", function(){
+                var target = $('.l-stat .l-stat__col:nth-of-type(2) a')
+                if(target.length != 1){
+                  return;
+                }
                 if(VE.tmp.form_changed){
-                  VE.helpers.createConfirmationDialog($('.confirmation-text-redirect'), '', $('.l-stat .l-stat__col:nth-of-type(2) a').attr('href'));
+                  VE.helpers.createConfirmationDialog($('.confirmation-text-redirect'), '', target.attr('href'));
                 } else {
-                  location.href=$('.l-stat .l-stat__col:nth-of-type(2) a').attr('href');
+                  location.href=target.attr('href');
                 }
               }, {
                   'type':             'keydown',
@@ -253,10 +261,14 @@ $(document).ready(function(){
               );
 
               shortcut.add("3", function(){
+                var target = $('.l-stat .l-stat__col:nth-of-type(3) a')
+                if(target.length != 1){
+                  return;
+                }
                 if(VE.tmp.form_changed){
-                  VE.helpers.createConfirmationDialog($('.confirmation-text-redirect'), '', $('.l-stat .l-stat__col:nth-of-type(3) a').attr('href'));
+                  VE.helpers.createConfirmationDialog($('.confirmation-text-redirect'), '', target.attr('href'));
                 } else {
-                  location.href=$('.l-stat .l-stat__col:nth-of-type(3) a').attr('href');
+                  location.href=target.attr('href');
                 }
               }, {
                   'type':             'keydown',
@@ -267,10 +279,14 @@ $(document).ready(function(){
               );
 
               shortcut.add("4", function(){
+                var target = $('.l-stat .l-stat__col:nth-of-type(4) a')
+                if(target.length != 1){
+                  return;
+                }
                 if(VE.tmp.form_changed){
-                  VE.helpers.createConfirmationDialog($('.confirmation-text-redirect'), '', $('.l-stat .l-stat__col:nth-of-type(4) a').attr('href'));
+                  VE.helpers.createConfirmationDialog($('.confirmation-text-redirect'), '', target.attr('href'));
                 } else {
-                  location.href=$('.l-stat .l-stat__col:nth-of-type(4) a').attr('href');
+                  location.href=target.attr('href');
                 }
               }, {
                   'type':             'keydown',
@@ -281,10 +297,14 @@ $(document).ready(function(){
               );
 
               shortcut.add("5", function(){
+                var target = $('.l-stat .l-stat__col:nth-of-type(5) a')
+                if(target.length != 1){
+                  return;
+                }
                 if(VE.tmp.form_changed){
-                  VE.helpers.createConfirmationDialog($('.confirmation-text-redirect'), '', $('.l-stat .l-stat__col:nth-of-type(5) a').attr('href'));
+                  VE.helpers.createConfirmationDialog($('.confirmation-text-redirect'), '', target.attr('href'));
                 } else {
-                  location.href=$('.l-stat .l-stat__col:nth-of-type(5) a').attr('href');
+                  location.href=target.attr('href');
                 }
               }, {
                   'type':             'keydown',
@@ -295,10 +315,14 @@ $(document).ready(function(){
               );
 
               shortcut.add("6", function(){
+                var target = $('.l-stat .l-stat__col:nth-of-type(6) a')
+                if(target.length != 1){
+                  return;
+                }
                 if(VE.tmp.form_changed){
-                  VE.helpers.createConfirmationDialog($('.confirmation-text-redirect'), '', $('.l-stat .l-stat__col:nth-of-type(6) a').attr('href'));
+                  VE.helpers.createConfirmationDialog($('.confirmation-text-redirect'), '', target.attr('href'));
                 } else {
-                  location.href=$('.l-stat .l-stat__col:nth-of-type(6) a').attr('href');
+                  location.href=target.attr('href');
                 }
               }, {
                   'type':             'keydown',
@@ -309,10 +333,14 @@ $(document).ready(function(){
               );
 
               shortcut.add("7", function(){
+                var target = $('.l-stat .l-stat__col:nth-of-type(7) a')
+                if(target.length != 1){
+                  return;
+                }
                 if(VE.tmp.form_changed){
-                  VE.helpers.createConfirmationDialog($('.confirmation-text-redirect'), '', $('.l-stat .l-stat__col:nth-of-type(7) a').attr('href'));
+                  VE.helpers.createConfirmationDialog($('.confirmation-text-redirect'), '', target.attr('href'));
                 } else {
-                  location.href=$('.l-stat .l-stat__col:nth-of-type(7) a').attr('href');
+                  location.href=target.attr('href');
                 }
               }, {
                   'type':             'keydown',
@@ -490,7 +518,12 @@ $(document).ready(function(){
                   }
               );
 
-              shortcut.add("Enter", function(){
+              shortcut.add("Enter", function(evt){
+
+                if (evt.target.tagName == 'INPUT' && evt.target.form.id == 'vstobjects'){
+                  $('form#vstobjects').submit();
+                }
+
                 if(VE.tmp.form_changed){
                   if(!$('.ui-dialog').is(':visible')){
                     VE.helpers.createConfirmationDialog($('.confirmation-text-redirect')[0], '', $(VE.navigation.state.menu_selector + '.focus a').attr('href'));
@@ -511,8 +544,8 @@ $(document).ready(function(){
                 }
               }, {
                   'type':             'keydown',
-                  'propagate':        false,
-                  'disable_in_input': true,
+                  'propagate':        true,
+                  'disable_in_input': false,
                   'target':           document
                   }
               );

+ 1 - 1
web/templates/admin/list_backup.html

@@ -80,7 +80,7 @@
                     <div class="l-unit-toolbar__col l-unit-toolbar__col--right noselect">
                       <div class="actions-panel clearfix">
                         <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>
-                        <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>
+                        <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>
                         <div class="actions-panel__col actions-panel__delete shortcut-delete" key-action="js">
                           <a id="delete_link_<?=$i?>" class="data-controls do_delete" title="<?=__('delete')?>">
                             <i class="fas fa-trash status-icon red status-icon dim do_delete"></i>

+ 1 - 1
web/templates/admin/list_cron.html

@@ -92,7 +92,7 @@ sort-star="<? if($_SESSION['favourites']['CRON'][$key] == 1) echo '1'; else echo
         <div class="clearfix l-unit__stat-col--left compact-2 text-right">
           <div class="l-unit-toolbar__col l-unit-toolbar__col--right noselect">
             <div class="actions-panel clearfix">
-              <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>
+              <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>
                 <div class="actions-panel__col actions-panel__suspend shortcut-s" key-action="js">
                   <a id="<?=$spnd_action ?>_link_<?=$i?>" class="data-controls do_<?=$spnd_action?>" title="<?=__($spnd_action)?>">
                     <i class="fas fa-pause status-icon highlight status-icon dim do_<?=$spnd_action?>"></i>

+ 2 - 0
web/templates/admin/list_services.html

@@ -106,7 +106,9 @@
           </div>
           <div class="clearfix l-unit__stat-col--left wide-2"><b><a href="/edit/server/<? echo $key ?>/" title="<?=__('edit')?>"><?=$key?></a></b></div>
           <div class="clearfix l-unit__stat-col--left text-center compact-2">
+              <div class="actions-panel__col actions-panel__edit shortcut-enter" key-action="href">
                   <a href="/edit/server/<? echo $key ?>/" title="<?=__('edit')?>"><i class="fas fa-pencil-alt status-icon orange status-icon dim icon-large"></i></a>
+              </div>
                   <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>
                   <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>
             </div>

+ 6 - 7
web/templates/footer.html

@@ -15,13 +15,12 @@
       <li><span class="key">Ctrl + Enter</span><?=__('Save Form')?></li>
       <li><span class="key">Ctrl + Backspace</span><?=__('Cancel saving form')?></li>
 
-      <li class="step-top"><span class="key">1</span><?=__('Go to USER list')?></li>
-      <li><span class="key">2</span><?=__('Go to WEB list')?></li>
-      <li><span class="key">3</span><?=__('Go to DNS list')?></li>
-      <li><span class="key">4</span><?=__('Go to MAIL list')?></li>
-      <li><span class="key">5</span><?=__('Go to DB list')?></li>
-      <li><span class="key">6</span><?=__('Go to CRON list')?></li>
-      <li><span class="key">7</span><?=__('Go to BACKUP list')?></li>
+      <li class="step-top"><span class="key">1</span><?=__('Go to WEB list')?></li>
+      <li><span class="key">2</span><?=__('Go to DNS list')?></li>
+      <li><span class="key">3</span><?=__('Go to MAIL list')?></li>
+      <li><span class="key">4</span><?=__('Go to DB list')?></li>
+      <li><span class="key">5</span><?=__('Go to CRON list')?></li>
+      <li><span class="key">6</span><?=__('Go to BACKUP list')?></li>
     </ul>
     <ul>
       <li><span class="key">f</span><?=__('Focus on search')?></li>

+ 1 - 1
web/templates/user/list_cron.html

@@ -92,7 +92,7 @@ sort-star="<? if($_SESSION['favourites']['CRON'][$key] == 1) echo '1'; else echo
         <div class="clearfix l-unit__stat-col--left compact-2 text-right">
           <div class="l-unit-toolbar__col l-unit-toolbar__col--right noselect">
             <div class="actions-panel clearfix">
-              <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>
+              <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>
                 <div class="actions-panel__col actions-panel__suspend shortcut-s" key-action="js">
                   <a id="<?=$spnd_action ?>_link_<?=$i?>" class="data-controls do_<?=$spnd_action?>" title="<?=__($spnd_action)?>">
                     <i class="fas fa-pause status-icon highlight status-icon dim do_<?=$spnd_action?>"></i>