History

Add keyboard shortcut for revealing the current page in the sidebar

Thibaut committed 12 years ago

Commit ed3c1dc1 parent d672b1c4 files · +13 −1Browse files

Unified · Split

4 files
  1. assets/javascripts/app/shortcuts.coffee +3 −0
  2. assets/javascripts/templates/pages/help_tmpl.coffee +3 −0
  3. assets/javascripts/templates/pages/news_tmpl.coffee +2 −1
  4. assets/javascripts/views/sidebar/sidebar.coffee +5 −0
assets/javascripts/app/shortcuts.coffee+3−0
@@ -104,6 +104,9 @@ class app.Shortcuts · 103 unmodified lines
104104 when 71
105105 @trigger 'altG'
106106 false
107+ when 82
108+ @trigger 'altR'
109+ false
107110
108111 handleKeypressEvent: (event) ->
109112 if event.which is 63 and not event.target.value
assets/javascripts/templates/pages/help_tmpl.coffee+3−0
@@ -77,6 +77,9 @@ app.templates.helpPage = """ · 76 unmodified lines
7777 </dl>
7878 <h3 class="_shortcuts-title">Misc</h3>
7979 <dl class="_shortcuts-dl">
80+ <dt class="_shortcuts-dt">
81+ <code class="_shortcut-code">Alt + r</code>
82+ <dd class="_shortcuts-dd">Reveal current page in sidebar
8083 <dt class="_shortcuts-dt">
8184 <code class="_shortcut-code">Alt + g</code>
8285 <dd class="_shortcuts-dd">Search on Google
assets/javascripts/templates/pages/news_tmpl.coffee+2−1
@@ -25,7 +25,8 @@ newsItem = (date, news) -> · 24 unmodified lines
2525
2626 app.news = [
2727 [ 1389484800000, # January 12, 2013
28− """ Added <code class="_label">Alt + g</code> shortcut for searching on Google. """
28+ """ Added <code class="_label">Alt + g</code> shortcut for searching on Google. """,
29+ """ Added <code class="_label">Alt + r</code> shortcut for revealing the current page in the sidebar. """
2930 ], [
3031 1386979200000, # December 14, 2013
3132 """ New <a href="/postgresql/">PostgreSQL</a> documentation """
assets/javascripts/views/sidebar/sidebar.coffee+5−0
@@ -6,6 +6,7 @@ class app.views.Sidebar extends app.View · 5 unmodified lines
66 click: 'onClick'
77
88 @shortcuts:
9+ altR: 'onAltR'
910 escape: 'onEscape'
1011
1112 init: ->
@@ -85,6 +86,10 @@ class app.views.Sidebar extends app.View · 73 unmodified lines
8586 @showDocList() unless $.hasChild @el, event.target
8687 return
8788
89+ onAltR: =>
90+ @showDocList true
91+ return
92+
8893 onEscape: =>
8994 @showDocList true
9095 @scrollToTop()