# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.\r
\r
class DocumentsController < ApplicationController\r
- layout 'base'\r
- before_filter :find_project, :authorize\r
-
- def show
+ layout 'base'\r
+ before_filter :find_project, :authorize\r
+
+ def show\r
+ @attachments = @document.attachments.find(:all, :order => "created_on DESC")
end
def edit\r
@attachment.author_id = self.logged_in_user.id if self.logged_in_user\r
@attachment.save\r
end\r
- render :action => 'show'\r
+ redirect_to :action => 'show', :id => @document\r
end\r
\r
def destroy_attachment\r
@document.attachments.find(params[:attachment_id]).destroy\r
- render :action => 'show'\r
+ redirect_to :action => 'show', :id => @document\r
end
\r
private\r
- def find_project\r
+ def find_project\r
@document = Document.find(params[:id])\r
- @project = @document.project\r
- end
-
+ @project = @document.project\r
+ end
end
\r
<br /><br />\r
\r
-<table border="0" cellspacing="1" cellpadding="2" width="100%">
-<% for attachment in @document.attachments %>
- <tr style="background-color:#CEE1ED">
+<table class="listTableContent">
+<% for attachment in @attachments %>
+ <tr class="<%= cycle("odd", "even") %>">
+ <td><%= format_date(attachment.created_on) %></td>\r
<td><%= link_to attachment.filename, :action => 'download', :id => @document, :attachment_id => attachment %></td>\r
- <td align="center"><%= format_date(attachment.created_on) %></td>
<td align="center"><%= attachment.author.display_name %></td>
<td><%= human_size(attachment.filesize) %><br /><%= lwr(:label_download, attachment.downloads) %></td>\r
\r