Skip to content

Commit 91678b6

Browse files
committed
DO NOT MERGE: very rough iiif example
1 parent 5f36789 commit 91678b6

File tree

2 files changed

+61
-2
lines changed

2 files changed

+61
-2
lines changed

app/views/record/_record.html.erb

Lines changed: 60 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<div id="full-record" class="gridband layout-3q1q wrap-full-record">
2-
<main class="col3q box-content region full-record" data-region="Full record">
2+
<main class="col4q box-content region full-record" data-region="Full record">
33
<h2 class="record-title">
44
<span class="sr">Title: </span>
55
<% if @record['title'].present? %>
@@ -66,10 +66,69 @@
6666
<li>
6767
<%= link_to(link['text'] || 'unknown', link['url']) %>
6868
</li>
69+
<% if link['kind'] == 'IIIF Manifest' %>
70+
Manefest detected!
71+
72+
<% content_for :additional_js do %>
73+
<script
74+
type="application/javascript"
75+
src="https://cdn.jsdelivr.net/npm/[email protected]/dist/umd/UV.js"
76+
></script>
77+
78+
<% end %>
79+
80+
<% content_for :additional_meta_tag do %>
81+
<link
82+
rel="stylesheet"
83+
href="https://cdn.jsdelivr.net/npm/[email protected]/dist/uv.css"
84+
/>
85+
86+
<style>
87+
#uv {
88+
width: 924px;
89+
height: 668px;
90+
}
91+
</style>
92+
<% end %>
93+
94+
<div class="uv" id="uv"></div>
95+
96+
<script>
97+
var urlAdaptor = new UV.IIIFURLAdaptor();
98+
99+
const data = urlAdaptor.getInitialData({
100+
manifest: "<%= link['url'] %>",
101+
embedded: true // needed for codesandbox frame
102+
});
103+
104+
uv = UV.init("uv", data);
105+
urlAdaptor.bindTo(uv);
106+
107+
// override config using an inline json object
108+
uv.on("configure", function ({ config, cb }) {
109+
cb({
110+
options: { footerPanelEnabled: true }
111+
});
112+
});
113+
114+
// this is loading an complete config file for reference
115+
// to increase loading speed, just use the specific settings you require
116+
// uv.on("configure", function ({ config, cb }) {
117+
// cb(
118+
// new Promise(function (resolve) {
119+
// fetch("uv-config.json").then(function (response) {
120+
// resolve(response.json());
121+
// });
122+
// })
123+
// );
124+
// });
125+
</script>
126+
<% end %>
69127
<% end %>
70128
<% end %>
71129
</ul>
72130
131+
73132
<% if @record['summary'].present? %>
74133
<h3 class="section-title">Summary</h3>
75134
<% @record['summary'].each do |paragraph| %>

config/initializers/content_security_policy.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,5 +21,5 @@
2121
# config.content_security_policy_nonce_directives = %w(script-src style-src)
2222
#
2323
# Report violations without enforcing the policy.
24-
# config.content_security_policy_report_only = true
24+
config.content_security_policy_report_only = true
2525
end

0 commit comments

Comments
 (0)