Sha256: 92a0220781e6aec63aa19e1bc45b15ef3c995659f485cc72764e3ad5f44f8eb5
Contents?: true
Size: 1.14 KB
Versions: 36
Compression:
Stored size: 1.14 KB
Contents
class CollectionBrandingInfo < ApplicationRecord # i = ColectionImageInfo.new() def initialize(collection_id:, filename:, role:, alt_txt: "", target_url: "") super() self.collection_id = collection_id self.role = role self.alt_text = alt_txt self.target_url = target_url self.local_path = find_local_filename(collection_id, role, filename) end def save(file_location, copy_file = true) local_dir = find_local_dir_name(collection_id, role) FileUtils.mkdir_p local_dir FileUtils.cp file_location, local_path unless file_location == local_path || !copy_file FileUtils.remove_file(file_location) if File.exist?(file_location) && copy_file super() end def delete(location_path) FileUtils.remove_file(location_path) if File.exist?(location_path) end def find_local_filename(collection_id, role, filename) local_dir = find_local_dir_name(collection_id, role) File.join(local_dir, filename) end def find_local_dir_name(collection_id, role) File.join(Hyrax.config.branding_path, collection_id.to_s, role.to_s) end end
Version data entries
36 entries across 36 versions & 1 rubygems