[24874] users/jberry/mpwa

source_changes at macosforge.org source_changes at macosforge.org
Sun May 6 21:32:39 PDT 2007


Revision: 24874
          http://trac.macosforge.org/projects/macports/changeset/24874
Author:   jberry at macports.org
Date:     2007-05-06 21:32:38 -0700 (Sun, 06 May 2007)

Log Message:
-----------
mpwa: improve some output. getting close to being ready for a public trial

Modified Paths:
--------------
    users/jberry/mpwa/app/controllers/application.rb
    users/jberry/mpwa/app/controllers/file_blob_controller.rb
    users/jberry/mpwa/app/controllers/mac_ports_controller.rb
    users/jberry/mpwa/app/controllers/person_controller.rb
    users/jberry/mpwa/app/controllers/port_controller.rb
    users/jberry/mpwa/app/controllers/port_pkg_controller.rb
    users/jberry/mpwa/app/controllers/port_pkg_file_controller.rb
    users/jberry/mpwa/app/controllers/tag_controller.rb
    users/jberry/mpwa/app/controllers/variant_controller.rb
    users/jberry/mpwa/app/models/port.rb
    users/jberry/mpwa/app/models/port_pkg.rb
    users/jberry/mpwa/app/views/layouts/application.rhtml
    users/jberry/mpwa/app/views/mac_ports/show.rhtml
    users/jberry/mpwa/app/views/port/list.rhtml
    users/jberry/mpwa/app/views/port/show.rhtml
    users/jberry/mpwa/app/views/tag/list.rhtml
    users/jberry/mpwa/app/views/tag/show.rhtml
    users/jberry/mpwa/doc/TODO.txt

Added Paths:
-----------
    users/jberry/mpwa/app/helpers/table_helper.rb
    users/jberry/mpwa/app/views/shared/

Modified: users/jberry/mpwa/app/controllers/application.rb
===================================================================
--- users/jberry/mpwa/app/controllers/application.rb	2007-05-07 03:26:48 UTC (rev 24873)
+++ users/jberry/mpwa/app/controllers/application.rb	2007-05-07 04:32:38 UTC (rev 24874)
@@ -25,8 +25,6 @@
             'print', 'python', 'ruby', 'science', 'security', 'shells', 'sysutils',
             'tex', 'textproc', 'www', 'x11', 'zope'
             ]
-        
-            
 	end
 	
 end
\ No newline at end of file

Modified: users/jberry/mpwa/app/controllers/file_blob_controller.rb
===================================================================
--- users/jberry/mpwa/app/controllers/file_blob_controller.rb	2007-05-07 03:26:48 UTC (rev 24873)
+++ users/jberry/mpwa/app/controllers/file_blob_controller.rb	2007-05-07 04:32:38 UTC (rev 24874)
@@ -48,4 +48,7 @@
     FileBlob.find(params[:id]).destroy
     redirect_to :action => 'list'
   end
+  
+  private :create, :edit, :update, :destroy
+  
 end

Modified: users/jberry/mpwa/app/controllers/mac_ports_controller.rb
===================================================================
--- users/jberry/mpwa/app/controllers/mac_ports_controller.rb	2007-05-07 03:26:48 UTC (rev 24873)
+++ users/jberry/mpwa/app/controllers/mac_ports_controller.rb	2007-05-07 04:32:38 UTC (rev 24874)
@@ -1,4 +1,6 @@
 class MacPortsController < ApplicationController
+    helper :table
+    
     def index
       render :action => 'show'
     end

Modified: users/jberry/mpwa/app/controllers/person_controller.rb
===================================================================
--- users/jberry/mpwa/app/controllers/person_controller.rb	2007-05-07 03:26:48 UTC (rev 24873)
+++ users/jberry/mpwa/app/controllers/person_controller.rb	2007-05-07 04:32:38 UTC (rev 24874)
@@ -9,7 +9,7 @@
          :redirect_to => { :action => :list }
 
   def list
