Disable document upload & show with new setting
When Setting allow_attached_documents is disabled (false value) the user should not be able to upload documents neither see the documents lists
This commit is contained in:
@@ -23,9 +23,11 @@
|
|||||||
</div>
|
</div>
|
||||||
<% end %>
|
<% end %>
|
||||||
|
|
||||||
|
<% if feature?(:allow_attached_documents) %>
|
||||||
<div class="documents small-12 column">
|
<div class="documents small-12 column">
|
||||||
<%= render 'documents/nested_documents', documentable: @investment, f: f %>
|
<%= render 'documents/nested_documents', documentable: @investment, f: f %>
|
||||||
</div>
|
</div>
|
||||||
|
<% end %>
|
||||||
|
|
||||||
<% if feature?(:map) %>
|
<% if feature?(:map) %>
|
||||||
<div class="small-12 column">
|
<div class="small-12 column">
|
||||||
|
|||||||
@@ -51,9 +51,11 @@
|
|||||||
</p>
|
</p>
|
||||||
<% end %>
|
<% end %>
|
||||||
|
|
||||||
|
<% if feature?(:allow_attached_documents) %>
|
||||||
<%= render 'documents/documents',
|
<%= render 'documents/documents',
|
||||||
documents: investment.documents,
|
documents: investment.documents,
|
||||||
max_documents_allowed: Budget::Investment.max_documents_allowed %>
|
max_documents_allowed: Budget::Investment.max_documents_allowed %>
|
||||||
|
<% end %>
|
||||||
|
|
||||||
<%= render 'shared/tags', taggable: investment %>
|
<%= render 'shared/tags', taggable: investment %>
|
||||||
|
|
||||||
|
|||||||
@@ -80,9 +80,11 @@
|
|||||||
|
|
||||||
<h4><%= @proposal.question %></h4>
|
<h4><%= @proposal.question %></h4>
|
||||||
|
|
||||||
|
<% if feature?(:allow_attached_documents) %>
|
||||||
<%= render 'documents/documents',
|
<%= render 'documents/documents',
|
||||||
documents: @proposal.documents,
|
documents: @proposal.documents,
|
||||||
max_documents_allowed: Proposal.max_documents_allowed %>
|
max_documents_allowed: Proposal.max_documents_allowed %>
|
||||||
|
<% end %>
|
||||||
|
|
||||||
<%= render 'shared/tags', taggable: @proposal %>
|
<%= render 'shared/tags', taggable: @proposal %>
|
||||||
|
|
||||||
|
|||||||
@@ -52,9 +52,11 @@
|
|||||||
</div>
|
</div>
|
||||||
<% end %>
|
<% end %>
|
||||||
|
|
||||||
|
<% if feature?(:allow_attached_documents) %>
|
||||||
<div class="documents small-12 column">
|
<div class="documents small-12 column">
|
||||||
<%= render 'documents/nested_documents', documentable: @proposal, f: f %>
|
<%= render 'documents/nested_documents', documentable: @proposal, f: f %>
|
||||||
</div>
|
</div>
|
||||||
|
<% end %>
|
||||||
|
|
||||||
<div class="small-12 medium-6 column">
|
<div class="small-12 medium-6 column">
|
||||||
<%= f.label :geozone_id, t("proposals.form.geozone") %>
|
<%= f.label :geozone_id, t("proposals.form.geozone") %>
|
||||||
|
|||||||
@@ -106,9 +106,11 @@
|
|||||||
</div>
|
</div>
|
||||||
<% end %>
|
<% end %>
|
||||||
|
|
||||||
|
<% if feature?(:allow_attached_documents) %>
|
||||||
<%= render 'documents/documents',
|
<%= render 'documents/documents',
|
||||||
documents: @proposal.documents,
|
documents: @proposal.documents,
|
||||||
max_documents_allowed: Proposal.max_documents_allowed %>
|
max_documents_allowed: Proposal.max_documents_allowed %>
|
||||||
|
<% end %>
|
||||||
|
|
||||||
<%= render 'shared/tags', taggable: @proposal %>
|
<%= render 'shared/tags', taggable: @proposal %>
|
||||||
|
|
||||||
|
|||||||
@@ -68,6 +68,23 @@ shared_examples "documentable" do |documentable_factory_name,
|
|||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
|
describe "When allow attached documents setting is disabled" do
|
||||||
|
before do
|
||||||
|
Setting['feature.allow_attached_documents'] = false
|
||||||
|
end
|
||||||
|
|
||||||
|
after do
|
||||||
|
Setting['feature.allow_attached_documents'] = true
|
||||||
|
end
|
||||||
|
|
||||||
|
scenario "Documents list should not be available" do
|
||||||
|
login_as(create(:user))
|
||||||
|
visit send(documentable_path, arguments)
|
||||||
|
|
||||||
|
expect(page).not_to have_css("#documents")
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
context "Destroy" do
|
context "Destroy" do
|
||||||
|
|||||||
@@ -285,6 +285,23 @@ shared_examples "nested documentable" do |login_as_name, documentable_factory_na
|
|||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
|
describe "When allow attached documents setting is disabled" do
|
||||||
|
before do
|
||||||
|
Setting['feature.allow_attached_documents'] = false
|
||||||
|
end
|
||||||
|
|
||||||
|
after do
|
||||||
|
Setting['feature.allow_attached_documents'] = true
|
||||||
|
end
|
||||||
|
|
||||||
|
scenario "Add new document button should not be available" do
|
||||||
|
login_as user_to_login
|
||||||
|
visit send(path, arguments)
|
||||||
|
|
||||||
|
expect(page).not_to have_content("Add new document")
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|||||||
Reference in New Issue
Block a user