Add end to if statement in views