mirror of
https://github.com/manyfold3d/manyfold.git
synced 2026-10-23 12:12:21 -05:00
39 lines
2.0 KiB
ERB
39 lines
2.0 KiB
ERB
<div class="col mb-4">
|
|
<div class="card preview-card <%= (file === @model.preview_file) ? "border-primary" : "" %>">
|
|
<% if file.is_image? %>
|
|
<%= content_tag :div, nil, class: "card-img-top card-img-top-background", style: "background-image: url(#{model_model_file_path(@model, file, format: file.extension)})" %>
|
|
<%= image_tag model_model_file_path(@model, file, format: file.extension), class: "card-img-top image-preview", alt: file.name %>
|
|
<% elsif renderable?(file.extension) %>
|
|
<div class="card-img-top">
|
|
<%= render partial: "object_preview", locals: {model: @model, file: file} %>
|
|
</div>
|
|
<% end %>
|
|
<div class="card-body">
|
|
<div class="card-title">
|
|
<%= file.name %>
|
|
</div>
|
|
<% if file.caption %>
|
|
<p class="card-text"><%= sanitize file.caption %></p>
|
|
<% end %>
|
|
<div class="row">
|
|
<div class="col">
|
|
<%= link_to t(".open_button.text"), model_model_file_path(@model, file), {class: "btn btn-primary", "aria-label": translate(".open_button.label", name: file.name)} %>
|
|
<%= link_to icon("cloud-download", t("general.download")), model_model_file_path(@model, file, file.extension.to_sym), {class: "btn btn-outline-secondary"} %>
|
|
<% if policy(@model).edit? %>
|
|
<%= form_with model: @model, class: "d-inline" do |form| %>
|
|
<%= form.hidden_field :preview_file_id, value: file.id %>
|
|
<%= form.button icon("image", t(".set_as_preview")), data_bs_toggle: "button", class: "btn #{(file == @model.preview_file) ? "btn-outline-success active disabled" : "btn-outline-secondary"}" %>
|
|
<% end %>
|
|
<% end %>
|
|
</div>
|
|
<div class="col col-auto">
|
|
<% if file.presupported || file.presupported_version %>
|
|
<%= icon "bar-chart-line-fill", ModelFile.human_attribute_name(:presupported) %>
|
|
<% end %>
|
|
<%= problem_icon_tag(file.problems) if policy(Problem).show? %>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|