attachments

This commit is contained in:
Andreas Stephanides
2015-05-13 11:21:08 +02:00
parent c7aec6bb9b
commit 759d3f8916
2 changed files with 16 additions and 8 deletions

View File

@@ -21,22 +21,18 @@ end
def store_dir
"uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}"
end
def cover
def get_cover
manipulate! do |frame, index|
index== 0 ? frame.convert(:jpg) : nil
frame if index.zero?
end
end
version :thumb ,:if=>:image? do
process :resize_to_fill => [64, 64]
end
version :cover , :if=>:pdf? do
process :cover
process :resize_to_fit => [64,64]
process :get_cover
process :convert => :jpg
process :resize_to_fit => [64,64]
def full_filename(for_file)
super.chomp(File.extname(super)) + '.jpg'
end

View File

@@ -16,6 +16,8 @@
</li>
<li><%= link_to "Neues Meeting", new_meeting_path(:parent_id=>small.id, :parent_type=>"Thema"), :remote=>true %>
</li>
<li><a href="#" onclick="$('#attachmentdialog_thema_<%= small.id %>').dialog('open')">Attachments</a>
</li>
</ul>
</div></div>
</span>
@@ -92,3 +94,13 @@
Error
<% end %>
</div>
<div id="attachmentdialog_thema_<%= small.id %>">
<%= render_attachments_for(small) %>
</div>
<script>
$(function() {
$( "#attachmentdialog_thema_<%= small.id %>" ).dialog({autoOpen:false});
});
</script>