Bug 33333: Use template wrapper for tabs: SQL reports

This patch updates the saved SQL reports template so that it uses the
new WRAPPER directive to build tab markup.

To test, apply the patch and go to Reports -> Use saved. In order to
properly test the patch you should have multiple reports defined with
multiple categories ("Accounts", "Acquisitions", "Catalog", etc.).

Clicking each tab should filter the table of reports correctly.
After navigating away from the page and back to it, your selected tab
should be remembered.

Signed-off-by: Alexandra Speer <alexandra.speer@bsz-bw.de>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
This commit is contained in:
Owen Leonard 2023-03-23 16:45:00 +00:00 committed by Tomas Cohen Arazi
parent 043822ce8f
commit 6884b73a71
No known key found for this signature in database
GPG Key ID: 0A272EA1B2F3C15F
2 changed files with 20 additions and 19 deletions

View File

@ -394,7 +394,7 @@
[% ELSE %]
<li role="presentation">
[% END %]
<a href="#[% tabname | uri %]_panel" aria-controls="[% tabname | uri %]_panel" role="tab" data-toggle="tab">
<a href="#[% tabname | uri %]_panel" data-tabname="[% tabname | uri %]" aria-controls="[% tabname | uri %]_panel" role="tab" data-toggle="tab">
[% content | $raw %]
</a>
</li>

View File

@ -244,20 +244,17 @@
</p>
[% END %]
<div id="tabs" class="toptabs">
<ul class="nav nav-tabs" role="tablist">
<li role="presentation" class="active">
<a href="#reports" aria-controls="reports" role="tab" data-toggle="tab">All</a>
</li>
[% WRAPPER tabs id= "tabs" %]
[% WRAPPER tabs_nav %]
[% WRAPPER tab_item tabname= "reports" bt_active= 1 %] <span>All</span> [% END %]
[% FOREACH group IN groups_with_subgroups %]
<li role="presentation">
<a id="[% group.id | html %]" href="#reports" aria-controls="reports" role="tab" data-toggle="tab">[% group.name | html %]</a>
</li>
[% WRAPPER tab_item tabname= group.id %] <span>[% group.name | html %]</span> [% END %]
[% END %]
</ul>
[% END # /WRAPPER tabs_nav %]
[% WRAPPER tab_panels %]
[% WRAPPER tab_panel tabname="reports" bt_active= 1 %]
<div class="tab-content">
<div id="reports" role="tabpanel" class="tab-pane active">
<div id="subgroup_filter_block">
<label for="subgroup_filter">Subgroup:</label>
<select id="subgroup_filter">
@ -419,9 +416,13 @@
</fieldset>
[% END %]
</form>
</div> <!-- /#reports -->
</div> <!-- /.tab-content -->
</div>
[% END # /tab_panel# %]
[% END # /WRAPPER tab_panels %]
[% END # /WRAPPER tabs %]
[% ELSE # IF ( savedreports ) %]
<div class="dialog message">
[% IF (filter_set || filters.date || filters.author || filters.keyword) %]
@ -2241,8 +2242,7 @@
}
function tabsInit( tab, rtable ){
var thisTab = tab; // ui.newTab ? ui.newTab : ui.tab;
var activeTab = thisTab.index();
var activeTab = tab.index();
localStorage.setItem("sql_reports_activetab", activeTab );
$("#subgroup_filter option").each(function() {
@ -2255,8 +2255,9 @@
rtable.fnSetColumnVis(4, true);
rtable.fnSetColumnVis(5, true);
var g_id = $( tab ).children().attr('id');
var g_name = $( tab ).children().text();
var g_id = tab.find("a").data("tabname");
var g_name = tab.find("a").text().trim();
if ( g_name == _("All") ) {
g_id = "";
g_name = "";