Commit c28722689d54eb0a69c72e8258e189ccd8ce7964

Authored by Nihad Abbasov
1 parent 41ec5400

merge graph.js into projects.js

app/assets/javascripts/graph.js.coffee
... ... @@ -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 22 # Ref switcher
23 23 $('.project-refs-select').on 'change', ->
24 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
... ...
app/views/projects/graph.html.haml
... ... @@ -10,5 +10,5 @@
10 10 initGraph();
11 11 $(function(){
12 12 branchGraph($("#holder")[0]);
13   - initGraphNav();
  13 + GraphNav.init();
14 14 });
... ...