-
Notifications
You must be signed in to change notification settings - Fork 0
Feature/pdf viewer #19
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: feature/elasticsearch-chewy
Are you sure you want to change the base?
Conversation
app/controllers/books_controller.rb
Outdated
|
|
||
| def show | ||
| @book = resource | ||
| @adobe_pdf_api_key = ENV["ADOBE_PDF_API_KEY"] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
я не впевнений, що такі штуки тре в контроллері юзати-передавати
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
app/views/books/show.html.erb
Outdated
| <script> | ||
| const previewConfig = { | ||
| showDownloadPDF: false, | ||
| showPrintPDF: false, | ||
| showAnnotationTools: false | ||
| } | ||
|
|
||
| document.addEventListener("adobe_dc_view_sdk.ready", function () { | ||
| var adobeDCView = new AdobeDC.View({ clientId: "<%= @adobe_pdf_api_key %>", divId: "pdf-viewer" }); | ||
| adobeDCView.previewFile({ | ||
| content: { location: { url: "<%= rails_blob_path(@book.content, only_path: true) %>" } }, | ||
| metaData: { fileName: "<%= @book.content.filename %>" }, | ||
| }, previewConfig); | ||
| }); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
стімулус контроллери для кого?))
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| if user.present? && book.content.attached? | ||
| expect(rendered).to include("src=\"https://documentcloud.adobe.com/view-sdk/main.js\"") | ||
| else | ||
| expect(rendered).not_to include("src=\"https://documentcloud.adobe.com/view-sdk/main.js\"") | ||
| end |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
це ще що таке?) то щось не гуд
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added PDF viewer to the Show page with Adobe PDF Embed API.
Add view test.
PDF Viewer on show book page.

No download or print option

Book content only visible for authorised users.
