Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Define keyboard shortcuts for request page #17255

Draft
wants to merge 2 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/api/app/assets/javascripts/webui/application.js
Original file line number Diff line number Diff line change
Expand Up @@ -72,3 +72,4 @@
//= require webui/canned_responses.js
//= require webui/multi_select.js
//= require webui/dropdown.js
//= require webui/hotkeys.min.js
2 changes: 2 additions & 0 deletions src/api/app/assets/javascripts/webui/hotkeys.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

29 changes: 29 additions & 0 deletions src/api/app/views/webui/request/beta_show.html.haml
Original file line number Diff line number Diff line change
Expand Up @@ -125,4 +125,33 @@
= render partial: 'webui/shared/locking_dialog', locals: { commentable: @bs_request, entity_type: 'request' }
- if Flipper.enabled?(:content_moderation, User.possibly_nobody)
= render partial: 'webui/shared/report_modal'
-# list of url's
.urls-list{data: { page1: request_beta_show_path(@bs_request),
page2: request_build_results_path(@bs_request.number, @action),
page3: request_rpm_lint_path(@bs_request.number, @action),
page4: request_changes_path(@bs_request.number, @action),
page5: request_mentioned_issues_path(@bs_request.number, @action) } }
-# haml-lint:enable ViewLength

:javascript
hotkeys('alt+1,alt+2,alt+3,alt+4,alt+5', function (event, handler){
switch (handler.key) {
case 'alt+1':
url = $('.urls-list').data('page1')
break;
case 'alt+2':
url = $('.urls-list').data('page2')
break;
case 'alt+3':
url = $('.urls-list').data('page3')
break;
case 'alt+4':
url = $('.urls-list').data('page4')
break;
case 'alt+5':
url = $('.urls-list').data('page5')
break;
}
event.preventDefault();
document.location.href = url;
});
Loading