class Hyrax::IiifAv::AddToWorkTypeGenerator

Public Instance Methods

inject_into_controller() click to toggle source
# File lib/generators/hyrax/iiif_av/add_to_work_type_generator.rb, line 14
def inject_into_controller
  controller_file = File.join('app/controllers/hyrax', class_path, "#{plural_file_name}_controller.rb")
  insert_into_file controller_file, after: 'include Hyrax::BreadcrumbsForWorks' do
    "\n" \
    "    # Adds behaviors for hyrax-iiif_av plugin.\n" \
    "    include Hyrax::IiifAv::ControllerBehavior"
  end
end
inject_into_presenter() click to toggle source
# File lib/generators/hyrax/iiif_av/add_to_work_type_generator.rb, line 23
def inject_into_presenter
  presenter_file = File.join('app/presenters/hyrax', class_path, "#{file_name}_presenter.rb")
  insert_into_file presenter_file, after: '< Hyrax::WorkShowPresenter' do
    "\n" \
    "    # Adds behaviors for hyrax-iiif_av plugin.\n" \
    "    include Hyrax::IiifAv::DisplaysIiifAv\n" \
    "    Hyrax::MemberPresenterFactory.file_presenter_class = Hyrax::IiifAv::IiifFileSetPresenter\n" \
    "\n" \
    "    # Optional override to select iiif viewer to render\n" \
    "    # default :avalon for audio and video, :universal_viewer for images\n" \
    "    # def iiif_viewer\n" \
    "    #   :avalon\n" \
    "    # end"
  end
end