Move javascript code to coffee file