app/views/alchemy/admin/attachments/_attachment.html.erb
<tr class="<%= cycle('even', 'odd') %>">
<td class="icon">
<%= render_icon attachment.icon_css_class, size: "xl" %>
</td>
<td class="name">
<% if can?(:show, attachment) %>
<%= link_to_dialog(
attachment.name,
alchemy.admin_attachment_path(attachment),
{
title: attachment.name,
size: attachment_preview_size(attachment)
},
{
title: Alchemy.t('Attachment Preview')
}
) %>
<% else %>
<%= attachment.name %>
<% end %>
</td>
<td class="file_name"><%= attachment.file_name %></td>
<td class="file_type"><%= mime_to_human(attachment.file_mime_type) %></td>
<td class="file_size"><%= number_to_human_size(attachment.file_size) %></td>
<td class="date"><%= l(attachment.created_at, format: :'alchemy.default') %></td>
<td class="tools long">
<% if can?(:show, attachment) %>
<sl-tooltip content="<%= Alchemy.t('Attachment Preview') %>">
<%= link_to_dialog(
render_icon(:information),
alchemy.admin_attachment_path(attachment),
{
title: attachment.name,
size: attachment_preview_size(attachment)
},
class: "icon_button"
) %>
</sl-tooltip>
<% end %>
<% if can?(:download, attachment) %>
<sl-tooltip content="<%= Alchemy.t("download_file", filename: attachment.file_name) %>">
<%= link_to render_icon(:download),
alchemy.download_admin_attachment_path(attachment),
target: "_blank",
class: "icon_button" %>
</sl-tooltip>
<% end %>
<% if can?(:edit, attachment) %>
<sl-tooltip content="<%= Alchemy.t(:replace_file) %>">
<%= render 'alchemy/admin/attachments/replace_button',
redirect_url: alchemy.admin_attachments_path,
object: attachment,
file_attribute: 'file' %>
</sl-tooltip>
<% end %>
<% if can?(:destroy, attachment) %>
<sl-tooltip content="<%= Alchemy.t(:delete_file) %>">
<%= link_to_confirm_dialog render_icon(:minus),
Alchemy.t(:confirm_to_delete_file),
alchemy.admin_attachment_path(
id: attachment,
q: search_filter_params[:q],
page: params[:page],
per_page: params[:per_page]
),
class: "icon_button" %>
</sl-tooltip>
<% end %>
<% if can?(:edit, attachment) %>
<sl-tooltip content="<%= Alchemy.t(:rename_file) %>">
<%= link_to_dialog render_icon(:edit),
alchemy.edit_admin_attachment_path(attachment, q: search_filter_params[:q], page: params[:page]),
{
title: Alchemy.t(:rename_file),
size: '500x250'
},
class: "icon_button" %>
</sl-tooltip>
<% end %>
</td>
</tr>