Add preview pdf for accessibilty.
This commit is contained in:
parent
c6e54e202a
commit
faf8d57a31
|
@ -195,7 +195,7 @@ class ArchivesController < ApplicationController
|
||||||
@path = file.file.file.file rescue ""
|
@path = file.file.file.file rescue ""
|
||||||
@filename = @path.split("/").last
|
@filename = @path.split("/").last
|
||||||
@ext = @path.split("/").last.to_s.split(".").last
|
@ext = @path.split("/").last.to_s.split(".").last
|
||||||
if @ext == "png" || @ext == "jpg" || @ext == "bmp"
|
if @ext == "png" || @ext == "jpg" || @ext == "bmp" || @ext == "pdf"
|
||||||
render "download_file",:layout=>false
|
render "download_file",:layout=>false
|
||||||
else
|
else
|
||||||
send_file(@path)
|
send_file(@path)
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
<html lang="<%= I18n.locale.to_s%>">
|
<html lang="<%= I18n.locale.to_s%>" style="margin: 0em; padding: 0em; width: 100%; height: 100%; overflow: hidden; background-color: rgb(230, 230, 230);">
|
||||||
<head>
|
<head>
|
||||||
<meta name="viewport" content="width=device-width, minimum-scale=0.1">
|
<meta name="viewport" content="width=device-width, minimum-scale=0.1">
|
||||||
<title><%=@filename%></title>
|
<title><%=@filename%></title>
|
||||||
|
@ -6,6 +6,13 @@
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<h3 style="display: none;"><%=@filename%></h3>
|
<h3 style="display: none;"><%=@filename%></h3>
|
||||||
|
<% if @ext != "png" && @ext != "jpg" && @ext != "bmp" %>
|
||||||
|
<object data="<%=@url%>" height="100%" type="application/<%=@ext%>" width="100%">
|
||||||
|
<iframe height="100%" src="<%=@url%>" title="<%=@filename%>" width="100%"></iframe>
|
||||||
|
</object>
|
||||||
|
<embed height="100%" src="<%=@url%>" title="<%=@filename%>" width="100%" type="application/pdf"></embed>
|
||||||
|
<% else %>
|
||||||
<img alt="<%=@filename%>" src="<%=@url%>">
|
<img alt="<%=@filename%>" src="<%=@url%>">
|
||||||
|
<% end %>
|
||||||
</body>
|
</body>
|
||||||
</html>>
|
</html>
|
Loading…
Reference in New Issue