Better redirect from place_hold
authorsenator <lebbeous@esilibrary.com>
Tue, 10 May 2011 14:28:55 +0000 (10:28 -0400)
committersenator <lebbeous@esilibrary.com>
Tue, 10 May 2011 14:28:55 +0000 (10:28 -0400)
Before this, if you click place hold on something while not logged in,
you are redirected to the login page, which is good, and redirected
thence to the place hold page, which is good. But after actually
placing the hold you got redirected to the login page again, which is
not good.  Now you get sent back to the home page.

This may not be the ideal choice.  myopac/main may make more sense.
Also, there is still not any clear visual feedback for the user that
their hold placement succeeded.  That'll need to be addressed too.

Open-ILS/web/templates/default/opac/parts/place_hold.tt2

index fc4dce0..8f56aa5 100644 (file)
                 value="[% CGI.param('hold_target') | html %]" />
             <input type="hidden" name="hold_type"
                 value="[% CGI.param('hold_type') | html %]" />
+            [%
+                new_redirect_to = ctx.referer;
+                IF new_redirect_to.match('redirect_to');
+                    new_redirect_to = 'https://' _ ctx.hostname _ ctx.opac_root _ '/home';
+                ELSE;
+                    new_redirect_to = new_redirect_to | replace('^http:', 'https:');
+                END;
+            %]
             <input type="hidden" name="redirect_to"
-                value="[% ctx.referer | replace('^http:', 'https:') | html %]" />
+                value="[% new_redirect_to | html %]" />
             <h1>Place Hold</h1>
             <p>
                 [% | l(attrs.title, ctx.get_aou(ctx.default_pickup_lib).name) %]