From edb245df07521442ba179d33ae7171515f840804 Mon Sep 17 00:00:00 2001 From: Brian Read Date: Fri, 22 Nov 2024 15:09:21 +0000 Subject: [PATCH] Get success message working after save --- Templates/controller.pm.tem | 27 ++++++++++++++++----------- Templates/layout.html.ep.tem | 18 +++++++++--------- 2 files changed, 25 insertions(+), 20 deletions(-) diff --git a/Templates/controller.pm.tem b/Templates/controller.pm.tem index 1f6ed80..11af366 100644 --- a/Templates/controller.pm.tem +++ b/Templates/controller.pm.tem @@ -77,7 +77,7 @@ sub main { # which DB - this only really works if the initial panel is a PARAMS type panel and not a TABLE my $db = $$${controldb | db | 'cdb'}; #pickup local or global db or Default to config - $$${prefix}_data{${dbfield}} = $db->prop('${dbfield}') || ${dbdefault | ""} || ""; + $$${prefix}_data{'${dbfield}'} = $db->prop('${dbfield}') || ${dbdefault | ""} || ""; #pickup any other contents needed and load them into hash shared with panel @@ -160,7 +160,7 @@ sub do_update { if ($ret ne "ok") { - ${prefix}_data{trt} = $thispanel; + ${prefix}_data{'trt'} = $thispanel; $c->stash(error => $c->l($ret)); $c->stash( title => $title, @@ -177,26 +177,31 @@ sub do_update { if ($ret ne "ok") { # return to the panel with error message $c->stash(error => $c->l($ret)); - $c->render("${lcPackageName}"); + $c->stash( + title => $title, + modul => $modul, + ${prefix}_data => \%${prefix}_data + ); + $c->render(template => "${lcPackageName}"); } else { $c->stash( success => $c->l('${panel} panel action was successful')); #A bit bland - edit it in the lex file } } # and call any signal-events needed - - + #TBD # Setup shared data and call panel - $c->stash( - title => $title, - ${prefix}_data => \%${prefix}_data - ); if ('${nextpanel | "none"}' eq 'none') { $$${prefix}_data{'trt'} = '${firstPanel}'; } else { $$${prefix}_data{'trt'} = '${NextPanel | "none"}'; } - $c->do_display() + $c->stash( + title => $title, + modul => $modul, + ${prefix}_data => \%${prefix}_data + ); + $c->render( template => "${lcPackageName}" ); } } @@ -275,6 +280,6 @@ sub do_display { title => $title, ${prefix}_data => \%${prefix}_data ); - $c->render("${lcPackageName}"); + $c->render(template => "${lcPackageName}"); } 1; \ No newline at end of file diff --git a/Templates/layout.html.ep.tem b/Templates/layout.html.ep.tem index ccb4300..f45e6d7 100644 --- a/Templates/layout.html.ep.tem +++ b/Templates/layout.html.ep.tem @@ -16,26 +16,26 @@

<%=$title%>

- % if ( stash('modul') ) { + % if ( stash('modul')) { %= $c->render_to_string(inline => stash('modul') ); % } - %if ($$${prefix}_data->{first}) { + %if ($c->stash('first')) {

- %=$c->render_to_string(inline =>$c->l($$${prefix}_data->{first})) + %=$c->render_to_string(inline =>$c->l($c->stash('first')))

- %} elsif ($$${prefix}_data->{success}) { + %} elsif ($c->stash('success')) {
-

Operation Status Report

- %= $c->l($$${prefix}_data->{success}); +

<%=$c->l('Status Report') %>

+ %= $c->l($c->stash('success'));

- %} elsif ($$${prefix}_data->{error}) { + %} elsif ($c->stash('error')) {
-

Operation Status Report - error

- %= $c->l($$${prefix}_data->{error}); +

<%=$c->l('Error Status Report') %>

+ %= $c->l($c->stash('error'));

%}