|
1 | | -<nav> |
| 1 | +<nav data-controller="hotkeys mark-all-as-read" data-action="keydown@document->hotkeys#handleKeydown"> |
2 | 2 | <div> |
3 | | - <button class="btn" id="mark-all" title="<%= t('partials.action_bar.mark_all') %>" aria-label="<%= t('partials.action_bar.mark_all') %>"> |
| 3 | + <button class="btn" id="mark-all" title="<%= t('partials.action_bar.mark_all') %>" aria-label="<%= t('partials.action_bar.mark_all') %>" data-action="click->mark-all-as-read#submit" data-hotkeys-target="click" data-hotkey="A"> |
4 | 4 | <i class="fa fa-check"></i> |
5 | 5 | <%= render "stories/mark_all_as_read_form", { stories: stories } %> |
6 | 6 | </button> |
7 | | - <a class="btn" href="/" id="refresh" title="<%= t('partials.action_bar.refresh') %>"> |
| 7 | + <a class="btn" href="/" id="refresh" title="<%= t('partials.action_bar.refresh') %>" data-hotkeys-target="click" data-hotkey="r"> |
8 | 8 | <i class="fa fa-refresh"></i> |
9 | 9 | </a> |
10 | 10 | </div> |
|
20 | 20 | <a class="btn btn-primary" id="archive" href="/archive" title="<%= t('partials.action_bar.archived_stories') %>"> |
21 | 21 | <i class="fa fa-clock-o"></i> |
22 | 22 | </a> |
23 | | - <a class="btn btn-primary" id="feeds" href="/feeds" title="<%= t('partials.action_bar.view_feeds') %>"> |
| 23 | + <a class="btn btn-primary" id="feeds" href="/feeds" title="<%= t('partials.action_bar.view_feeds') %>" data-hotkeys-target="click" data-hotkey="f"> |
24 | 24 | <i class="fa fa-list"></i> |
25 | 25 | </a> |
26 | | - <a class="btn btn-primary" id="add-feed" href="/feeds/new" title="<%= t('partials.action_bar.add_feed') %>"> |
| 26 | + <a class="btn btn-primary" id="add-feed" href="/feeds/new" title="<%= t('partials.action_bar.add_feed') %>" data-hotkeys-target="click" data-hotkey="a"> |
27 | 27 | <i class="fa fa-plus"></i> |
28 | 28 | </a> |
29 | 29 | </div> |
30 | 30 | </nav> |
31 | | - |
32 | | -<script type="text/javascript"> |
33 | | - $(document).ready(function() { |
34 | | - $("#mark-all").click(function(e) { |
35 | | - e.preventDefault(); |
36 | | - |
37 | | - $("form#mark-all-as-read").submit(); |
38 | | - }); |
39 | | - |
40 | | - Mousetrap.bind("r", function() { |
41 | | - var refresh = $("a#refresh")[0]; |
42 | | - if (refresh) refresh.click(); |
43 | | - }); |
44 | | - |
45 | | - Mousetrap.bind("f", function() { |
46 | | - var all_feeds = $("a#feeds")[0]; |
47 | | - if (all_feeds) all_feeds.click(); |
48 | | - }); |
49 | | - |
50 | | - Mousetrap.bind("a", function() { |
51 | | - var add_feed = $("a#add-feed")[0]; |
52 | | - if (add_feed) add_feed.click(); |
53 | | - }); |
54 | | - |
55 | | - Mousetrap.bind("shift+a", function() { |
56 | | - $("form#mark-all-as-read").submit(); |
57 | | - }); |
58 | | - }); |
59 | | -</script> |
0 commit comments