UVicLibrary / Spotlight2_custom

Apache License 2.0
2 stars 0 forks source link

Support for Video Compound Objects #8

Closed eltiffster closed 5 years ago

eltiffster commented 5 years ago

Want to be able to switch between videos similar to this audio compound object in the WWI exhibit.

Also, there should be a suitable thumbnail on the catalog/admin page.

eltiffster commented 5 years ago

In models/spotlight/resource.rb, I added a method .made_of for compound objects:

    # For compound objects only, check the file_type of the first compound_id
    def made_of
      if self.file_type == "compound object"
        ::SolrDocument.find(self.compound_ids[0]).uploaded_resource.file_type
      else
        nil
      end
    end

In views/catalog/openseadragon_default.html, I rewrote the if condition for audio compound objects to include video compound objects as well. I put the same if condition in views/spotlight/catalog/_admin_av_thumbnail_default.

<% if @resource.file_type == "image" or (@resource.file_type == "compound object" && @resource.made_of == "image") %>

Because the catalog controller requires @docs to be set to render AV compound objects, I added a key-value pair in the appropriate sidecar.data['configured_fields']: :items => resource.compound_ids.