refactor module view templates to reduce duplication

@dannyroberts 

QA ticket: http://manage.dimagi.com/default.asp?122993
constructing identifiers is kind of an antipattern as it makes text searches difficult. I'm ok keeping this if it's obviously better for some other reason, just wanted to raise that.