diff --git a/app/assets/stylesheets/documents/document.scss b/app/assets/stylesheets/documents/document.scss index 54ecd651c..2b217757d 100644 --- a/app/assets/stylesheets/documents/document.scss +++ b/app/assets/stylesheets/documents/document.scss @@ -3,7 +3,7 @@ margin-top: calc(#{$line-height} / 3); } - a:first-of-type { + a { word-wrap: break-word; .document-metadata { @@ -18,4 +18,8 @@ } } } + + button { + cursor: pointer; + } } diff --git a/app/components/documents/document_component.html.erb b/app/components/documents/document_component.html.erb index 1de910081..f31ba2a12 100644 --- a/app/components/documents/document_component.html.erb +++ b/app/components/documents/document_component.html.erb @@ -8,10 +8,10 @@ <% end %> <% if show_destroy_link? && can?(:destroy, document) %> - <%= link_to t("documents.buttons.destroy_document"), - document, - method: :delete, - data: { confirm: t("documents.actions.destroy.confirm") }, - class: "delete" %> + <%= button_to t("documents.buttons.destroy_document"), + document, + method: :delete, + data: { confirm: t("documents.actions.destroy.confirm") }, + class: "delete" %> <% end %> diff --git a/spec/shared/system/documentable.rb b/spec/shared/system/documentable.rb index ad6727671..3f7177573 100644 --- a/spec/shared/system/documentable.rb +++ b/spec/shared/system/documentable.rb @@ -25,27 +25,27 @@ shared_examples "documentable" do |documentable_factory_name, documentable_path, scenario "Should not be able when no user logged in" do visit send(documentable_path, arguments) - expect(page).not_to have_link("Delete document") + expect(page).not_to have_button "Delete document" end scenario "Should be able when documentable author is logged in" do login_as documentable.author visit send(documentable_path, arguments) - expect(page).to have_link("Delete document") + expect(page).to have_button "Delete document" end scenario "Administrators cannot destroy documentables they have not authored", :admin do visit send(documentable_path, arguments) - expect(page).not_to have_link("Delete document") + expect(page).not_to have_button "Delete document" end scenario "Users cannot destroy documentables they have not authored" do login_as(create(:user)) visit send(documentable_path, arguments) - expect(page).not_to have_link("Delete document") + expect(page).not_to have_button "Delete document" end end @@ -93,7 +93,7 @@ shared_examples "documentable" do |documentable_factory_name, documentable_path, visit send(documentable_path, arguments) within "#document_#{document.id}" do - accept_confirm { click_link "Delete document" } + accept_confirm { click_button "Delete document" } end expect(page).to have_content "Document was deleted successfully." @@ -105,7 +105,7 @@ shared_examples "documentable" do |documentable_factory_name, documentable_path, visit send(documentable_path, arguments) within "#document_#{document.id}" do - accept_confirm { click_link "Delete document" } + accept_confirm { click_button "Delete document" } end expect(page).not_to have_content "Documents (0)" @@ -117,7 +117,7 @@ shared_examples "documentable" do |documentable_factory_name, documentable_path, visit send(documentable_path, arguments) within "#document_#{document.id}" do - accept_confirm { click_link "Delete document" } + accept_confirm { click_button "Delete document" } end within "##{ActionView::RecordIdentifier.dom_id(documentable)}" do