Skip to content

Commit

Permalink
removed turbolinks & fixed grids js
Browse files Browse the repository at this point in the history
  • Loading branch information
spatil committed Apr 5, 2014
1 parent 69aadad commit cbb9e6d
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 14 deletions.
2 changes: 1 addition & 1 deletion Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ gem 'therubyracer', platforms: :ruby
gem 'jquery-rails'

# Turbolinks makes following links in your web application faster. Read more: https://github.com/rails/turbolinks
gem 'turbolinks'
#gem 'turbolinks'

# Build JSON APIs with ease. Read more: https://github.com/rails/jbuilder
gem 'jbuilder', '~> 1.2'
Expand Down
3 changes: 0 additions & 3 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -236,8 +236,6 @@ GEM
treetop (1.4.15)
polyglot
polyglot (>= 0.3.1)
turbolinks (1.3.0)
coffee-rails
tzinfo (0.3.39)
uglifier (2.5.0)
execjs (>= 0.3.0)
Expand Down Expand Up @@ -282,5 +280,4 @@ DEPENDENCIES
simple_form
simplecov
therubyracer
turbolinks
uglifier (>= 2.5.0)
1 change: 0 additions & 1 deletion app/assets/javascripts/application.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,5 @@
//= require jquery
//= require jquery_ujs
//= require jquery_nested_form
//= require turbolinks
//= require bootstrap
//= require_tree .
19 changes: 10 additions & 9 deletions app/assets/javascripts/grid.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ function navigateGrid(e) {
var tab;
var key = new keyCodes();
var activeElement = $(":focus");
var elementIndex;

switch(e.keyCode) {
case key.tab: {
if(tab==null) {
Expand All @@ -36,28 +36,29 @@ function navigateGrid(e) {
break;
}
case key.right: {
if(activeElement.next.length != 0) {
activeElement.next().focus();
if(activeElement.parent().next.length != 0) {
activeElement.parent().next().children().focus();
}
break;
}
case key.left: {
if(activeElement.prev.length != 0) {
activeElement.prev().focus();
if(activeElement.parent().prev.length != 0) {
activeElement.parent().prev().children().focus();
}
break;
}
case key.up: {
pElement = activeElement.parent().prev();
pElement = activeElement.parent().parent().prev();
if(pElement != "") {
pElement.children().eq(activeElement.index()).focus();
pElement.children().eq(activeElement.parent().index()).children().focus();
}
break;
}
case key.down: {
nElement = activeElement.parent().next();
nElement = activeElement.parent().parent().next();
console.log(activeElement)
if(nElement != "") {
nElement.children().eq(activeElement.index()).focus();
nElement.children().eq(activeElement.parent().index()).children().focus();
}
break;
}
Expand Down

0 comments on commit cbb9e6d

Please sign in to comment.