mirror of
https://github.com/manyfold3d/manyfold.git
synced 2026-10-22 19:52:18 -05:00
77 lines
4.0 KiB
ERB
77 lines
4.0 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 #{"sensitive" if helpers.needs_hiding?(@model)}", alt: file.name %>
|
|
<% elsif file.is_renderable? %>
|
|
<div class="card-img-top <%= "sensitive" if helpers.needs_hiding?(@model) %>">
|
|
<%= render partial: "object_preview", locals: {model: @model, file: file} %>
|
|
</div>
|
|
<% end %>
|
|
<% elsif @model.remote? %>
|
|
<div class='preview-empty'> <p><%= t(".no_remote_preview") %></p></div>
|
|
<% else %>
|
|
<div class='preview-empty'> <p><%= t(".no_preview") %></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>
|
|
<%= helpers.icon("explicit", Model.human_attribute_name(:sensitive)) if @model.sensitive %>
|
|
<br><%= helpers.server_indicator @model %>
|
|
</div>
|
|
</div>
|
|
<div class="col-auto">
|
|
<small>
|
|
<ul class="list-unstyled">
|
|
<% if @model.creator %>
|
|
<li>
|
|
<%= helpers.icon "person", Creator.model_name.human %>
|
|
<%= link_to @model.creator.name, @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, @model.collection,
|
|
"aria-label": [@model.collection.model_name.human, @model.collection.name].join(": ") %>
|
|
</li>
|
|
<% end %>
|
|
</ul>
|
|
<% if @model.caption %>
|
|
<p class="card-text"><%= sanitize @model.caption %></p>
|
|
<% end %>
|
|
</small>
|
|
</div>
|
|
</div>
|
|
<div class="row">
|
|
<div class="col">
|
|
<% if @model.remote? %>
|
|
<%= link_to safe_join(["⁂", t(".open_button.text")], " "), @model.federails_actor.profile_url, {class: "btn btn-primary btn-sm", "aria-label": translate(".open_button.label", name: @model.name)} %>
|
|
<% else %>
|
|
<%= link_to t(".open_button.text"), @model, {class: "btn btn-primary btn-sm", "aria-label": translate(".open_button.label", name: @model.name)} %>
|
|
<% end %>
|
|
<%= helpers.status_badges(@model) %>
|
|
<div class="float-end">
|
|
<div class="btn-group">
|
|
<a href="#" role="button" data-bs-toggle="dropdown" aria-expanded="false">
|
|
<%= helpers.icon "three-dots-vertical", t("general.menu") %>
|
|
</a>
|
|
<ul class="dropdown-menu dropdown-menu-end">
|
|
<li><%= link_to safe_join([helpers.icon("pencil-fill", t(".edit_button.text")), t(".edit_button.text")], " "), edit_model_path(@model), {class: "dropdown-item", "aria-label": translate(".edit_button.label", name: @model.name)} if @can_edit %></li>
|
|
<li><%= link_to safe_join([helpers.icon("trash", t(".delete_button.label")), t(".delete_button.text")], " "), model_path(@model), {method: :delete, class: "dropdown-item", data: {confirm: translate("models.destroy.confirm")}} if @can_destroy %></li>
|
|
<li><%= link_to safe_join([helpers.icon("flag", t("general.report", type: "")), t("general.report", type: "")], " "), new_model_report_path(@model), class: "dropdown-item" if SiteSettings.multiuser_enabled? %></li>
|
|
</ul>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|