Sha256: ec9fa508fca01386b659d3ab7505d485d068fdbe8cb50c34d7746897216ecf86

Contents?: true

Size: 1.24 KB

Versions: 10

Compression:

Stored size: 1.24 KB

Contents

<%
  # headmin/thumbnail
  #
  # ==== Required parameters
  # * +file+ - Name of the attribute of the form model
  #
  # ==== Optional parameters
  # * +width+ - Width of the thumbnail. Set to nil to fill according to the original aspect ratio
  # * +height+ - Height of the thumbnail. Set to nil to fill according to the original aspect ratio
  # * +icon+ - Force icon to be shown instead of a thumbnail
  #
  # ==== References
  # https://headmin.dev/docs/thumbnail
  #
  # ==== Examples
  #   Basic version
  #   <%= render "headmin/thumbnail", file: file %#>
  #
  #   Custom size (200px x 100px)
  #   <%= render "headmin/thumbnail", file: file, width: 200, height: 100 %#>
  #
  #   Custom (bootstrap) icon
  #   <%= render "headmin/thumbnail", file: file, icon: "file-earmark-excel" %#>
  thumbnail = Headmin::ThumbnailView.new(local_assigns)
%>

<div class="<%= thumbnail.class_names %>">
  <div class="h-thumbnail-bg" style="min-width: <%= thumbnail.width || 100 %>px; min-height: <%= thumbnail.height || 100 %>px;">
    <% if thumbnail.variable? && !thumbnail.icon? %>
      <%= image_tag(thumbnail.file.variant(thumbnail.variant_options)) %>
    <% else %>
      <%= bootstrap_icon(thumbnail.icon_name, class: "h-thumbnail-icon") %>
    <% end %>
  </div>
</div>

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
headmin-0.6.3 app/views/headmin/_thumbnail.html.erb
headmin-0.6.2 app/views/headmin/_thumbnail.html.erb
headmin-0.6.1 app/views/headmin/_thumbnail.html.erb
headmin-0.6.0 app/views/headmin/_thumbnail.html.erb
headmin-0.5.9 app/views/headmin/_thumbnail.html.erb
headmin-0.5.8 app/views/headmin/_thumbnail.html.erb
headmin-0.5.7 app/views/headmin/_thumbnail.html.erb
headmin-0.5.6 app/views/headmin/_thumbnail.html.erb
headmin-0.5.5 app/views/headmin/_thumbnail.html.erb
headmin-0.5.4 app/views/headmin/_thumbnail.html.erb