Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.Sign up
Update the URL when changing mailer preview formats #20983
Hi @arthurnn, thanks for reviewing this! Its my first time contributing to rails.
When you create a mailer preview in rails, you can preview an email as the .html version or the .txt version. You do this by using that select box in the header area of the mailer preview page. When you load the mailer preview page, the select box defaults to the .html version.
The annoyance begins when you want to work on the .txt version of the email. Each time you make a change to the .txt email in your editor, you naturally reload your browser to see your changes. However, each time you reload, it defaults to the .html version and you are forced to re-select the .txt version from the select box.
The proposed solution:
Each time the user selects the version they want to preview, we append that mime type to the url. So, when I change the select box to show me the .txt version, I append .txt to the url. When I then reload the browser, I am brought directly to the .txt version of the email.
After creating this pull request, I realized that
So now, developers can select their desired mailer preview format, work on it, reload the page, then click back one time and go to the page they were previously on (as opposed to clicking back through all the email formats they previously selected).
PS: Let me know if I am doing something stupid in git. I feel like I didn't update my branch properly.