Commit c28722689d54eb0a69c72e8258e189ccd8ce7964
1 parent
41ec5400
Exists in
master
and in
4 other branches
merge graph.js into projects.js
Showing
3 changed files
with
8 additions
and
11 deletions
Show diff stats
app/assets/javascripts/graph.js.coffee
| @@ -1,10 +0,0 @@ | @@ -1,10 +0,0 @@ | ||
| 1 | -initGraphNav = -> | ||
| 2 | - $('.graph svg').css 'position', 'relative' | ||
| 3 | - | ||
| 4 | - $('body').bind 'keyup', (e) -> | ||
| 5 | - if e.keyCode is 37 # left | ||
| 6 | - $('.graph svg').animate left: '+=400' | ||
| 7 | - else if e.keyCode is 39 # right | ||
| 8 | - $('.graph svg').animate left: '-=400' | ||
| 9 | - | ||
| 10 | -window.initGraphNav = initGraphNav |
app/assets/javascripts/projects.js.coffee
| @@ -22,3 +22,10 @@ $ -> | @@ -22,3 +22,10 @@ $ -> | ||
| 22 | # Ref switcher | 22 | # Ref switcher |
| 23 | $('.project-refs-select').on 'change', -> | 23 | $('.project-refs-select').on 'change', -> |
| 24 | $(@).parents('form').submit() | 24 | $(@).parents('form').submit() |
| 25 | + | ||
| 26 | +class @GraphNav | ||
| 27 | + @init: -> | ||
| 28 | + $('.graph svg').css 'position', 'relative' | ||
| 29 | + $('body').bind 'keyup', (e) -> | ||
| 30 | + $('.graph svg').animate(left: '+=400') if e.keyCode is 37 # left | ||
| 31 | + $('.graph svg').animate(left: '-=400') if e.keyCode is 39 # right |