javascript working partially, paperclip working fully