Refactor documents and document view partials
This commit is contained in:
@@ -1,4 +1,6 @@
|
||||
<tr id="<%= dom_id(document)%>">
|
||||
<table>
|
||||
<tbody>
|
||||
<tr id="<%= dom_id(document)%>">
|
||||
<td class="document-link">
|
||||
<%= document.title %>
|
||||
</td>
|
||||
@@ -17,4 +19,6 @@
|
||||
class: 'button hollow alert' %>
|
||||
<% end %>
|
||||
</td>
|
||||
</tr>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
@@ -1,33 +1,11 @@
|
||||
<% if documents.any? %>
|
||||
|
||||
<% if documents.size == max_documents_allowed && can?(:destroy, Document) %>
|
||||
<div class="row documents-list">
|
||||
<div class="row <% 'documents-list' if documents.any? %>">
|
||||
<div class="small-12 column">
|
||||
<div class="callout warning text-center">
|
||||
<%= t "documents.max_documents_allowed_reached_html" %>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<% end %>
|
||||
|
||||
<div class="row documents-list">
|
||||
<div class="small-12 column">
|
||||
<table>
|
||||
<tbody>
|
||||
<% if documents.any? %>
|
||||
<%= render partial: "documents/document", collection: documents %>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<% else %>
|
||||
|
||||
<div class="row">
|
||||
<div class="small-12 column">
|
||||
<% else %>
|
||||
<div class="callout primary text-center">
|
||||
<%= t('documents.no_documents') %>
|
||||
</div>
|
||||
<% end %>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<% end %>
|
||||
</div>
|
||||
|
||||
@@ -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)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user