views/mdc/components/image.erb in voom-presenters-0.2.0 vs views/mdc/components/image.erb in voom-presenters-2.0.0

- old
+ new

@@ -1,7 +1,25 @@ <% if comp - position_classes = comp.position.map {|p| "v-image-position-#{p}"}.join(' ') %> + 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 <%=position_classes%>" - src="<%= comp.url %>" height="<%= comp.height %>" width="<%= comp.width %>" border="0" alt=""> -<%= erb :"components/tooltip", :locals => {comp: comp.tooltip, parent_id: comp.id} %> -<% end %> \ No newline at end of file + 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 %>