From d31797c6744b5e0ecb6a0c76fac4ebaf633f1f07 Mon Sep 17 00:00:00 2001 From: Flaviu Mates Date: Tue, 12 May 2020 16:53:10 +0300 Subject: [PATCH] TT#81185 - Return only body when parameter 'framed' is sent * Remove headers, menu, site title and footer if parameter 'framed' is sent * Persist 'framed' in the session once it's sent and only restore header/footer once 'framed' is sent again with the value 0 Change-Id: Ie1dcc698b901ea3c659a05391ffcdc882113ef13 --- lib/NGCP/Panel/Controller/Root.pm | 3 +++ share/layout/html.tt | 6 ++++++ share/layout/wrapper.tt | 2 +- share/templates/helpers/datatables.tt | 2 +- 4 files changed, 11 insertions(+), 2 deletions(-) diff --git a/lib/NGCP/Panel/Controller/Root.pm b/lib/NGCP/Panel/Controller/Root.pm index e257f051a9..fa8baa27bf 100644 --- a/lib/NGCP/Panel/Controller/Root.pm +++ b/lib/NGCP/Panel/Controller/Root.pm @@ -344,6 +344,9 @@ sub auto :Private { } $c->stash(topmenu => $topmenu_templates); + $c->session->{framed} = 1 if ($c->req->params->{framed} && $c->req->params->{framed} == 1); + $c->session->{framed} = 0 if (defined $c->req->params->{framed} && $c->req->params->{framed} == 0); + $c->stash(framed => $c->session->{framed}) if ($c->session->{framed} && $c->session->{framed} == 1); $c->session->{created_objects} = {} unless(defined $c->session->{created_objects}); diff --git a/share/layout/html.tt b/share/layout/html.tt index a81714998a..a298746225 100644 --- a/share/layout/html.tt +++ b/share/layout/html.tt @@ -44,6 +44,12 @@ [% END -%] + [% IF framed -%] +
+ [% END -%] [% content %] + [% IF framed -%] +
+ [% END -%] [% # vim: set tabstop=4 syntax=html expandtab: -%] diff --git a/share/layout/wrapper.tt b/share/layout/wrapper.tt index 444a9974ef..f89a304e69 100644 --- a/share/layout/wrapper.tt +++ b/share/layout/wrapper.tt @@ -1,7 +1,7 @@ [% IF template.name.match('^api|(\.html$|\.css$|\.js$|\.txt$)'); content; - ELSIF template.name.match('^login\/login\.tt$'); + ELSIF template.name.match('^login\/login\.tt$') || framed; content WRAPPER html.tt; ELSE; content WRAPPER html.tt + body.tt; diff --git a/share/templates/helpers/datatables.tt b/share/templates/helpers/datatables.tt index 864c802710..e55bb6d556 100644 --- a/share/templates/helpers/datatables.tt +++ b/share/templates/helpers/datatables.tt @@ -295,7 +295,7 @@ $(document).ready(function() { [% IF (!back_created) || helper.top_buttons.size -%]
- [% UNLESS back_created -%] + [% UNLESS back_created || framed -%] [% c.loc("Back") %]