wire up downloading attachments from todo partial

This commit is contained in:
Reinier Balt 2014-07-06 22:29:19 +02:00
parent 2fe0425ce9
commit c49296e843
3 changed files with 9 additions and 2 deletions

View file

@ -819,7 +819,7 @@ class TodosController < ApplicationController
filename = params[:filename]
attachment = current_user.attachments.find(id)
if attachment
if attachment
send_file(attachment.file.path,
disposition: 'attachment',
type: 'message/rfc822')

View file

@ -212,6 +212,14 @@ module TodosHelper
)
end
def attachment_image(todo)
link_to(
image_tag('blank.png', width: 16, height: 16, border:0),
todo.attachments.first.file.url,
{:class => 'todo_attachment', title: 'Get attachments of this todo'}
)
end
def collapsed_notes_image(todo)
link = link_to(
image_tag( 'blank.png', :width=>'16', :height=>'16', :border=>'0' ),

View file

@ -90,7 +90,6 @@ Rails.application.routes.draw do
get 'convert_to_project' # TODO: convert to PUT/POST
delete 'remove_predecessor' # TODO: convert to PUT/POST
post 'change_context'
get 'attachment'
end
collection do
get 'done'