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.shared.title") %></th>
|
||||||
<th scope="col"><%= t("admin.documents.index.format") %></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.size") %></th>
|
||||||
<th scope="col"><%= t("admin.documents.index.url") %></th>
|
|
||||||
<th scope="col"><%= t("admin.shared.actions") %></th>
|
<th scope="col"><%= t("admin.shared.actions") %></th>
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
@@ -23,15 +22,18 @@
|
|||||||
<td><%= document.title %></td>
|
<td><%= document.title %></td>
|
||||||
<td><%= document.attachment.content_type %></td>
|
<td><%= document.attachment.content_type %></td>
|
||||||
<td><%= number_to_human_size(document.attachment.byte_size) %></td>
|
<td><%= number_to_human_size(document.attachment.byte_size) %></td>
|
||||||
<td><%= link_to document.title, document.attachment, target: :blank %></td>
|
|
||||||
<td>
|
<td>
|
||||||
<div class="small-12 medium-6 column">
|
|
||||||
<%= render Admin::TableActionsComponent.new(
|
<%= render Admin::TableActionsComponent.new(
|
||||||
document,
|
document,
|
||||||
actions: [:destroy],
|
actions: [:destroy],
|
||||||
destroy_path: admin_site_customization_document_path(document)
|
destroy_path: admin_site_customization_document_path(document)
|
||||||
) %>
|
) do |actions| %>
|
||||||
</div>
|
<%= actions.action(:download,
|
||||||
|
text: t("documents.buttons.download_document"),
|
||||||
|
path: document.attachment,
|
||||||
|
target: "_blank",
|
||||||
|
rel: "nofollow") %>
|
||||||
|
<% end %>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<% end %>
|
<% end %>
|
||||||
|
|||||||
@@ -529,7 +529,6 @@ en:
|
|||||||
title: "Documents"
|
title: "Documents"
|
||||||
format: "Format"
|
format: "Format"
|
||||||
size: "Size"
|
size: "Size"
|
||||||
url: "URL"
|
|
||||||
create:
|
create:
|
||||||
success_notice: "Document uploaded successfully"
|
success_notice: "Document uploaded successfully"
|
||||||
unable_notice: "Invalid document"
|
unable_notice: "Invalid document"
|
||||||
|
|||||||
@@ -529,7 +529,6 @@ es:
|
|||||||
title: "Documentos"
|
title: "Documentos"
|
||||||
format: "Formato"
|
format: "Formato"
|
||||||
size: "Tamaño"
|
size: "Tamaño"
|
||||||
url: "URL"
|
|
||||||
create:
|
create:
|
||||||
success_notice: "Documento creado correctamente"
|
success_notice: "Documento creado correctamente"
|
||||||
unable_notice: "Documento inválido"
|
unable_notice: "Documento inválido"
|
||||||
|
|||||||
@@ -23,7 +23,7 @@ describe "Documents", :admin do
|
|||||||
visit admin_site_customization_documents_path
|
visit admin_site_customization_documents_path
|
||||||
|
|
||||||
expect(page).to have_content "There are 3 documents"
|
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
|
end
|
||||||
|
|
||||||
scenario "Index (empty)" do
|
scenario "Index (empty)" do
|
||||||
@@ -58,7 +58,8 @@ describe "Documents", :admin do
|
|||||||
click_button "Upload"
|
click_button "Upload"
|
||||||
|
|
||||||
expect(page).to have_content "Document uploaded successfully"
|
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
|
end
|
||||||
|
|
||||||
scenario "Errors on create" do
|
scenario "Errors on create" do
|
||||||
|
|||||||
Reference in New Issue
Block a user