remove nested duplicated if
refactor populateParentDetails
refactor populateParentDetails again

including removing the warning about not having a relationship, as it is
very likely to be misleading if it occurs on a new objects page
remove unused parameter
minor refactoring for readability
modifications to templates for data reference attach page