-    @person_pages, @people = paginate :people, :per_page => 10
+    @person_pages, @people = paginate :people, :per_page => 40
   end
 
   def show
@@ -48,4 +48,6 @@
     Person.find(params[:id]).destroy
     redirect_to :action => 'list'
   end
+  
+  private :create, :edit, :update, :destroy
 end

Modified: users/jberry/mpwa/app/controllers/port_controller.rb
===================================================================
--- users/jberry/mpwa/app/controllers/port_controller.rb	2007-05-07 03:26:48 UTC (rev 24873)
+++ users/jberry/mpwa/app/controllers/port_controller.rb	2007-05-07 04:32:38 UTC (rev 24874)
@@ -1,4 +1,7 @@
 class PortController < ApplicationController
+    
+  helper :table
+    
   def index
     list
     render :action => 'list'
@@ -9,7 +12,7 @@
          :redirect_to => { :action => :list }
 
   def list
-    @port_pages, @ports = paginate :ports, :per_page => 10
+    @port_pages, @ports = paginate :ports, :per_page => 40, :order => 'name'
   end
 
   def show
@@ -49,5 +52,6 @@
     redirect_to :action => 'list'
   end
   
+  private :create, :edit, :update, :destroy
   
 end

Modified: users/jberry/mpwa/app/controllers/port_pkg_controller.rb
===================================================================
--- users/jberry/mpwa/app/controllers/port_pkg_controller.rb	2007-05-07 03:26:48 UTC (rev 24873)
+++ users/jberry/mpwa/app/controllers/port_pkg_controller.rb	2007-05-07 04:32:38 UTC (rev 24874)
@@ -87,5 +87,5 @@
     send_data file.file_blob.data, :filename => file.file_path, :type => file.mime_type, :disposition => 'inline'
   end
   
-  
+  private :create, :edit, :update, :destroy
 end

Modified: users/jberry/mpwa/app/controllers/port_pkg_file_controller.rb
===================================================================
--- users/jberry/mpwa/app/controllers/port_pkg_file_controller.rb	2007-05-07 03:26:48 UTC (rev 24873)
+++ users/jberry/mpwa/app/controllers/port_pkg_file_controller.rb	2007-05-07 04:32:38 UTC (rev 24874)
@@ -54,4 +54,6 @@
     send_data file.data, :filename => file.file_path, :type => file.mime_type, :disposition => 'inline'
   end
   
+  private :create, :edit, :update, :destroy
+  
 end

Modified: users/jberry/mpwa/app/controllers/tag_controller.rb
===================================================================
--- users/jberry/mpwa/app/controllers/tag_controller.rb	2007-05-07 03:26:48 UTC (rev 24873)
+++ users/jberry/mpwa/app/controllers/tag_controller.rb	2007-05-07 04:32:38 UTC (rev 24874)
@@ -1,4 +1,7 @@
 class TagController < ApplicationController
+    
+  helper :table
+    
   def index
     list
     render :action => 'list'
@@ -9,7 +12,7 @@
          :redirect_to => { :action => :list }
 
   def list
-    @tag_pages, @tags = paginate :tags, :per_page => 10
+    @tag_pages, @tags = paginate :tags, :per_page => 128, :order => 'name'
   end
 
   def show
@@ -56,4 +59,7 @@
     Tag.find(params[:id]).destroy
     redirect_to :action => 'list'
   end
+  
+  private :create, :edit, :update, :destroy
+  
 end

Modified: users/jberry/mpwa/app/controllers/variant_controller.rb
===================================================================
--- users/jberry/mpwa/app/controllers/variant_controller.rb	2007-05-07 03:26:48 UTC (rev 24873)
+++ users/jberry/mpwa/app/controllers/variant_controller.rb	2007-05-07 04:32:38 UTC (rev 24874)
@@ -48,4 +48,7 @@
     Variant.find(params[:id]).destroy
     redirect_to :action => 'list'
   end
+  
+  private :create, :edit, :update, :destroy
+  
 end

