From: Sven Schöling Date: Mon, 13 Feb 2012 16:09:21 +0000 (+0100) Subject: delay_flash_on_redirect Magie im Basecontroller. X-Git-Tag: release-2.7.0beta2~5^2~13 X-Git-Url: http://wagnertech.de/git?a=commitdiff_plain;h=abd4a0b007159d46da41dc6ed832acc3e85c9744;p=kivitendo-erp.git delay_flash_on_redirect Magie im Basecontroller. Wenn von einem Controller explizit überladen, wird der normale Föash vor einem redirect_to automatisch upgegradet in ein flash_later. Conflicts: SL/Controller/Base.pm --- diff --git a/SL/Controller/Base.pm b/SL/Controller/Base.pm index 6d9434742..285bfcee4 100644 --- a/SL/Controller/Base.pm +++ b/SL/Controller/Base.pm @@ -30,6 +30,11 @@ sub redirect_to { my $self = shift; my $url = $self->url_for(@_); + if ($self->delay_flash_on_redirect) { + require SL::Helper::Flash; + SL::Helper::Flash::delay_flash(); + } + print $::request->{cgi}->redirect($url); } @@ -152,6 +157,14 @@ sub _run_hooks { } } +# +# behaviour. override these +# + +sub delay_flash_on_redirect { + 0; +} + # # private functions -- for use in Base only # @@ -482,6 +495,12 @@ action. The hook's return values are discarded. +=item delay_flash_on_redirect + +May be overridden by a controller. If this method returns true, redirect_to +will delay all flash messages for the current request. Defaults to false for +compatibility reasons. + =back =head2 PRIVATE FUNCTIONS