Unify links to download documents in admin tables
We were using a "Download file" link in one place, while in another place we had an additional column where the name of the document was a link to download it.
This commit is contained in:
@@ -13,7 +13,6 @@
|
||||
<th scope="col"><%= t("admin.shared.title") %></th>
|
||||
<th scope="col"><%= t("admin.documents.index.format") %></th>
|
||||
<th scope="col"><%= t("admin.documents.index.size") %></th>
|
||||
<th scope="col"><%= t("admin.documents.index.url") %></th>
|
||||
<th scope="col"><%= t("admin.shared.actions") %></th>
|
||||
</tr>
|
||||
</thead>
|
||||
@@ -23,15 +22,18 @@
|
||||
<td><%= document.title %></td>
|
||||
<td><%= document.attachment.content_type %></td>
|
||||
<td><%= number_to_human_size(document.attachment.byte_size) %></td>
|
||||
<td><%= link_to document.title, document.attachment, target: :blank %></td>
|
||||
<td>
|
||||
<div class="small-12 medium-6 column">
|
||||
<%= render Admin::TableActionsComponent.new(
|
||||
document,
|
||||
actions: [:destroy],
|
||||
destroy_path: admin_site_customization_document_path(document)
|
||||
) %>
|
||||
</div>
|
||||
<%= render Admin::TableActionsComponent.new(
|
||||
document,
|
||||
actions: [:destroy],
|
||||
destroy_path: admin_site_customization_document_path(document)
|
||||
) do |actions| %>
|
||||
<%= actions.action(:download,
|
||||
text: t("documents.buttons.download_document"),
|
||||
path: document.attachment,
|
||||
target: "_blank",
|
||||
rel: "nofollow") %>
|
||||
<% end %>
|
||||
</td>
|
||||
</tr>
|
||||
<% end %>
|
||||
|
||||
@@ -529,7 +529,6 @@ en:
|
||||
title: "Documents"
|
||||
format: "Format"
|
||||
size: "Size"
|
||||
url: "URL"
|
||||
create:
|
||||
success_notice: "Document uploaded successfully"
|
||||
unable_notice: "Invalid document"
|
||||
|
||||
@@ -529,7 +529,6 @@ es:
|
||||
title: "Documentos"
|
||||
format: "Formato"
|
||||
size: "Tamaño"
|
||||
url: "URL"
|
||||
create:
|
||||
success_notice: "Documento creado correctamente"
|
||||
unable_notice: "Documento inválido"
|
||||
|
||||
@@ -23,7 +23,7 @@ describe "Documents", :admin do
|
||||
visit admin_site_customization_documents_path
|
||||
|
||||
expect(page).to have_content "There are 3 documents"
|
||||
expect(page).to have_link document.title, href: url
|
||||
expect(page).to have_link "Download file", href: url
|
||||
end
|
||||
|
||||
scenario "Index (empty)" do
|
||||
@@ -58,7 +58,8 @@ describe "Documents", :admin do
|
||||
click_button "Upload"
|
||||
|
||||
expect(page).to have_content "Document uploaded successfully"
|
||||
expect(page).to have_link "logo.pdf"
|
||||
|
||||
within("tr", text: "logo.pdf") { expect(page).to have_link "Download file" }
|
||||
end
|
||||
|
||||
scenario "Errors on create" do
|
||||
|
||||
Reference in New Issue
Block a user