Added: users/jberry/mpwa/app/helpers/table_helper.rb
===================================================================
--- users/jberry/mpwa/app/helpers/table_helper.rb	                        (rev 0)
+++ users/jberry/mpwa/app/helpers/table_helper.rb	2007-05-07 04:32:38 UTC (rev 24874)
@@ -0,0 +1,30 @@
+
+require 'enumerator'
+
+module TableHelper
+    
+    def columnize(a, ccnt = 2, rowMajor = true)
+
+        # Turn the array into a series of rows and columns
+        len = a.length
+        rcnt = (len + ccnt - 1) / ccnt
+
+        if rowMajor
+            cols = []
+            a.each_slice(rcnt) do |s|
+            	s.fill(nil, s.length, rcnt - s.length) if (s.length < rcnt)
+            	cols.push(s)
+            end
+            rows = cols.transpose
+        else
+            rows = []
+            a.each_slice(rcnt) do |s|
+            	s.fill(nil, s.length, rcnt - s.length) if (s.length < rcnt)
+            	rows.push(s)
+            end
+        end
+        
+        return rows
+    end
+end
+

Modified: users/jberry/mpwa/app/models/port.rb
===================================================================
--- users/jberry/mpwa/app/models/port.rb	2007-05-07 03:26:48 UTC (rev 24873)
+++ users/jberry/mpwa/app/models/port.rb	2007-05-07 04:32:38 UTC (rev 24874)
@@ -39,4 +39,8 @@
         self.tags << Tag.find_or_create_by_name(name) unless has_tag name
     end
     
+    def <=>(other)
+        self.name <=> other.name
+    end
+    
 end

Modified: users/jberry/mpwa/app/models/port_pkg.rb
===================================================================
--- users/jberry/mpwa/app/models/port_pkg.rb	2007-05-07 03:26:48 UTC (rev 24873)
+++ users/jberry/mpwa/app/models/port_pkg.rb	2007-05-07 04:32:38 UTC (rev 24874)
@@ -144,4 +144,8 @@
         self.tags << Tag.find_or_create_by_name(name) unless has_tag name
     end
     
+    def <=>(other)
+        self.id <=> other.id
+    end
+
 end

Modified: users/jberry/mpwa/app/views/layouts/application.rhtml
===================================================================
--- users/jberry/mpwa/app/views/layouts/application.rhtml	2007-05-07 03:26:48 UTC (rev 24873)
+++ users/jberry/mpwa/app/views/layouts/application.rhtml	2007-05-07 04:32:38 UTC (rev 24874)
@@ -12,7 +12,7 @@
 	
 	<div class='mp_header'>
 		<div class='header_left'>
-			<h1>MacPorts</h1>
+			<h1><a href='/'>MacPorts</a></h1>
 		</div>
 		</div class='header_right'>
 			<form action='/search' method='post'>

Modified: users/jberry/mpwa/app/views/mac_ports/show.rhtml
===================================================================
--- users/jberry/mpwa/app/views/mac_ports/show.rhtml	2007-05-07 03:26:48 UTC (rev 24873)
+++ users/jberry/mpwa/app/views/mac_ports/show.rhtml	2007-05-07 04:32:38 UTC (rev 24874)
@@ -1,5 +1,11 @@
 <h4>Primary Port Categories</h4>
 
-<% for tag in @main_tags %>
-	<%= link_to tag, :controller => 'tag', :action => 'show', :name => tag %>
-<% end %>
+<table>
+	<% for row in columnize(@main_tags.sort, 6) %>
+		<tr>
+			<% for tag in row %>
+				<td><%= link_to tag, :controller => 'tag', :action => 'show', :name => tag if !tag.nil? %></td>
+			<% end %>
+		</tr>
+	<% end %>
+</table>

