[Rt-commit] r18979 - in rt/3.8/trunk: share/html share/html/Dashboards/Elements

sartak at bestpractical.com sartak at bestpractical.com
Mon Mar 30 17:10:29 EDT 2009


Author: sartak
Date: Mon Mar 30 17:10:29 2009
New Revision: 18979

Added:
   rt/3.8/trunk/share/html/Dashboards/Elements/DashboardTabs
Modified:
   rt/3.8/trunk/   (props changed)
   rt/3.8/trunk/share/html/index.html

Log:
 r81629 at onn:  sartak | 2009-03-30 17:10:12 -0400
 Factor out building a list of dashboard tabs


Added: rt/3.8/trunk/share/html/Dashboards/Elements/DashboardTabs
==============================================================================
--- (empty file)
+++ rt/3.8/trunk/share/html/Dashboards/Elements/DashboardTabs	Mon Mar 30 17:10:29 2009
@@ -0,0 +1,40 @@
+<%init>
+my @dashboards = $m->comp("/Dashboards/Elements/ListOfDashboards");
+
+# limit to a maximum of 7 dashboards
+my $more = 0;
+if (@dashboards > 7) {
+    $more = 1;
+    splice @dashboards, 7;
+}
+
+my $position = 0;
+my $tabs = {
+    map {
+        ++$position;
+        my $key = sprintf 'D-%03d', $position;
+        $key => {
+            title => '"' . $_->Name . '"',
+            path  => 'Dashboards/' . $_->Id . '/' . $_->Name,
+        }
+    }
+    @dashboards
+};
+
+$tabs->{"A"} = {
+    # every dashboard gets its name surrounded with "", so it's better to be
+    # consistent here, even though the language may not use ""s
+    title => '"' . loc('Home') . '"',
+    path  => 'index.html',
+};
+
+if ($more) {
+    $tabs->{"D-more"} = {
+        title => loc('More'),
+        path => 'Dashboards/index.html',
+
+    }
+}
+
+return $tabs;
+</%init>

Modified: rt/3.8/trunk/share/html/index.html
==============================================================================
--- rt/3.8/trunk/share/html/index.html	(original)
+++ rt/3.8/trunk/share/html/index.html	Mon Mar 30 17:10:29 2009
@@ -139,43 +139,7 @@
     };
 }
 
-my @dashboards = $m->comp("/Dashboards/Elements/ListOfDashboards");
-
-# limit to a maximum of 7 dashboards
-my $more = 0;
-if (@dashboards > 7) {
-    $more = 1;
-    splice @dashboards, 7;
-}
-
-my $position = 0;
-my $tabs = {
-    map {
-        ++$position;
-        my $key = sprintf 'D-%03d', $position;
-        $key => {
-            title => '"' . $_->Name . '"',
-            path  => 'Dashboards/' . $_->Id . '/' . $_->Name,
-        }
-    }
-    @dashboards
-};
-
-$tabs->{"A"} = {
-    # every dashboard gets its name surrounded with "", so it's better to be
-    # consistent here, even though the language may not use ""s
-    title => '"' . loc('Home') . '"',
-    path  => 'index.html',
-};
-
-if ($more) {
-    $tabs->{"D-more"} = {
-        title => loc('More'),
-        path => 'Dashboards/index.html',
-
-    }
-}
-
+my $tabs = $m->comp("/Dashboards/Elements/DashboardTabs");
 </%init>
 
 %# --></body></html>


More information about the Rt-commit mailing list