-
Notifications
You must be signed in to change notification settings - Fork 0
Shortcuts is a plugin for rails which gives you keyboard shortcuts.
map7/shortcuts
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
=Shortcuts Provides handling for keyboard shortcuts in javascript-enabled browsers. Tested on Firefox, Safari, IE 6 and IE 7. == Installation Install with script/plugin install git://github.com/map7/shortcuts.git To prepare your application, run script/generate shortcuts This will copy the necessary javscript file to the public/javascripts directory of the application. Make sure you include either javascript_include_tag :defaults or javascript_include_tag 'shortcuts' somewhere in your HTML header. First, make sure that the shortcuts helper is available to your views and helpers. Include it in application_helper.rb: module ApplicationHelper include ShortcutsHelper ... end ==Usage Examples You can now use the helper methods in all your views: To register a navigation shortcut: <%= shortcut 'p', projects_url %> To register an ajax shortcut: <%= remote_shortcut 'd', delete_project_url(@project) %> To register an arbitrary javascript function: <%= shortcut_function 'a', "alert('hello world');" %> For details, refer to the inline documentation for ShortcutsHelper. <%= shortcut 'a', controller.controller_name + '/new' %> <!-- New item for the current controller, could be put into application.html.erb --> Control Key shortcuts <%= shortcut_ctrl 'b', '/' + controller.controller_name %> <%= shortcut_ctrl_function 'a', 'alert("<Ctrl-a> pushed");' %> Function Keys <%= shortcut_fnkey_function '4', 'alert("F4 pressed");' %> ==Running Tests Sit in the plugins root directory and type 'rake' This will run the unit tests in the test directory.
About
Shortcuts is a plugin for rails which gives you keyboard shortcuts.
Resources
Stars
Watchers
Forks
Releases
No releases published
Packages 0
No packages published