Method: Faces::Public.generate_html
- Defined in:
- lib/faces.rb
.generate_html(url, configuration = {}) ⇒ Object
Generates a HTML <img /> tag for the given url
85 86 87 88 89 90 91 92 93 94 95 96 |
# File 'lib/faces.rb', line 85 def generate_html(url, configuration = {}) m_configuration = Faces::Common.merge_configurations([Faces::Configuration::UNIVERSAL, configuration]) combined_classes = m_configuration[:html_provider_classes].present? ? m_configuration[:html_classes] + ' ' + m_configuration[:html_provider_classes] : m_configuration[:html_classes] html = '<img src="' + url + '" class="' + combined_classes + '"' html += " id=\"#{m_configuration[:id]}\"" if m_configuration[:id].present? html += " width=\"#{m_configuration[:width]}\"" if m_configuration[:width].present? html += " height=\"#{m_configuration[:height]}\"" if m_configuration[:height].present? html += " alt=\"#{m_configuration[:alt]}\"" if m_configuration[:alt].present? html += " title=\"#{m_configuration[:title]}\"" if m_configuration[:title].present? html += ' />' end |