mirror of
https://github.com/manyfold3d/manyfold.git
synced 2026-10-23 12:12:21 -05:00
64 lines
3.3 KiB
ERB
64 lines
3.3 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(#{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 helpers.renderable?(file.extension) %>
|
|
<div class="card-img-top">
|
|
<%= render partial: "object_preview", locals: {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">
|
|
<div class="card-title">
|
|
<a data-field="model[name]" data-path="<%= model_path @model %>" contenteditable=true>
|
|
<%= @model.name %>
|
|
</a>
|
|
<span style="float: right"><%= helpers.status_badges(@model) %></span>
|
|
</div>
|
|
<div class='mt-2'>
|
|
<%= link_to t(".open_button.text"), @model, {class: "btn btn-primary btn-sm", "aria-label": translate(".open_button.label", name: @model.name)} %>
|
|
<%= link_to helpers.icon("pencil-fill", t(".edit_button.text")), edit_model_path(@model), {class: "btn btn-outline-secondary btn-sm", "aria-label": translate(".edit_button.label", name: @model.name)} if @can_edit %>
|
|
<%= link_to helpers.icon("trash", t(".delete_button.text")), model_path(@model), {method: :delete, class: "btn btn-outline-danger btn-sm", "aria-label": translate(".delete_button.label", name: @model.name), data: {confirm: translate("models.destroy.confirm")}} if @can_destroy %>
|
|
</div>
|
|
</div>
|
|
<div class="col-auto">
|
|
<small>
|
|
<ul class="list-unstyled">
|
|
<% if @creator.nil? && @model.creator %>
|
|
<li>
|
|
<%= helpers.icon "person", Creator.model_name.human %>
|
|
<%= link_to @model.creator.name, models_path((@filters || {}).merge(creator: @model.creator)),
|
|
"aria-label": [Creator.model_name.human, @model.creator.name].join(": ") %>
|
|
</li>
|
|
<% end %>
|
|
<% if @model.collection %>
|
|
<li>
|
|
<%= helpers.icon "collection", @model.collection.model_name.human %>
|
|
<%= link_to @model.collection.name, models_path((@filters || {}).merge(collection: @model.collection)),
|
|
"aria-label": [@model.collection.model_name.human, @model.collection.name].join(": ") %>
|
|
</li>
|
|
<% end %>
|
|
<% if @library.nil? && @model.library %>
|
|
<li>
|
|
<%= helpers.icon "boxes", Library.model_name.human %>
|
|
<%= link_to @model.library.name, models_path((@filters || {}).merge(library: @model.library)),
|
|
"aria-label": [Library.model_name.human, @model.library.name].join(": ") %>
|
|
</li>
|
|
<% end %>
|
|
</ul>
|
|
<% if @model.caption %>
|
|
<p class="card-text"><%= sanitize @model.caption %></p>
|
|
<% end %>
|
|
</small>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|