Sha256: 83f0c370172b9e2fa2cd26bfa5c1227a6814d5db529ceffd43056eb77c0399ec
Contents?: true
Size: 1004 Bytes
Versions: 2
Compression:
Stored size: 1004 Bytes
Contents
format :html do def pdf? card.respond_to?(:file) && card.file.content_type == "application/pdf" end def default_pdfjs_iframe_args args args[:pdf_url] ||= card.file.url if card.respond_to?(:file) args[:viewer_path] ||= "/mod/pdfjs/web/viewer.html" args[:viewer_path] << "?file=#{args[:pdf_url]}" if args[:pdf_url] end def pdfjs_iframe args default_pdfjs_iframe_args args <<-HTML <iframe style="width: 100%" id="source-preview-iframe" class="pdfjs-iframe" src="#{args[:viewer_path]}" security="restricted" sandbox="allow-same-origin allow-scripts allow-forms allow-modals allow-top-navigation" allowfullscreen> </iframe> HTML end view :pdf_preview do wrap_with :div, id: "pdf-preview" do pdfjs_iframe pdf_url: card.file_url end end view :pdfjs_viewer do # TODO: show pdfjs viewer directly without iframe # Pdfjs.viewer end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
card-mod-pdfjs-0.2 | set/abstract/pdfjs.rb |
card-mod-pdfjs-0.1 | set/abstract/pdfjs.rb |