Class: Shugoi::ShieldPage
- Inherits:
-
Object
- Object
- Shugoi::ShieldPage
- Defined in:
- lib/shugoi/shield_page.rb
Defined Under Namespace
Classes: Input
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(input) ⇒ ShieldPage
constructor
A new instance of ShieldPage.
- #render ⇒ Object
Constructor Details
#initialize(input) ⇒ ShieldPage
Returns a new instance of ShieldPage.
9 10 11 12 |
# File 'lib/shugoi/shield_page.rb', line 9 def initialize(input) @input = input @messages = Locales.(input.locale) end |
Class Method Details
Instance Method Details
#render ⇒ Object
14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 |
# File 'lib/shugoi/shield_page.rb', line 14 def render title = escaped(@input.title, :blocked_title) badge = escaped(@input.badge, :blocked_badge) host = Utils.escape_html((@input.host.to_s.empty? ? "shugoi.com" : @input.host).slice(0, 120)) description = Utils.escape_html(description_text) language = @input.locale == "fr" ? "fr" : "en" <<~HTML <!DOCTYPE html> <html lang="#{language}"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width,initial-scale=1"> <style>#{styles}</style> </head> <body> <div id="c"> <img src="https://shugoi.com/favicon.png" alt class="l"> <img src="https://shugoi.com/brand.png" alt class="b"> <div class="bdg">#{badge}</div> <h2>#{title}</h2> <p class="desc">#{description}</p> <p class="ft">#{host} ยท Shugoi</p> </div> </body> </html> HTML end |