diff --git a/redmine/app/controllers/documents_controller.rb b/redmine/app/controllers/documents_controller.rb index e8c8e2d..f269357 100644 --- a/redmine/app/controllers/documents_controller.rb +++ b/redmine/app/controllers/documents_controller.rb @@ -16,10 +16,11 @@ # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. class DocumentsController < ApplicationController - layout 'base' - before_filter :find_project, :authorize - - def show + layout 'base' + before_filter :find_project, :authorize + + def show + @attachments = @document.attachments.find(:all, :order => "created_on DESC") end def edit @@ -48,18 +49,17 @@ class DocumentsController < ApplicationController @attachment.author_id = self.logged_in_user.id if self.logged_in_user @attachment.save end - render :action => 'show' + redirect_to :action => 'show', :id => @document end def destroy_attachment @document.attachments.find(params[:attachment_id]).destroy - render :action => 'show' + redirect_to :action => 'show', :id => @document end private - def find_project + def find_project @document = Document.find(params[:id]) - @project = @document.project - end - + @project = @document.project + end end diff --git a/redmine/app/views/documents/show.rhtml b/redmine/app/views/documents/show.rhtml index 1366213..89693de 100644 --- a/redmine/app/views/documents/show.rhtml +++ b/redmine/app/views/documents/show.rhtml @@ -18,11 +18,11 @@

- -<% for attachment in @document.attachments %> - +
+<% for attachment in @attachments %> + "> + -
<%= format_date(attachment.created_on) %> <%= link_to attachment.filename, :action => 'download', :id => @document, :attachment_id => attachment %><%= format_date(attachment.created_on) %> <%= attachment.author.display_name %> <%= human_size(attachment.filesize) %>
<%= lwr(:label_download, attachment.downloads) %>