mirror of
https://github.com/openSUSE/osem.git
synced 2026-08-13 11:44:02 +00:00
28 lines
1.1 KiB
Ruby
28 lines
1.1 KiB
Ruby
class EventAttachment < ActiveRecord::Base
|
|
belongs_to :event
|
|
scope :public, where(:public => true)
|
|
attr_accessible :public, :attachment, :event_id, :title
|
|
|
|
has_attached_file :attachment, :path => ":rails_root/storage/:rails_env/attachments/:id/:style/:basename.:extension"
|
|
include Rails.application.routes.url_helpers
|
|
|
|
def to_jq_upload
|
|
{
|
|
"name" => read_attribute(:attachment_file_name),
|
|
"size" => read_attribute(:attachment_file_size),
|
|
"title" => read_attribute(:title),
|
|
"public" => read_attribute(:public),
|
|
#"url" => attachment.url(:original),
|
|
"url" => conference_proposal_event_attachment_path(self.event.conference.short_title, self.event_id, self.id),
|
|
"delete_url" => conference_proposal_event_attachment_path(self.event.conference.short_title, self.event_id, self.id),
|
|
"delete_type" => "DELETE"
|
|
}
|
|
|
|
end
|
|
#:path => ":rails_root/public/system/:attachment/:id/:style/:filename",
|
|
# :url => "/system/:attachment/:id/:style/:filename"
|
|
|
|
#has_paper_trail :meta => {:associated_id => :event_id, :associated_type => "Event"}
|
|
|
|
|
|
end
|