diff --git a/app/views/player/_record.html.erb b/app/views/player/_record.html.erb index bc4cb20..ebd6f20 100644 --- a/app/views/player/_record.html.erb +++ b/app/views/player/_record.html.erb @@ -5,22 +5,6 @@

<%= record.title %>

- <% #record.metadata.marc_record.class %> - <% transcripts = [] %> - <% eight56_fields = record.metadata.marc_record.fields(['856']) %> - <% if eight56_fields.any? %> - <% #eight56_fields.each {|f| f.to_hash } %> - <% eight56_fields.each do |f| %> - <% if f.indicator1 == '4' && f.indicator2 == '2' %> - <% subfields = f.subfields.each_with_object({}) {|sf, hash| hash[sf.code] = sf.value } %> - <% if subfields['u'] && subfields['y'] && subfields['y'].downcase.include?('transcript') %> - <% transcripts << subfields['u'] %> - <% end %> - <% end %> - - <% end %> - <% end %> - <% #byebug %> <% if record.tracks.empty? %>

No track information found.

<% else %> @@ -101,13 +85,30 @@ <% end %> + + <% transcripts = [] %> + <% eight56_fields = record.metadata.marc_record.fields(['856']) %> + <% if eight56_fields.any? %> + <% #eight56_fields.each {|f| f.to_hash } %> + <% eight56_fields.each do |f| %> + <% if f.indicator1 == '4' && f.indicator2 == '2' %> + <% subfields = f.subfields.each_with_object({}) {|sf, hash| hash[sf.code] = sf.value } %> + <% if subfields['u'] && subfields['y'] && subfields['y'].downcase.include?('transcript') %> + <% transcripts << subfields %> + <% end %> + <% end %> + + <% end %> + <% end %> <% if transcripts.any? %>

Transcripts

<% transcripts.each do |transcript| %> - <%= link_to(File.basename(URI.parse(transcript).path), transcript) %> + <%= link_to(transcript['y'], transcript['u']) %> <% end %> + + <% end %> <% end %>