ShowDashboardTabs: Difference between revisions
Jump to navigation
Jump to search
No edit summary |
No edit summary |
||
| Line 6: | Line 6: | ||
%my @dashboards = $m->comp("/Dashboards/Elements/ListOfDashboards"); | %my @dashboards = $m->comp("/Dashboards/Elements/ListOfDashboards"); | ||
<& /Dashboards/Elements/ShowDashboardTabs: | <& /Dashboards/Elements/ShowDashboardTabs:tabs, | ||
Dashboards => \@dashboards, | Dashboards => \@dashboards, | ||
| Line 17: | Line 17: | ||
<&| /Widgets/TitleBox, title => $Title &> | <&| /Widgets/TitleBox, title => $Title &> | ||
<& SELF: | <& SELF:tabs, %ARGS &> | ||
</&> | </&> | ||
<%ARGS> | <%ARGS> | ||
| Line 23: | Line 23: | ||
</%ARGS> | </%ARGS> | ||
<%METHOD | <%METHOD tabs> | ||
<%ARGS> | <%ARGS> | ||
$Dashboards => undef | $Dashboards => undef | ||
| Line 60: | Line 60: | ||
<% $dashboard->Name %> | <% $dashboard->Name %> | ||
</a> | </a> | ||
· | |||
% } | % } | ||
Revision as of 17:34, 25 January 2011
Wanted an easy way to get back to my Dashboards from any page so I set out to add the dashboards separated by a dot along the top (to the left of the existing content of the PersonalQuickbar.
Needed to add one file and modify another.
I modified the rt3/local/html/Elements/PersonalQuickbar file to add this:
%my @dashboards = $m->comp("/Dashboards/Elements/ListOfDashboards");
<& /Dashboards/Elements/ShowDashboardTabs:tabs,
Dashboards => \@dashboards,
Verbose => 0,
&>
Added the rt3/local/html/Dashboards/Elements/ShowDashboardTabs file with this content:
<&| /Widgets/TitleBox, title => $Title &>
<& SELF:tabs, %ARGS &>
</&>
<%ARGS>
$Title => undef
</%ARGS>
<%METHOD tabs>
<%ARGS>
$Dashboards => undef
$Verbose => 1
</%ARGS>
<%INIT>
# map each subscription to a dashboard ID
my %subscription_for;
for my $attr ($session{'CurrentUser'}->UserObj->Attributes->Named('Subscription')) {
$subscription_for{$attr->SubValue('DashboardId')} = $attr;
}
</%INIT>
% if (@$Dashboards == 0) {
% if ($Verbose) {
<% loc("No dashboards.") %>
% }
% } else {
% if ($Verbose) {
% }
% my $i = 0;
% for my $dashboard (@$Dashboards) {
% my $url = sprintf '%s/Dashboards/%d/%s',
% RT->Config->Get('WebPath'),
% $dashboard->Id,
% $dashboard->Name;
% if ($Verbose) {
<a href="<% $url %>">
<% $dashboard->Id %>
</a>
% }
<a href="<% $url %>">
<% $dashboard->Name %>
</a>
·
% }
% }
</%METHOD>