Sha256: 902d54a1db3ab484372b4380e7a5cd824e3393fda9f7c4a240cba9caa2468e46

Contents?: true

Size: 1.42 KB

Versions: 15

Compression:

Stored size: 1.42 KB

Contents

<%
  # formstrap/shared/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 "formstrap/shared/thumbnail", file: file %#>
  #
  #   Custom size (200px x 100px)
  #   <%= render "formstrap/shared/thumbnail", file: file, width: 200, height: 100 %#>
  #
  #   Custom (bootstrap) icon
  #   <%= render "formstrap/shared/thumbnail", file: file, icon: "file-earmark-excel" %#>
  thumbnail = Formstrap::ThumbnailView.new(local_assigns)
%>

<div class="<%= thumbnail.class_names %>">
  <div class="formstrap-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)) %>
    <% elsif thumbnail.svg? %>
      <%= thumbnail.inline_svg(width: thumbnail.width || 100, height: thumbnail.height || 100) %>
    <% else %>
      <%= bootstrap_icon(thumbnail.icon_name, class: "formstrap-thumbnail-icon") %>
    <% end %>
  </div>
</div>

Version data entries

15 entries across 15 versions & 1 rubygems

Version Path
formstrap-0.4.8 app/views/formstrap/shared/_thumbnail.html.erb
formstrap-0.4.7 app/views/formstrap/shared/_thumbnail.html.erb
formstrap-0.4.6 app/views/formstrap/shared/_thumbnail.html.erb
formstrap-0.4.5 app/views/formstrap/shared/_thumbnail.html.erb
formstrap-0.4.4 app/views/formstrap/shared/_thumbnail.html.erb
formstrap-0.4.3 app/views/formstrap/shared/_thumbnail.html.erb
formstrap-0.4.2 app/views/formstrap/shared/_thumbnail.html.erb
formstrap-0.3.5 app/views/formstrap/shared/_thumbnail.html.erb
formstrap-0.3.4 app/views/formstrap/shared/_thumbnail.html.erb
formstrap-0.3.3 app/views/formstrap/shared/_thumbnail.html.erb
formstrap-0.3.2 app/views/formstrap/shared/_thumbnail.html.erb
formstrap-0.3.1 app/views/formstrap/shared/_thumbnail.html.erb
formstrap-0.3.0 app/views/formstrap/shared/_thumbnail.html.erb
formstrap-0.2.1 app/views/formstrap/shared/_thumbnail.html.erb
formstrap-0.2.0 app/views/formstrap/shared/_thumbnail.html.erb