mirror of
https://github.com/TracksApp/tracks.git
synced 2026-02-13 02:44:22 +01:00
wire up downloading attachments from todo partial
This commit is contained in:
parent
4d7c453ca7
commit
6405bf5d1a
5 changed files with 32 additions and 3 deletions
|
|
@ -701,7 +701,6 @@ class TodosController < ApplicationController
|
|||
@tag = Tag.where(:name => @tag_name).first_or_create
|
||||
end
|
||||
|
||||
|
||||
def tags
|
||||
# TODO: limit to current_user
|
||||
tags_beginning = Tag.where('name like ?', params[:term]+'%')
|
||||
|
|
@ -815,6 +814,23 @@ class TodosController < ApplicationController
|
|||
end
|
||||
end
|
||||
|
||||
def attachment
|
||||
id = params[:id]
|
||||
filename = params[:filename]
|
||||
attachment = Attachment.where(id: id).first
|
||||
|
||||
if attachment
|
||||
if attachment.todo.user == current_user
|
||||
send_file(attachment.file.path)
|
||||
else
|
||||
head :forbidden
|
||||
end
|
||||
else
|
||||
head :not_found
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def set_group_view_by
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue