ruby on rails - dynamic way to display locally had PDF's in RoR -


I apologize in advance if this is a simple question, although I am confusing myself and I need some help

Actually there is a script on my site at this point which:

  & lt; script type = "text / javascript" & gt; Function Embed PDF () {var Success = New PDFObject ({url: 'Vol_1.4.pdf', '0'}} Embed ("PDF Renderer"); } window.onload = embedPDF;   

This is great for displaying a PDF, but I would also like to have a page with links to many other PDFs, which I would like to be able to ideally do, that script Is inserted into a method:

  def is the ideal mode (urlName) // Here is the end of the script written   

so that on my page Can link all locally organized PDFs, I can get a normal page Can something like Nk am

  & lt;% = link_to "Volume 1", Pdf_path ,: id = & gt; "Link"%>   

The above method will take you to the heading "Volume 1" and run the script to open the correct volume 1.

Any suggestions would be appreciated! Thanks a lot!

You are mixing javascript code and rail code

First, link Use class instead of ID

    

then add the following JS code

  function embedded PDF (url) {new PDF object ({url: url}). Embed ("PDF Renderer")} $ ('.pdf-link') ('Click', function () {embedPDF (this.href)})    

Comments

Popular posts from this blog

Java - Error: no suitable method found for add(int, java.lang.String) -

java - JPA TypedQuery: Parameter value element did not match expected type -

c++ - static template member variable has internal linkage but is not defined -