-
Notifications
You must be signed in to change notification settings - Fork 9
Manual Installation
Based on your application needs, you may want to include only some of the views provided by this plugin. This can help limit the number of assets included in your application. If you don't care and want everything this plugin provides, follow the installation instructions in the README.
Instructions here are based on the 4.x and 5.x releases of this plugin, and would take the place of running the blacklight_gallery:install generator.
Using the gallery view does not require any additional javascript. Add the following configuration to your Blacklight config:
config.view.gallery(document_component: Blacklight::Gallery::DocumentComponent, icon: Blacklight::Gallery::Icons::GalleryComponent)Copy the _gallery.scss file from the gem into your app/assets/stylesheets directory, and import it in your stylesheet entrypoint file.
Using the masonry view requires adding jQuery and the masonry JS from the plugin. First, add the following configuration to the Blacklight config:
config.view.masonry(document_component: Blacklight::Gallery::DocumentComponent, icon: Blacklight::Gallery::Icons::MasonryComponent)Copy the _masonry.scss file from the gem into your app/assets/stylesheets directory, and import it in your stylesheet entrypoint.
If using Sprockets, append this to your manifest.js:
//= link blacklight_gallery/manifest.jsAnd this to your application.js (after require blacklight/blacklight):
//= require blacklight_gallery/blacklight-galleryIf using Importmaps, include jQuery as a pin in your importmap.rb:
pin "jquery", to: "https://code.jquery.com/jquery-3.7.1.min.js"Import the required modules in your application.js:
import 'jquery'
import 'blacklight-gallery'You might as well use the blacklight_gallery:install generator.
Copy the _slideshow.scss file from the gem into your app/assets/stylesheets directory, and import it in your stylesheet entrypoint.
If you want to remove the other views, you can simply remove the lines that are added to your Blacklight configuration that are mentioned above for the other views.