##// END OF EJS Templates
fixed dotted hr for IE6...
fixed dotted hr for IE6 git-svn-id: http://redmine.rubyforge.org/svn/trunk@305 e93f8b46-1217-0410-a6f0-8f06a7374b81

File last commit:

r193:2d47a6d71c09
r302:909954ac342f
Show More
documents_controller.rb
71 lines | 2.5 KiB | text/x-ruby | RubyLexer
/ app / controllers / documents_controller.rb
Jean-Philippe Lang
Initial commit...
r2 # redMine - project management software
Jean-Philippe Lang
mail notifications added when:...
r193 # Copyright (C) 2006-2007 Jean-Philippe Lang
Jean-Philippe Lang
Initial commit...
r2 #
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
class DocumentsController < ApplicationController
Jean-Philippe Lang
association loading in documents/show...
r22 layout 'base'
before_filter :find_project, :authorize
def show
@attachments = @document.attachments.find(:all, :order => "created_on DESC")
Jean-Philippe Lang
Initial commit...
r2 end
def edit
@categories = Enumeration::get_values('DCAT')
if request.post? and @document.update_attributes(params[:document])
Jean-Philippe Lang
notice messages translation...
r15 flash[:notice] = l(:notice_successful_update)
Jean-Philippe Lang
Initial commit...
r2 redirect_to :action => 'show', :id => @document
end
end
def destroy
@document.destroy
redirect_to :controller => 'projects', :action => 'list_documents', :id => @project
end
def download
@attachment = @document.attachments.find(params[:attachment_id])
@attachment.increment_download
send_file @attachment.diskfile, :filename => @attachment.filename
Jean-Philippe Lang
git-svn-id: http://redmine.rubyforge.org/svn/trunk@51 e93f8b46-1217-0410-a6f0-8f06a7374b81
r49 rescue
Jean-Philippe Lang
ActiveRecord::RecordNotFound exceptions handled more gracefully...
r130 render_404
Jean-Philippe Lang
Initial commit...
r2 end
def add_attachment
Jean-Philippe Lang
added multiple file upload for documents and files modules...
r127 # Save the attachments
Jean-Philippe Lang
mail notifications added when:...
r193 @attachments = []
params[:attachments].each { |file|
next unless file.size > 0
a = Attachment.create(:container => @document, :file => file, :author => logged_in_user)
@attachments << a unless a.new_record?
Jean-Philippe Lang
added multiple file upload for documents and files modules...
r127 } if params[:attachments] and params[:attachments].is_a? Array
Jean-Philippe Lang
mail notifications added when:...
r193 Mailer.deliver_attachments_add(@attachments) if !@attachments.empty? and Permission.find_by_controller_and_action(params[:controller], params[:action]).mail_enabled?
Jean-Philippe Lang
association loading in documents/show...
r22 redirect_to :action => 'show', :id => @document
Jean-Philippe Lang
Initial commit...
r2 end
def destroy_attachment
@document.attachments.find(params[:attachment_id]).destroy
Jean-Philippe Lang
association loading in documents/show...
r22 redirect_to :action => 'show', :id => @document
Jean-Philippe Lang
Initial commit...
r2 end
private
Jean-Philippe Lang
association loading in documents/show...
r22 def find_project
Jean-Philippe Lang
Initial commit...
r2 @document = Document.find(params[:id])
Jean-Philippe Lang
association loading in documents/show...
r22 @project = @document.project
Jean-Philippe Lang
ActiveRecord::RecordNotFound exceptions handled more gracefully...
r130 rescue ActiveRecord::RecordNotFound
render_404
Jean-Philippe Lang
association loading in documents/show...
r22 end
Jean-Philippe Lang
Initial commit...
r2 end