Module: Aspera::WebPage
- Defined in:
- lib/aspera/web_page.rb
Overview
HTML pages of embedded web servers, sharing a layout: style and branding. The ERB template of each page is the content of the card of the layout, with its own variables.
Class Method Summary collapse
-
.render(template_path, title:, **variables) ⇒ String
HTML page.
-
.secure_headers(response, content_security_policy: nil) ⇒ nil
Set the headers of an HTML page: type and security headers.
Class Method Details
.render(template_path, title:, **variables) ⇒ String
Returns HTML page.
60 61 62 63 |
# File 'lib/aspera/web_page.rb', line 60 def render(template_path, title:, **variables) content = Context.new(variables).render(template_path) Context.new(title: title, content: content).render(LAYOUT_PATH) end |
.secure_headers(response, content_security_policy: nil) ⇒ nil
Set the headers of an HTML page: type and security headers
50 51 52 53 54 |
# File 'lib/aspera/web_page.rb', line 50 def secure_headers(response, content_security_policy: nil) HEADERS.each { |name, value| response[name] = value } response['Content-Security-Policy'] = content_security_policy unless content_security_policy.nil? nil end |