function(doc, req) { var head = ''; var body = ''; var tail = ''; if(doc) { <% attributes.each do |attribute| %> if(doc['<%= attribute %>']) { body += '

<%= attribute.humanize %>: ' + doc['<%= attribute %>'] + '

' } <% end %> return head + '

Showing <%= model_name.humanize %>

' + body + tail; } else { <% attributes.each do |attribute| %> body += '

:

' <% end %> body += '

' return head + '

New <%= model_name.humanize %>

' + body + tail; } }