Permalink
Browse files

Use preview helper also for table previews.

  • Loading branch information...
1 parent 26c22d0 commit 8a25a5cd7e4aab729d43ccebffa927a6dff1015e Francesc Esplugas committed Feb 13, 2010
@@ -181,10 +181,12 @@ def typus_table_file_field(attribute, item, link_options = {})
file_preview_is_image = item.send("#{attachment}_content_type") =~ /^image\/.+/
content = if has_file_preview && file_preview_is_image
- render "admin/helpers/preview_on_table",
+ render "admin/helpers/preview",
:attribute => attribute,
:attachment => attachment,
- :file_preview => file_preview,
+ :content => item.send(attribute),
+ :has_file_preview => has_file_preview,
+ :href => item.send(attachment).url(file_preview),
:item => item
else
link_to item.send(attribute), item.send(attachment).url
@@ -4,7 +4,9 @@
<% if has_file_preview %>
<script type="text/javascript" charset="utf-8">
- $(document).ready(function() { $("#<%= dom %>").fancybox(); });
+ $(document).ready(function() {
+ $("#<%= dom %>").fancybox();
+ });
</script>
<% end %>
@@ -1,13 +0,0 @@
-<%
- dom = item.to_dom(:suffix => "#{attribute}_preview" )
-%>
-
-<script type="text/javascript" charset="utf-8">
- $(document).ready(function() {
- $("#<%= dom %>").fancybox();
- });
-</script>
-
-<a id="<%= dom %>"
- href="<%= item.send(attachment).url(file_preview) %>"
- title="<%= item.to_label %>"><%= item.send(attribute) %></a>

0 comments on commit 8a25a5c

Please sign in to comment.