mirror of
https://github.com/manyfold3d/manyfold.git
synced 2026-10-23 04:02:19 -05:00
Presumably some sort of naming conflict. Fixed by using the actual object type.
53 lines
2.7 KiB
ERB
53 lines
2.7 KiB
ERB
<div class="col mb-4">
|
|
<div class="card preview-card">
|
|
<% if file = @model.preview_file %>
|
|
<% if file.is_image? %>
|
|
<%= content_tag :div, nil, class: "card-img-top card-img-top-background", style: "background-image: url(#{library_model_model_file_path(@model.library, @model, file, format: file.extension)})" %>
|
|
<%= image_tag library_model_model_file_path(@model.library, @model, file, format: file.extension), class: "card-img-top image-preview ", alt: file.name %>
|
|
<% elsif helpers.renderable?(file.extension) %>
|
|
<div class="card-img-top">
|
|
<%= render partial: "object_preview", locals: {library: @model.library, model: @model, file: file} %>
|
|
</div>
|
|
<% end %>
|
|
<% else %>
|
|
<div class='preview-empty'> <p>no preview availiable</p></div>
|
|
<% end %>
|
|
<div class="card-body">
|
|
<div class="row ">
|
|
<div class="col">
|
|
<h5 class="card-title">
|
|
<a data-field="model[name]" data-path="<%= library_model_path(@model.library, @model) %>" contenteditable=true>
|
|
<%= @model.name %>
|
|
</a>
|
|
<span style="float: right"><%= helpers.status_badges(@model) %></span>
|
|
</h5>
|
|
<div class='mt-2'>
|
|
<%= link_to t("models.open"), [@model.library, @model], {class: "btn btn-primary btn-sm"} %>
|
|
<%= link_to t("models.edit"), edit_library_model_path(@model.library, @model), {class: "btn btn-outline-secondary btn-sm"} %>
|
|
<%= link_to t("models.delete"), library_model_path(@model.library, @model), {method: :delete, class: "btn btn-outline-danger btn-sm", data: {confirm: t("models.destroy.confirm")}} %>
|
|
</div>
|
|
</div>
|
|
<div class="col-auto">
|
|
<small>
|
|
<% if @creator.nil? && @model.creator %>
|
|
<%= helpers.icon "person", Creator.model_name.human %>
|
|
<%= link_to @model.creator.name, models_path((@filters || {}).merge(creator: @model.creator)) %><br>
|
|
<% end %>
|
|
<% if @model.collection %>
|
|
<%= helpers.icon "collection", @model.collection.model_name.human %>
|
|
<%= link_to @model.collection.name, models_path((@filters || {}).merge(collection: @model.collection.id)) %><br>
|
|
<% end %>
|
|
<% if @library.nil? && @model.library %>
|
|
<%= helpers.icon "boxes", Library.model_name.human %>
|
|
<%= link_to @model.library.name, models_path((@filters || {}).merge(library: @model.library)) %><br>
|
|
<% end %>
|
|
<% if @model.caption %>
|
|
<p class="card-text"><%= sanitize @model.caption %></p>
|
|
<% end %>
|
|
</small>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|