Modified: users/jberry/mpwa/app/views/port/list.rhtml
===================================================================
--- users/jberry/mpwa/app/views/port/list.rhtml	2007-05-07 03:26:48 UTC (rev 24873)
+++ users/jberry/mpwa/app/views/port/list.rhtml	2007-05-07 04:32:38 UTC (rev 24874)
@@ -1,27 +1,11 @@
-<h1>Listing ports</h1>
+<h2>Listing ports</h2>
 
 <table>
-  <tr>
-  <% for column in Port.content_columns %>
-    <th><%= column.human_name %></th>
+  <tr><th>Port</th></tr>
+  <% for port in @ports %>
+    <tr><td><%= link_to port.name, :action => 'show', :id => port %></td></tr>
   <% end %>
-  </tr>
-  
-<% for port in @ports %>
-  <tr>
-  <% for column in Port.content_columns %>
-    <td><%=h port.send(column.name) %></td>
-  <% end %>
-    <td><%= link_to 'Show', :action => 'show', :id => port %></td>
-    <td><%= link_to 'Edit', :action => 'edit', :id => port %></td>
-    <td><%= link_to 'Destroy', { :action => 'destroy', :id => port }, :confirm => 'Are you sure?', :method => :post %></td>
-  </tr>
-<% end %>
 </table>
 
 <%= link_to 'Previous page', { :page => @port_pages.current.previous } if @port_pages.current.previous %>
 <%= link_to 'Next page', { :page => @port_pages.current.next } if @port_pages.current.next %> 
-
-<br />
-
-<%= link_to 'New port', :action => 'new' %>

Modified: users/jberry/mpwa/app/views/port/show.rhtml
===================================================================
--- users/jberry/mpwa/app/views/port/show.rhtml	2007-05-07 03:26:48 UTC (rev 24873)
+++ users/jberry/mpwa/app/views/port/show.rhtml	2007-05-07 04:32:38 UTC (rev 24874)
@@ -1,18 +1,21 @@
-<% for column in Port.content_columns %>
-<p>
-  <b><%= column.human_name %>:</b> <%=h @port.send(column.name) %>
-</p>
-<% end %>
 
-<h4>Maintainers</h4>
+<h2><%=h @port.name %></h2>
+
+<p><em><%=h @port.short_desc %></em></p>
+
+<%= simple_format(word_wrap(@port.long_desc)) %>
+
+<p><b>Home Page:</b> <%= auto_link @port.home_page %></p>
+
 <p>
+  <b>Maintainers:</b>
 	<% for maintainer in @port.maintainers %>
 		<%= link_to maintainer.user_name, :controller => 'person', :action => 'show', :id => maintainer %>
 	<% end %>
 </p>
 
-<h4>Tags</h4>
 <p>
+  <b>Tags</b>
 	<% for tag in @port.tags %>
 		<%= link_to tag.name, :controller => 'tag', :action => 'show', :id => tag %>
 	<% end %>
@@ -30,10 +33,7 @@
 			<td><%= link_to pkg.id, :controller => 'port_pkg', :action => 'show', :id => pkg %></td>
 			<td><%= link_to pkg.submitter.user_name, :controller => 'person', :action => 'show',
 					:id => pkg.submitter %></td>
-			<td><%= pkg.submitted_at %></td>
+			<td><%= link_to pkg.submitted_at, :controller => 'port_pkg', :action => 'show', :id => pkg %></td>
 		</tr>
 	<% end %>
 </table>
-
-<%= link_to 'Edit', :action => 'edit', :id => @port %> |
-<%= link_to 'Back', :action => 'list' %>

Modified: users/jberry/mpwa/app/views/tag/list.rhtml
===================================================================
--- users/jberry/mpwa/app/views/tag/list.rhtml	2007-05-07 03:26:48 UTC (rev 24873)
+++ users/jberry/mpwa/app/views/tag/list.rhtml	2007-05-07 04:32:38 UTC (rev 24874)
@@ -1,27 +1,14 @@
-<h1>Listing tags</h1>
+<h2>Listing tags</h2>
 
 <table>
