I'm a novice RoRr and I'm building my company's website on RefineryCMS.
I've properly created an engine for my Boss' publications, within which I included a pdf:resource column and have uploaded all the articles to my backend. Everything works - renders properly and downloads work.
HOWEVER, I also want to be able to view those pdf's as a _blank target through a link_to on the article.title. SEE CODE BELOW !!!XXXXXXXXX_path , or any useable variation, is what I'm looking for!!!
The important thing is that the corresponding PDF is being rendered. That is, I know I can't manually code individual links while using the [.each do] loop.
I'm sure there is a way to get this done but, as I said, I'm a novice and could use some help.
here's the code:
<section id="body_content">
<section id="body">
<section id=articles>
<% @articles.each do |article| %>
<div class=wrapper>
<div class=particle>
<h1><%= link_to article.title, **(XXXXXXXXXXXXXXX.pdf)**, :target => '_blank' %></h1>
<p><span class=publisher><%= article.publication %></span>,
<span class=year><%= article.year %></span>
</p>
<% if article.pdf.present? %>
<%= link_to image_tag("/assets/pdf.png", :size => "30x30"), article.pdf.url, :title => "PDF download", :class => "pdflink" %>
<% else %>
pdf
<% end %>
</div>
<% end %>
</div>
</section>
</section>
Any help is much appreciated.
*SIDE NOTE: my next task is to add a link to email the article (as an attachment) to a third party. Again, I'd imagine there's something in ActionMailer that can help with this but any help before I get started would be great.
much obliged.