views/mdc/components/image.erb
<% if comp
fit_class = comp.fit ? "v-image--fit-#{comp.fit}" : ''
position = comp.position ? comp.position.map(&:to_s).join(' ') : nil
styles = {
'min-width' => (comp.min_width if comp.min_width),
'width' => (comp.width if comp.width),
'max-width' => (comp.max_width if comp.max_width),
'min-height' => (comp.min_height if comp.min_height),
'height' => (comp.height if comp.height),
'max-height' => (comp.max_height if comp.max_height),
'border' => ("#{comp.border} solid" if comp.border),
'border-color' => (comp.border_color if comp.border_color),
'border-radius' => (comp.border_radius if comp.border_radius),
'object-position' => (position unless position.empty?)
}.compact
%>
<img id="<%= comp.id %>"
class="v-image <%= fit_class %> <%= 'v-actionable' if comp.events %>"
src="<%= comp.url %>"
<% if comp.description %>alt="<%= comp.description %>"<% end %>
style="<%= styles.map { |k, v| "#{k}: #{v}" }.join('; ') %>"
draggable="false"
<%= erb :"components/event", :locals => {comp: comp, events: comp.events, parent_id: comp.event_parent_id} %>>
<%= erb :"components/tooltip" , :locals => {comp: comp.tooltip, parent_id: comp.id} %>
<% end %>