[82828] branches/gsoc11-statistics/stats-server/app/views/ports/show.html. erb

derek at macports.org derek at macports.org
Sat Aug 20 18:23:57 PDT 2011


Revision: 82828
          http://trac.macports.org/changeset/82828
Author:   derek at macports.org
Date:     2011-08-20 18:23:55 -0700 (Sat, 20 Aug 2011)
Log Message:
-----------
Display tweaks

- Show name of port as a header
- Added links to each visualization using html anchors
- Visualizations and tables have separate options - tables shouldn't have a fixed height

Modified Paths:
--------------
    branches/gsoc11-statistics/stats-server/app/views/ports/show.html.erb

Modified: branches/gsoc11-statistics/stats-server/app/views/ports/show.html.erb
===================================================================
--- branches/gsoc11-statistics/stats-server/app/views/ports/show.html.erb	2011-08-21 01:19:21 UTC (rev 82827)
+++ branches/gsoc11-statistics/stats-server/app/views/ports/show.html.erb	2011-08-21 01:23:55 UTC (rev 82828)
@@ -16,12 +16,12 @@
                      :version_count, 
                      :variant_count] %>
 
+<h1> <%= @port.name %> </h1>
+
+<br />
+
 <div id="content">
   <p>
-    <strong>Name:</strong> <%= @port.name %>
-  </p>
-
-  <p>
     <strong>Current Version:</strong> <%= @port.version %>
   </p>
 
@@ -48,15 +48,55 @@
     </p>
   <% end %>
 
+  </div>
+  
+  <br />
+  
+  <h2> Stats </h2>
+
+  <%# Generate links %>
+  <ul>
+  <% ordered_charts.each do |chart|  %>
+  <li> <%= link_to controller.chart_title(chart), :anchor => chart %> </li>
+  <% end %>
+  </ul>
+
+  <br />
+
   <%# Draw charts %>
   <% ordered_charts.each do |chart| %>
-    <% options = {:width => 600, :height => 400, :html => {:class => "graph_chart"}} %>
-    <% options[:title] = controller.chart_title chart %>
+    <% title = controller.chart_title chart %>
+    <%# Set visualization options %>
+    <% vis_options = {:width => 600, :height => 400, :html => {:class => "graph_chart"}} %>
+    <% vis_options[:title] = title %>
+
+    <%# Set table options %>
+    <% table_options = {:width => 600, :html => {:class => "graph_chart"}} %>
+    <% table_options[:title] = title %>
+    
     <% type = controller.chart_type chart %>
 
-    <% visualization chart, type, options do |visualization| %>
-      <% controller.populate_chart chart, visualization %>
-    <% end %>
+    <%# Anchor %>
+    <a name=<%= chart %>> </a>
+    <%# Title %>
+    <h2> <%= title %> </h2>
+   
+  
+    <% if not controller.dataset_empty? chart %>
+      <%# Draw visualization %>
+      <% visualization chart, type, vis_options do |visualization| %>
+        <% controller.populate_chart chart, visualization %>
+      <% end %>
+      
+      <%# Draw table %>
+      <% table = chart.to_s + "_table" %>
+      <% visualization table, "Table", table_options do |visualization| %>
+        <% controller.populate_chart chart, visualization %>
+      <% end %>
+      
+    <% else %>
+      No data to display
+    <% end %>  
   <% end %>
 
   <table border=1>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/macports-changes/attachments/20110820/12fca0a8/attachment.html>


More information about the macports-changes mailing list