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
104 when 71104 when 71
105 @trigger 'altG'105 @trigger 'altG'
106 false106 false
107 when 82
108 @trigger 'altR'
109 false
107 110
108 handleKeypressEvent: (event) ->111 handleKeypressEvent: (event) ->
109 if event.which is 63 and not event.target.value112 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
77 </dl>77 </dl>
78 <h3 class="_shortcuts-title">Misc</h3>78 <h3 class="_shortcuts-title">Misc</h3>
79 <dl class="_shortcuts-dl">79 <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
80 <dt class="_shortcuts-dt">83 <dt class="_shortcuts-dt">
81 <code class="_shortcut-code">Alt + g</code>84 <code class="_shortcut-code">Alt + g</code>
82 <dd class="_shortcuts-dd">Search on Google85 <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
25 25
26app.news = [26app.news = [
27 [ 1389484800000, # January 12, 201327 [ 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. """
29 ], [30 ], [
30 1386979200000, # December 14, 201331 1386979200000, # December 14, 2013
31 """ New <a href="/postgresql/">PostgreSQL</a> documentation """32 """ 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
6 click: 'onClick'6 click: 'onClick'
7 7
8 @shortcuts:8 @shortcuts:
9 altR: 'onAltR'
9 escape: 'onEscape'10 escape: 'onEscape'
10 11
11 init: ->12 init: ->
@@ -85,6 +86,10 @@ class app.views.Sidebar extends app.View · 73 unmodified lines
85 @showDocList() unless $.hasChild @el, event.target86 @showDocList() unless $.hasChild @el, event.target
86 return87 return
87 88
89 onAltR: =>
90 @showDocList true
91 return
92
88 onEscape: =>93 onEscape: =>
89 @showDocList true94 @showDocList true
90 @scrollToTop()95 @scrollToTop()