Render dialog as view instead of from javascript