Add more keyboard shortcuts for main page (#4846)

* Add more shortcuts for main page

* Update zabapgit_css_common.w3mi.data.css

* Update zcl_abapgit_gui_router.clas.abap

* Change keyboard shortcuts

* fix js

* fix js

* deindent

* indentation

* one more

Co-authored-by: Lars Hvam <larshp@hotmail.com>
Co-authored-by: Marc Bernard <59966492+mbtools@users.noreply.github.com>
This commit is contained in:
Frederik Hudák 2021-07-06 11:32:27 +02:00 committed by GitHub
parent 2e7d642786
commit 60a82331b5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 46 additions and 11 deletions

View File

@ -922,7 +922,7 @@ ul.hotkeys span.key-id {
border: 1px solid;
border-radius: 3px;
padding: 1px 7px;
width: 1em;
width: 3em;
display: inline-block;
text-align: center;
margin-top: 0.2em;

View File

@ -281,9 +281,9 @@ RepoOverViewHelper.prototype.onPageLoad = function () {
}
};
RepoOverViewHelper.prototype.registerKeyboardShortcuts = function () {
RepoOverViewHelper.prototype.registerKeyboardShortcuts = function() {
var self = this;
document.addEventListener("keypress", function (event) {
document.addEventListener("keypress", function(event) {
if (document.activeElement.id === "filter") {
return;
}
@ -295,12 +295,11 @@ RepoOverViewHelper.prototype.registerKeyboardShortcuts = function () {
if (keycode == 13) {
// "enter" to open
self.openSelectedRepo();
}
else if (keycode == 44 && indexOfSelected > 0) {
// "<" for previous
} else if ((keycode == 52 || keycode == 100) && indexOfSelected > 0) {
// "4" for previous
self.selectRowByIndex(indexOfSelected - 1);
} else if (keycode == 46 && indexOfSelected < rows.length - 1) {
// ">" for next
} else if ((keycode == 54 || keycode == 102) && indexOfSelected < rows.length - 1) {
// "6" for next
self.selectRowByIndex(indexOfSelected + 1);
}
});

View File

@ -164,5 +164,36 @@ CLASS zcl_abapgit_gui_page_main IMPLEMENTATION.
ls_hotkey_action-hotkey = |o|.
INSERT ls_hotkey_action INTO TABLE rt_hotkey_actions.
ls_hotkey_action-description = |Stage|.
ls_hotkey_action-action = zif_abapgit_definitions=>c_action-go_stage.
ls_hotkey_action-hotkey = |s|.
INSERT ls_hotkey_action INTO TABLE rt_hotkey_actions.
ls_hotkey_action-description = |Check|.
ls_hotkey_action-action = zif_abapgit_definitions=>c_action-repo_code_inspector.
ls_hotkey_action-hotkey = |c|.
INSERT ls_hotkey_action INTO TABLE rt_hotkey_actions.
ls_hotkey_action-description = |Patch|.
ls_hotkey_action-action = zif_abapgit_definitions=>c_action-go_patch.
ls_hotkey_action-hotkey = |p|.
INSERT ls_hotkey_action INTO TABLE rt_hotkey_actions.
" registered/handled in js
ls_hotkey_action-description = |Previous repository|.
ls_hotkey_action-action = `#`.
ls_hotkey_action-hotkey = |4|.
INSERT ls_hotkey_action INTO TABLE rt_hotkey_actions.
ls_hotkey_action-description = |Next repository|.
ls_hotkey_action-action = `##`.
ls_hotkey_action-hotkey = |6|.
INSERT ls_hotkey_action INTO TABLE rt_hotkey_actions.
ls_hotkey_action-description = |Open repository|.
ls_hotkey_action-action = `###`.
ls_hotkey_action-hotkey = |Enter|.
INSERT ls_hotkey_action INTO TABLE rt_hotkey_actions.
ENDMETHOD.
ENDCLASS.

View File

@ -356,7 +356,7 @@ CLASS ZCL_ABAPGIT_GUI_PAGE_PATCH IMPLEMENTATION.
it_files = it_files ).
IF mo_repo->is_offline( ) = abap_true.
zcx_abapgit_exception=>raise( |Can't patch offline repos| ).
zcx_abapgit_exception=>raise( |Patching is only possible for online repositories.| ).
ENDIF.
mo_repo_online ?= mo_repo.

View File

@ -335,11 +335,16 @@ CLASS zcl_abapgit_gui_router IMPLEMENTATION.
lv_answer TYPE c LENGTH 1,
lv_question_text TYPE string,
lv_question_title TYPE string,
lv_show_create_branch_popup TYPE c LENGTH 1.
lv_show_create_branch_popup TYPE c LENGTH 1,
lx_error TYPE REF TO cx_sy_move_cast_error.
lv_key = ii_event->query( )->get( 'KEY' ).
lv_seed = ii_event->query( )->get( 'SEED' ).
lo_repo ?= zcl_abapgit_repo_srv=>get_instance( )->get( lv_key ).
TRY.
lo_repo ?= zcl_abapgit_repo_srv=>get_instance( )->get( lv_key ).
CATCH cx_sy_move_cast_error INTO lx_error.
zcx_abapgit_exception=>raise( `Staging is only possible for online repositories.` ).
ENDTRY.
IF lo_repo->get_local_settings( )-code_inspector_check_variant IS NOT INITIAL.