Class: RailsOmnibar::Item::Help
- Defined in:
- lib/rails_omnibar/item/help.rb
Instance Attribute Summary
Attributes inherited from Base
#icon, #modal_html, #suggested, #title, #type, #url
Instance Method Summary collapse
-
#initialize(title: 'Help', for_commands:, custom_content: nil, icon: 'question', suggested: true) ⇒ Help
constructor
A new instance of Help.
Methods inherited from Base
Constructor Details
#initialize(title: 'Help', for_commands:, custom_content: nil, icon: 'question', suggested: true) ⇒ Help
Returns a new instance of Help.
9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 |
# File 'lib/rails_omnibar/item/help.rb', line 9 def initialize(title: 'Help', for_commands:, custom_content: nil, icon: 'question', suggested: true) super title: title, suggested: suggested, icon: icon, type: :help, modal_html: " <span>Usage:<span>\n <ul>\n <li>Type a few letters to get results</li>\n <li>Use the arrow keys (\u2191/\u2193) on your keyboard to select a result</li>\n <li>Hit Enter to open a result</li>\n <li>Hit Escape to close</li>\n </ul>\n <span>Available actions:<span>\n <ul>\n \#{custom_content&.then { |c| \"<li>\#{c}</li>\" } }\n \#{for_commands.map do |h|\n \"<li><b>\#{h.description}</b><br>Example: `\#{h.example}`</li>\"\n end.join}\n </ul>\n HTML\nend\n" |