Skip to content
Steve Taylor edited this page Jul 1, 2024 · 3 revisions

Add your theme to Spotlight

  1. Name your theme (e.g., 'nothumb').

  2. Create an image of your theme called {name}_preview.png and add it to app/assets/images/spotlight/themes (e.g., nothumb_preview.png)

  3. Edit application.css so that it doesn't have the call to include the tree or it will include itself in your theme's call. You have to individually call all of the necessary files:

 /*= require blacklight_gallery.css.scss
 *= require blacklight_oembed.css.scss
 *= require blacklight.scss
 *= require openseadragon.css
 *= require spotlight.scss
 */
  1. Create your CSS file called application_{name}.css and place it in app/assets/stylesheets

  2. Add a precompile call for your CSS file in config/initializers/assets.rb:

    Rails.application.config.assets.precompile += %w( application_nothumb.css )

  3. Add your theme name to config/initializers/spotlight_initializer.rb:

    Spotlight::Engine.config.exhibit_themes = %w[nothumb default]

Adding custom exhibit specific theme logic

The method above makes the configured themes available to all exhibits. If you would like to create your own exhibit specific theme availability logic, you can set provide code to do that as a Proc set as the Spotlight::Exhibit.themes_selector. This Proc will receive the exhibit instance so any data about the exhibit can be used to determine the list of themes that should be available.

Spotlight::Exhibit.themes_selector = ->(exhibit) do
  if exhibit.slug == 'exhibit-that-gets-custom-theme'
    %[default customTheme]
  else
    %[default]
  end
end