Add screenshot width attr only when it's available

private-asciicasts
Marcin Kulik 10 years ago
parent 7a321bf2cc
commit 43b6cb5b51

@ -58,7 +58,8 @@ class AsciicastPagePresenter
def embed_html_link(routes)
img_src = routes.asciicast_url(asciicast, format: :png)
url = routes.asciicast_url(asciicast)
%(<a href="#{url}"><img src="#{img_src}" width="#{asciicast.image_width}" /></a>)
width = %{width="#{asciicast.image_width}"} if asciicast.image_width
%(<a href="#{url}"><img src="#{img_src}" #{width}/></a>)
end
def embed_markdown_link(routes)

Loading…
Cancel
Save