Class: Vizcore::Server::GalleryPage
- Inherits:
-
Object
- Object
- Vizcore::Server::GalleryPage
- Defined in:
- lib/vizcore/server/gallery_page.rb
Overview
Renders the browser HTML for the bundled example gallery.
Instance Method Summary collapse
-
#initialize(entries:, poster_path:) ⇒ GalleryPage
constructor
A new instance of GalleryPage.
- #render ⇒ String
Constructor Details
#initialize(entries:, poster_path:) ⇒ GalleryPage
Returns a new instance of GalleryPage.
11 12 13 14 |
# File 'lib/vizcore/server/gallery_page.rb', line 11 def initialize(entries:, poster_path:) @entries = entries @poster_path = poster_path end |
Instance Method Details
#render ⇒ String
17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 |
# File 'lib/vizcore/server/gallery_page.rb', line 17 def render cards = @entries.map { |entry| render_card(entry) }.join <<~HTML <!doctype html> <html lang="en"> <head> <meta charset="utf-8"> <meta name="viewport" content="width=device-width, initial-scale=1"> <title>Vizcore Example Gallery</title> <style>#{css}</style> </head> <body> <main> <header class="header"> <img src="#{@poster_path}" alt="" class="poster"> <div> <p class="eyebrow">Vizcore Examples</p> <h1>Example Gallery</h1> <p class="lede">Bundled scenes with scene counts, layer counts, audio-source hints, and launch commands.</p> </div> </header> <section class="grid" aria-label="Example scenes"> #{cards} </section> </main> </body> </html> HTML end |