refactor doc.js getForEdit getForView
more refactoring
more refactorings