We had a recent question about how to do this, so we've turn this into a mini tutorial...
So first of all i have a snippet with an button where i can call
this popup modal. Here we send the variable action=view to the
popup_example snippet when the button is pressed.
<gs-link snippet="popup_example?action=view" target="modal-small">
Then in the snippet called 'popup_example' we use that variable to let the popup snippet know when to show the popup and when to go back to the last screen.
So, going through whats going on here in steps for this snippet...