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

View File

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