Moved index code from rails view to angular view