@@ -16,10 +16,11 | |||
|
16 | 16 | # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. |
|
17 | 17 | |
|
18 | 18 | class DocumentsController < ApplicationController |
|
19 |
|
|
|
20 |
|
|
|
21 | ||
|
22 | def show | |
|
19 | layout 'base' | |
|
20 | before_filter :find_project, :authorize | |
|
21 | ||
|
22 | def show | |
|
23 | @attachments = @document.attachments.find(:all, :order => "created_on DESC") | |
|
23 | 24 | end |
|
24 | 25 | |
|
25 | 26 | def edit |
@@ -48,18 +49,17 class DocumentsController < ApplicationController | |||
|
48 | 49 | @attachment.author_id = self.logged_in_user.id if self.logged_in_user |
|
49 | 50 | @attachment.save |
|
50 | 51 | end |
|
51 |
re |
|
|
52 | redirect_to :action => 'show', :id => @document | |
|
52 | 53 | end |
|
53 | 54 | |
|
54 | 55 | def destroy_attachment |
|
55 | 56 | @document.attachments.find(params[:attachment_id]).destroy |
|
56 |
re |
|
|
57 | redirect_to :action => 'show', :id => @document | |
|
57 | 58 | end |
|
58 | 59 | |
|
59 | 60 | private |
|
60 |
|
|
|
61 | def find_project | |
|
61 | 62 | @document = Document.find(params[:id]) |
|
62 |
|
|
|
63 |
|
|
|
64 | ||
|
63 | @project = @document.project | |
|
64 | end | |
|
65 | 65 | end |
@@ -18,11 +18,11 | |||
|
18 | 18 | |
|
19 | 19 | <br /><br /> |
|
20 | 20 | |
|
21 | <table border="0" cellspacing="1" cellpadding="2" width="100%"> | |
|
22 |
<% for attachment in @ |
|
|
23 | <tr style="background-color:#CEE1ED"> | |
|
21 | <table class="listTableContent"> | |
|
22 | <% for attachment in @attachments %> | |
|
23 | <tr class="<%= cycle("odd", "even") %>"> | |
|
24 | <td><%= format_date(attachment.created_on) %></td> | |
|
24 | 25 | <td><%= link_to attachment.filename, :action => 'download', :id => @document, :attachment_id => attachment %></td> |
|
25 | <td align="center"><%= format_date(attachment.created_on) %></td> | |
|
26 | 26 | <td align="center"><%= attachment.author.display_name %></td> |
|
27 | 27 | <td><%= human_size(attachment.filesize) %><br /><%= lwr(:label_download, attachment.downloads) %></td> |
|
28 | 28 |
General Comments 0
You need to be logged in to leave comments.
Login now