<% @page_title = "#{@port.name} port" %>

<h2><%=h @port.name %></h2>

<div class='tagbox'>
  <h4>Tags</h4>
  
  <form action='/port/tag' method='post'>
    <input type='hidden' name='id' value='<%=h @port.id %>'>
    <p><input type='text' size='20' name='tags'></input>
      <input type='submit' name='add_tags' value='Add'></input>
      </p>
  </form>
  
  <p>
    <% for tag in @port.tags.sort %>
  		<%= link_to tag.name, :controller => 'tag', :action => 'show', :id => tag %><br />
  	<% end %>
	</p>
</div>

<p class='short_desc'><%=h @port.short_desc if @port.short_desc %></p>
<% if @port.long_desc && @port.long_desc != @port.short_desc %>
    <div class='long_desc'><%= simple_format(@port.long_desc) %></div>
<% end %>

<p><strong>Home Page:</strong> <%= auto_link @port.home_page %></p>

<p>
  <strong>Maintainers:</strong>
	<% for maintainer in @port.maintainers %>
		<%= link_to email_obfuscate(maintainer.user_name), :controller => 'person', :action => 'show', :id => maintainer %>
	<% end %>
</p>

<h4>Port Packages</h4>
<table>
	<tr>
		<th>PkgId</th>
		<th>Version</th>
		<th>Submitter</th>
		<th>Date</th>
		<th>Download</th>
	</tr>
	<% for pkg in @port.port_pkgs.sort.reverse %>
    <% pkg_ver = pkg.epoch.to_i != 0 ?
    	    "(#{pkg.epoch}) #{pkg.version}_#{pkg.revision}" :
    	    "#{pkg.version}_#{pkg.revision}" %>
		<tr>
			<td><%= link_to pkg.id,  :controller => 'port_pkg', :action => 'show', :id => pkg %></td>
			<td><%= link_to pkg_ver, :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.to_formatted_s(:long) %></td>
  		<td><%= link_to 'download', :controller => 'port_pkg', :action => 'emit_portpkg', :id => pkg %></td>
		</tr>
	<% end %>
</table>

<!--
<h4>Comments</h4>
<p>
	<% for comment in @port.comments.sort %>
	  <div class='comment'>
	    <div class='comment_header'>
	      <span class='commenter'><%=h comment.commenter.user_name %><span>
  	    <span class='comment_date'><%= comment.comment_at.to_formatted_s(:long) %><span>
	    </div>
  	  <%= simple_format(comment.comment) %>
	  </div>
	<% end %>
</p>

<form action='/port/add_comment' method='post'>
  <input type='hidden' name='id' value='<%=h @port.id %>'>
  <textarea rows='8' cols='80' name='text'></textarea><br />
  <input type='submit' name='add_comment' value='Add Comment'></input>
</form>
-->
