Hum here is a lot if statements that checks what view your in. How would it be to just include the code into storytask.jsp and so on instead. Of course we would need to update each view if we change something. I don't think that will be so much though, stories are already a bit different  in the two views and then its only epics.