Commit 46cba55fce99779fd5dc4a72806da5495500186d
1 parent
f0218b1c
Exists in
master
and in
22 other branches
ActionItem24: adding attachment_fu stuff
git-svn-id: https://svn.colivre.coop.br/svn/noosfero/trunk@1134 3f533792-8f58-4932-b0fe-aaf55b0a4547
Showing
3 changed files
with
35 additions
and
0 deletions
Show diff stats
db/migrate/007_create_articles.rb
| ... | ... | @@ -26,6 +26,20 @@ class CreateArticles < ActiveRecord::Migration |
| 26 | 26 | |
| 27 | 27 | # single-table inheritance |
| 28 | 28 | t.column :type, :string |
| 29 | + | |
| 30 | + # attachment_fu data for all uploaded files | |
| 31 | + t.column :size, :integer # file size in bytes | |
| 32 | + t.column :content_type, :string # mime type, ex: application/mp3 | |
| 33 | + t.column :filename, :string # sanitized filename | |
| 34 | + | |
| 35 | + # attachment_fu data for images | |
| 36 | + t.column :height, :integer # in pixels | |
| 37 | + t.column :width, :integer # in pixels | |
| 38 | + | |
| 39 | + # attachment_fu data for thumbnails | |
| 40 | + t.column :parent_id, :integer # id of parent image (on the same table, a self-referencing foreign-key). | |
| 41 | + t.column :thumbnail, :string # the 'type' of thumbnail this attachment record describes. | |
| 42 | + | |
| 29 | 43 | end |
| 30 | 44 | |
| 31 | 45 | Article.create_versioned_table | ... | ... |
| ... | ... | @@ -0,0 +1,11 @@ |
| 1 | +require File.dirname(__FILE__) + '/../test_helper' | |
| 2 | + | |
| 3 | +class UploadedFileTest < Test::Unit::TestCase | |
| 4 | + | |
| 5 | + should 'return a thumbnail as icon' do | |
| 6 | + f = UploadedFile.new | |
| 7 | + f.expects(:public_filename).with(:icon).returns('/path/to/file.xyz') | |
| 8 | + assert_equal '/path/to/file.xyz', f.icon_name | |
| 9 | + end | |
| 10 | + | |
| 11 | +end | ... | ... |