moving search result code into .js template