Split build statement for type

This is mostly a step towards further refactoring.  I've moved the clearly shared code up, and there's further work that could be done there.

This will conflict with https://github.com/parndt/rails_admin/pull/3 but only in a fairly trivial way (a human may be needed to fix it, but it's not actually any conflicting code to the best of my knowledge, just in a different place).