Refactor erb conditional on images to render partials