wacky 0.1.4 → 0.1.5

Sign up to get free protection for your applications and to get access to all the features.
data/README.md CHANGED
@@ -8,6 +8,12 @@ Features:
8
8
 
9
9
  - versioning
10
10
  - realtime markdown preview
11
+ - title extraction
12
+ - keyboard shortcuts
13
+ - `e` to edit the current page
14
+ - `v` to see the versions
15
+ - `?` to see the help
16
+ - `ESC` to hide the help
11
17
 
12
18
  ### Installation
13
19
 
@@ -0,0 +1,49 @@
1
+ $ ->
2
+ helpContainer = ->
3
+ $('.wacky-keyboard-commands')
4
+
5
+ eKeyPressed = (e) ->
6
+ e.which == 69
7
+
8
+ vKeyPressed = (e) ->
9
+ e.which == 86
10
+
11
+ questionMarkPressed = (e) ->
12
+ e.shiftKey && e.which == 191
13
+
14
+ escPressed = (e) ->
15
+ e.which == 27
16
+
17
+ goToEditPage = ->
18
+ if editPageLink()
19
+ window.location = editPageLink().href
20
+
21
+ goToPageVersions = ->
22
+ if pageVersionsLink()
23
+ window.location = pageVersionsLink().href
24
+
25
+ editPageLink = ->
26
+ $('a[rel=edit-page]')[0]
27
+
28
+ pageVersionsLink = ->
29
+ $('a[rel=page-versions]')[0]
30
+
31
+ showHelp = ->
32
+ helpContainer().show()
33
+
34
+ hideHelp = ->
35
+ helpContainer().hide()
36
+
37
+ $(window).on 'keyup', (e) ->
38
+ if eKeyPressed(e)
39
+ goToEditPage()
40
+ if vKeyPressed(e)
41
+ goToPageVersions()
42
+ if escPressed(e)
43
+ hideHelp()
44
+
45
+ $(window).on 'keydown', (e) ->
46
+ if questionMarkPressed(e)
47
+ showHelp()
48
+
49
+ hideHelp()
@@ -0,0 +1,12 @@
1
+ .wacky-keyboard-commands {
2
+ dl {
3
+ dt {
4
+ font-weight: bold;
5
+ width: 50px;
6
+ text-align: right;
7
+ }
8
+ dt, dd {
9
+ display: inline-block;
10
+ }
11
+ }
12
+ }
@@ -0,0 +1,17 @@
1
+ .wacky-keyboard-commands
2
+ h4 Keyboard commands
3
+ dl
4
+ dt e
5
+ dd Edit Page
6
+
7
+ dl
8
+ dt v
9
+ dd Page Versions
10
+
11
+ dl
12
+ dt ?
13
+ dd Show Help
14
+
15
+ dl
16
+ dt ESC
17
+ dd Hide Help
@@ -1,5 +1,7 @@
1
+ = render 'help'
2
+
1
3
  = @page.to_html.html_safe
2
4
 
3
5
  ul.actions
4
- li= link_to "Edit", edit_page_path(@page)
5
- li= link_to "Versions", versions_page_path(@page)
6
+ li= link_to "Edit", edit_page_path(@page), rel: 'edit-page'
7
+ li= link_to "Versions", versions_page_path(@page), rel: 'page-versions'
data/lib/wacky/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Wacky
2
- VERSION = "0.1.4"
2
+ VERSION = "0.1.5"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: wacky
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.4
4
+ version: 0.1.5
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -356,6 +356,7 @@ extra_rdoc_files: []
356
356
  files:
357
357
  - app/views/layouts/wacky/application.html.slim
358
358
  - app/views/wacky/special_pages/recently_updated.html.slim
359
+ - app/views/wacky/pages/_help.html.slim
359
360
  - app/views/wacky/pages/versions.html.slim
360
361
  - app/views/wacky/pages/new.html.slim
361
362
  - app/views/wacky/pages/version.html.slim
@@ -365,9 +366,11 @@ files:
365
366
  - app/models/wacky/extracts_title.rb
366
367
  - app/assets/javascripts/wacky/ace.js
367
368
  - app/assets/javascripts/wacky/showdown.js
369
+ - app/assets/javascripts/wacky/keyboard.js.coffee
368
370
  - app/assets/javascripts/wacky/application.js
369
371
  - app/assets/stylesheets/wacky/ace.css.scss
370
372
  - app/assets/stylesheets/wacky/application.css
373
+ - app/assets/stylesheets/wacky/help.css.scss
371
374
  - app/controllers/wacky/special_pages_controller.rb
372
375
  - app/controllers/wacky/application_controller.rb
373
376
  - app/controllers/wacky/pages_controller.rb