Class: Avo::KeyboardShortcutsComponent
- Inherits:
-
BaseComponent
- Object
- ViewComponent::Base
- BaseComponent
- Avo::KeyboardShortcutsComponent
- Defined in:
- app/components/avo/keyboard_shortcuts_component.rb
Constant Summary
Constants included from Concerns::FindAssociationField
Concerns::FindAssociationField::ASSOCIATIONS
Instance Method Summary collapse
Methods inherited from BaseComponent
#component_name, #hotkey_badge
Methods included from ApplicationHelper
#a_button, #a_link, #body_classes, #button_classes, #chart_color, #container_classes, #d, #decode_filter_params, #e, #editor_file_path, #editor_url, #empty_state, #encode_filter_params, #frame_id, #get_model_class, #input_classes, #mount_path, #number_to_social, #possibly_rails_authentication?, #render_license_warning, #root_path_without_url, #rtl?, #text_direction, #ui, #wrap_in_modal
Methods included from ResourcesHelper
#field_wrapper, #filter_wrapper, #index_field_wrapper, #item_selector_data_attributes, #record_path, #record_title, #resource_for_record, #resource_grid, #resource_show_path, #resource_table
Methods included from Concerns::FindAssociationField
Instance Method Details
#render_shortcut_keys(shortcut) ⇒ Object
66 67 68 69 70 71 72 |
# File 'app/components/avo/keyboard_shortcuts_component.rb', line 66 def render_shortcut_keys(shortcut) if shortcut[:any_of].present? render_shortcut_alternatives(shortcut[:any_of]) else render_chord(shortcut[:keys]) end end |
#sections ⇒ Object
4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 |
# File 'app/components/avo/keyboard_shortcuts_component.rb', line 4 def sections @sections ||= [ build_section( "Navigation", [ shortcut(action: "Show keyboard shortcuts", keys: ["?"]), shortcut(action: "Focus resource search", keys: {mac: ["Cmd", "K"], other: ["Ctrl", "K"]}), shortcut(action: "Toggle sidebar", keys: {mac: ["Cmd", "\\"], other: ["Ctrl", "\\"]}), shortcut(action: "Close modal", keys: ["Esc"]), shortcut( action: "Navigate options in the modal", any_of: [["↑"], ["↓"]], keys_aria_label: "Up arrow or down arrow" ), shortcut(action: "Go back", keys: ["B"]), shortcut(action: "Toggle keyboard shortcut badges", keys: ["Shift", "K"]) ] ), build_section( "Edit view", [ shortcut(action: "Submit form", keys: {mac: ["Cmd", "↵"], other: ["Ctrl", "↵"]}), shortcut(action: "Unfocus field", keys: ["Esc"]) ] ), build_section( "Show view", [ shortcut(action: "Delete record", keys: ["D"]), shortcut(action: "Edit record", keys: ["E"]), shortcut(action: "Open actions", keys: ["A"]) ] ), build_section( "Action", [ shortcut(action: "Run action", keys: {mac: ["Cmd", "↵"], other: ["Ctrl", "↵"]}), shortcut(action: "Cancel action", keys: ["Esc"]) ] ), build_section( "Index view", [ shortcut(action: "Focus search", keys: ["/"]), shortcut(action: "Create new record", keys: ["C"]), shortcut(action: "Open actions", keys: ["A"]), shortcut( action: "Navigate rows / actions", any_of: [["↑"], ["↓"]], keys_aria_label: "Up arrow or down arrow" ), shortcut(action: "Open record", keys: ["↵"]), shortcut(action: "Select / deselect row", keys: ["Space"]), shortcut(action: "Deselect rows", keys: ["Esc"]), shortcut(action: "Table view", keys: ["V", "T"]), shortcut(action: "Grid view", keys: ["V", "G"]), shortcut(action: "Map view", keys: ["V", "M"]) ] ) ] end |