Class: Onebox::Engine::SteamStoreWidgetOnebox

Inherits:
Object
  • Object
show all
Includes:
Onebox::Engine
Defined in:
lib/onebox/engine/steam_store_widget_onebox.rb

Constant Summary

Constants included from Onebox::Engine

DEFAULT

Instance Attribute Summary

Attributes included from Onebox::Engine

#cache, #timeout, #uri, #url

Instance Method Summary collapse

Methods included from Onebox::Engine

engines, included, #initialize, #options, #options=

Instance Method Details

#placeholder_htmlObject

Placeholder is called at each interaction with editor, so do something less iframey



19
20
21
22
23
24
25
# File 'lib/onebox/engine/steam_store_widget_onebox.rb', line 19

def placeholder_html        
  widget_url = @url.gsub('/app/','/widget/')
  widget_url = widget_url.gsub('http:','https:')
  "<div style='width:100%; height:190px; display:block; background-color:black; color:white;'><div style='padding:10px;'><h2>Steam Store Widget onebox preview for: #{widget_url}</h2><p>Will be replaced with the real listing when posted.</p></div></div>"
rescue
  @url
end

#to_htmlObject

DoTheSimplestThingThatCouldPossiblyWork



9
10
11
12
13
14
15
16
# File 'lib/onebox/engine/steam_store_widget_onebox.rb', line 9

def to_html
  # Use the Steam support iframe widget over https
  widget_url = @url.gsub('/app/','/widget/')
  widget_url = widget_url.gsub('http:','https:')
  "<iframe class='steamstorewidget' src='#{widget_url}' frameborder='0' width='100%' height='190'></iframe>"
rescue
  @url
end