-  <tr>
-  <% for column in Tag.content_columns %>
-    <th><%= column.human_name %></th>
-  <% end %>
-  </tr>
-  
-<% for tag in @tags %>
-  <tr>
-  <% for column in Tag.content_columns %>
-    <td><%=h tag.send(column.name) %></td>
-  <% end %>
-    <td><%= link_to 'Show', :action => 'show', :id => tag %></td>
-    <td><%= link_to 'Edit', :action => 'edit', :id => tag %></td>
-    <td><%= link_to 'Destroy', { :action => 'destroy', :id => tag }, :confirm => 'Are you sure?', :method => :post %></td>
-  </tr>
-<% end %>
+	<% for row in columnize(@tags, 6) %>
+		<tr>
+			<% for tag in row %>
+				<td><%= link_to tag.name, :controller => 'tag', :action => 'show', :id => tag if tag %></td>
+			<% end %>
+		</tr>
+	<% end %>
 </table>
 
 <%= link_to 'Previous page', { :page => @tag_pages.current.previous } if @tag_pages.current.previous %>
 <%= link_to 'Next page', { :page => @tag_pages.current.next } if @tag_pages.current.next %> 
-
-<br />
-
-<%= link_to 'New tag', :action => 'new' %>

Modified: users/jberry/mpwa/app/views/tag/show.rhtml
===================================================================
--- users/jberry/mpwa/app/views/tag/show.rhtml	2007-05-07 03:26:48 UTC (rev 24873)
+++ users/jberry/mpwa/app/views/tag/show.rhtml	2007-05-07 04:32:38 UTC (rev 24874)
@@ -1,22 +1,24 @@
-<% for column in Tag.content_columns %>
-<p>
-  <b><%= column.human_name %>:</b> <%=h @tag.send(column.name) %>
-</p>
-<% end %>
 
+<h2>Tag: <%= h @tag.name %></h2>
+
 <h4>Ports with this tag</h4>
-<p>
-	<% for port in @tag.ports %>
-		<%= link_to port.name, :controller => 'port', :action => 'show', :id => port %><br />
+<table>
+	<% for row in columnize(@tag.ports.sort, 4) %>
+		<tr>
+			<% for port in row %>
+				<td><%= link_to port.name, :controller => 'port', :action => 'show', :id => port if !port.nil? %></td>
+			<% end %>
+		</tr>
 	<% end %>
-</p>
+</table>
 
 <h4>Port Packages with this tag</h4>
-<p>
-	<% for pkg in @tag.port_pkgs %>
-		<%= link_to pkg.id, :controller => 'port_pkg', :action => 'show', :id => pkg %><br />
+<table>
+	<% for row in columnize(@tag.port_pkgs, 6) %>
+		<tr>
+			<% for pkg in row %>
+				<td><%= link_to pkg.id, :controller => 'port_pkg', :action => 'show', :id => pkg if !pkg.nil? %></td>
+			<% end %>
+		</tr>
 	<% end %>
-</p>
-
-<%= link_to 'Edit', :action => 'edit', :id => @tag %> |
-<%= link_to 'Back', :action => 'list' %>
+</table>

Modified: users/jberry/mpwa/doc/TODO.txt
===================================================================
--- users/jberry/mpwa/doc/TODO.txt	2007-05-07 03:26:48 UTC (rev 24873)
+++ users/jberry/mpwa/doc/TODO.txt	2007-05-07 04:32:38 UTC (rev 24874)
@@ -1,9 +1,5 @@
 Short Term:
 
-	- Set proper naming for downloaded file (this may work already)
-	- Security cleanup (edit)
-	- Maybe wrap autosubmit up into larger sqlite transaction granularity
-
 Medium Term:
 	
 	- Improve (drastically) the UI for port browsing
@@ -14,6 +10,7 @@
 	- Global Page header:
 		- MacPorts logo
 		- Search Box to search for ports by name
+		- Category tags
 	
 	- Top level page:
 		- Well-known tags

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.macosforge.org/pipermail/macports-changes/attachments/20070506/c6dda176/attachment.html


More information about the macports-changes mailing list