diff --git a/app/views/documents/_document.html.erb b/app/views/documents/_document.html.erb index c4ead4c65..08571c5cf 100644 --- a/app/views/documents/_document.html.erb +++ b/app/views/documents/_document.html.erb @@ -1,20 +1,24 @@ - - - <%= document.title %> - - - <%= link_to t('documents.buttons.download_document'), - document.attachment.url, - target: "_blank", - rel: "nofollow", - class: 'button hollow' %> - - - <% if can? :destroy, Document %> - <%= link_to t('documents.buttons.destroy_document'), - document_path(document, from: request.url), method: :delete, - data: { confirm: t('documents.actions.destroy.confirm') }, - class: 'button hollow alert' %> - <% end %> - - + + + + + + + + +
+ <%= link_to t('documents.buttons.download_document'), + document.attachment.url, + target: "_blank", + rel: "nofollow", + class: 'button hollow' %> + + <% if can? :destroy, Document %> + <%= link_to t('documents.buttons.destroy_document'), + document_path(document, from: request.url), method: :delete, + data: { confirm: t('documents.actions.destroy.confirm') }, + class: 'button hollow alert' %> + <% end %> +
diff --git a/app/views/documents/_documents.html.erb b/app/views/documents/_documents.html.erb index bcdf39a32..4387817d6 100644 --- a/app/views/documents/_documents.html.erb +++ b/app/views/documents/_documents.html.erb @@ -1,33 +1,11 @@ -<% if documents.any? %> - - <% if documents.size == max_documents_allowed && can?(:destroy, Document) %> -
-
-
- <%= t "documents.max_documents_allowed_reached_html" %> -
-
-
- <% end %> - -
-
- - - <%= render partial: "documents/document", collection: documents %> - -
-
-
- -<% else %> - -
-
+
+
+ <% if documents.any? %> + <%= render partial: "documents/document", collection: documents %> + <% else %>
<%= t('documents.no_documents') %>
-
+ <% end %>
- -<% end %> +
diff --git a/spec/shared/features/documentable.rb b/spec/shared/features/documentable.rb index 2bd9d8f86..a2bdc83a4 100644 --- a/spec/shared/features/documentable.rb +++ b/spec/shared/features/documentable.rb @@ -18,25 +18,6 @@ shared_examples "documentable" do |documentable_factory_name, documentable_path, let!(:document) { create(:document, documentable: documentable, user: documentable.author)} - scenario "Should not display maximum number of documents alert when reached for users without document creation permission" do - create_list(:document, 2, documentable: documentable) - visit send(documentable_path, arguments) - - within "#tab-documents" do - expect(page).not_to have_content "You have reached the maximum number of documents allowed! You have to delete one before you can upload another." - end - end - - scenario "Should display maximum number of documents alert when reached and when current user has document creation permission" do - login_as documentable.author - create_list(:document, 2, documentable: documentable) - visit send(documentable_path, arguments) - - within "#tab-documents" do - expect(page).to have_content "You have reached the maximum number of documents allowed! You have to delete one before you can upload another." - end - end - scenario "Download action should be able to anyone" do visit send(documentable_path, arguments) @@ -149,4 +130,4 @@ def attach_document(path, success = true) else expect(page).to have_css ".loading-bar.errors" end -end \ No newline at end of file +end