Rather than passing the state as a string and then switching on it in the template, how about doing the match (and thus logic) in the controller and loading a different template in each case?  Templates aren't the place for business logic beyond simple layout/formatting concerns. 