Refactor PageIndex CoffeeScript