Adds event hooks to Photo model, adds javascript templates