Forum: Typo How to view associated resources/attachments

Posted by Tim Prentis (tprentis)
on 2008-07-30 20:11
My environment is Rails 2.0.2, TYPO 5.1.1. running at RailsPlayground
using the Victor Persson's Dirtylicious theme

Can someone steer me in the correct direction?  I can upload
files/attachments and see them in the admin "manage uploads" feature.

I can also associate uploads with articles when I edit articles(i.e.
posts).

The problem: I cannot figure out how to make these 'uploads' visible as
attachments with the articles(i.e. posts) by simply using the TYPO
administration features.

Do I need to modify the default layout or one of the views?  Any ideas
are greatly appreciated.
Posted by Tim Prentis (tprentis)
on 2008-07-31 22:15
Tim Prentis wrote:
> My environment is Rails 2.0.2, TYPO 5.1.1. running at RailsPlayground
> using the Victor Persson's Dirtylicious theme
> 
> Can someone steer me in the correct direction?  I can upload
> files/attachments and see them in the admin "manage uploads" feature.
> 
> I can also associate uploads with articles when I edit articles(i.e.
> posts).
> 
> The problem: I cannot figure out how to make these 'uploads' visible as
> attachments with the articles(i.e. posts) by simply using the TYPO
> administration features.
> 
> Do I need to modify the default layout or one of the views?  Any ideas
> are greatly appreciated.

I think I found a solution.  This is what I inserted into the partial 
_article.html.erb under my chosen theme 'Dirtylicious'

<div class="author">
    Posted by <cite><%= author_link(article) %></cite>
    <abbr class="published" title="<%= article.published_at.xmlschema 
%>"><%= js_distance_of_time_in_words_to_now article.published_at 
%></abbr>
+    <p></p>
+    <% if Resource.count(:conditions => "article_id = #{article.id}") > 
0 %>
+    Attachments:<br />
+      <% Resource.find(:all, :conditions => "article_id = 
#{article.id}").each do |r| %>
+        &nbsp;&nbsp;&nbsp;&nbsp<%= link_to r.filename, 
this_blog.base_url + "/files/" + r.filename %><br />
    <% end %>
  <% end %>
  </div>

Anybody have any better ideas?

Tim
Posted by de Villamil Frédéric (Guest)
on 2008-08-06 21:49
(Received via mailing list)
Le 30 juil. 08 à 20:11, Tim Prentis a écrit :

> as
> attachments with the articles(i.e. posts) by simply using the TYPO
> administration features.
>
> Do I need to modify the default layout or one of the views?  Any ideas
> are greatly appreciated.
>

Hello,

first, sorry for not replying faster, I was in holliday and got
internet access only tonight. Trying to answer the pile of mails
that's waiting for me.

The way attachments was designed on Typo has always been a mistery to
me, and I didn't want to break it – yet – because it actually had a
purpose.

– uploading via admin/content/new attaches files to the post, but they
will only be displayed in the rss / atom feed. This is intended to be
used for podcasts.
– uploading via admin/resources/new does not attach files to a post.
To you them, you need to c/p the attachment url and do a link /
object / whatever. Pictures uploaded this way can be found with the
images management button of the FCKEditor.

To display articles from your theme, do in your theme somthing like :

@article.ressources.each |foo| do
  link_to foo.filename, "#{this_blog.default_url}/#{foo.filename}"
end

Cheers,
Frédéric

--
Frédéric de Villamil
frederic@de-villamil.com                        tel: +33 (0)6 62 19 1337
http://fredericdevillamil.com             Typo : http://typosphere.org
Please log in before posting. Registration is free and takes only a minute.
Existing account (Switch to SSL-encrypted connection)
NEW: Do you have a Google/GoogleMail or Yahoo account? No registration required!
Log in with Google account | Log in with Yahoo account
No account? Register here.