Merge pull request #2585 from consul/document_upload_setting
Document upload setting
This commit is contained in:
@@ -23,9 +23,11 @@
|
||||
</div>
|
||||
<% end %>
|
||||
|
||||
<% if feature?(:allow_attached_documents) %>
|
||||
<div class="documents small-12 column">
|
||||
<%= render 'documents/nested_documents', documentable: @investment, f: f %>
|
||||
</div>
|
||||
<% end %>
|
||||
|
||||
<% if feature?(:map) %>
|
||||
<div class="small-12 column">
|
||||
|
||||
@@ -51,9 +51,11 @@
|
||||
</p>
|
||||
<% end %>
|
||||
|
||||
<% if feature?(:allow_attached_documents) %>
|
||||
<%= render 'documents/documents',
|
||||
documents: investment.documents,
|
||||
max_documents_allowed: Budget::Investment.max_documents_allowed %>
|
||||
<% end %>
|
||||
|
||||
<%= render 'shared/tags', taggable: investment %>
|
||||
|
||||
|
||||
@@ -80,9 +80,11 @@
|
||||
|
||||
<h4><%= @proposal.question %></h4>
|
||||
|
||||
<% if feature?(:allow_attached_documents) %>
|
||||
<%= render 'documents/documents',
|
||||
documents: @proposal.documents,
|
||||
max_documents_allowed: Proposal.max_documents_allowed %>
|
||||
<% end %>
|
||||
|
||||
<%= render 'shared/tags', taggable: @proposal %>
|
||||
|
||||
|
||||
@@ -52,9 +52,11 @@
|
||||
</div>
|
||||
<% end %>
|
||||
|
||||
<% if feature?(:allow_attached_documents) %>
|
||||
<div class="documents small-12 column">
|
||||
<%= render 'documents/nested_documents', documentable: @proposal, f: f %>
|
||||
</div>
|
||||
<% end %>
|
||||
|
||||
<div class="small-12 medium-6 column">
|
||||
<%= f.label :geozone_id, t("proposals.form.geozone") %>
|
||||
|
||||
@@ -106,9 +106,11 @@
|
||||
</div>
|
||||
<% end %>
|
||||
|
||||
<% if feature?(:allow_attached_documents) %>
|
||||
<%= render 'documents/documents',
|
||||
documents: @proposal.documents,
|
||||
max_documents_allowed: Proposal.max_documents_allowed %>
|
||||
<% end %>
|
||||
|
||||
<%= render 'shared/tags', taggable: @proposal %>
|
||||
|
||||
|
||||
@@ -45,6 +45,7 @@ en:
|
||||
community: Community on proposals and investments
|
||||
map: Proposals and budget investments geolocation
|
||||
allow_images: Allow upload and show images
|
||||
allow_attached_documents: Allow upload and show of attached documents
|
||||
map_latitude: Latitude
|
||||
map_longitude: Longitude
|
||||
map_zoom: Zoom
|
||||
|
||||
@@ -45,6 +45,7 @@ es:
|
||||
community: Comunidad en propuestas y proyectos de gasto
|
||||
map: Geolocalización de propuestas y proyectos de gasto
|
||||
allow_images: Permitir subir y mostrar imágenes
|
||||
allow_attached_documents: Permitir creación de documentos adjuntos
|
||||
map_latitude: Latitud
|
||||
map_longitude: Longitud
|
||||
map_zoom: Zoom
|
||||
|
||||
@@ -43,6 +43,7 @@ section "Creating Settings" do
|
||||
Setting.create(key: 'feature.community', value: "true")
|
||||
Setting.create(key: 'feature.map', value: "true")
|
||||
Setting.create(key: 'feature.allow_images', value: "true")
|
||||
Setting.create(key: 'feature.allow_attached_documents', value: "true")
|
||||
Setting.create(key: 'feature.public_stats', value: "true")
|
||||
Setting.create(key: 'feature.guides', value: nil)
|
||||
|
||||
|
||||
@@ -85,6 +85,7 @@ Setting['feature.user.recommendations'] = true
|
||||
Setting['feature.community'] = true
|
||||
Setting['feature.map'] = nil
|
||||
Setting['feature.allow_images'] = true
|
||||
Setting['feature.allow_attached_documents'] = true
|
||||
Setting['feature.guides'] = nil
|
||||
|
||||
# Spending proposals feature flags
|
||||
|
||||
@@ -8,4 +8,9 @@ namespace :settings do
|
||||
per_page_code_setting.destroy if per_page_code_setting.present?
|
||||
end
|
||||
|
||||
desc "Create new Attached Documents feature setting"
|
||||
task create_attached_documents_setting: :environment do
|
||||
Setting['feature.allow_attached_documents'] = true
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
@@ -68,6 +68,23 @@ shared_examples "documentable" do |documentable_factory_name,
|
||||
|
||||
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
|
||||
|
||||
context "Destroy" do
|
||||
|
||||
@@ -285,6 +285,23 @@ shared_examples "nested documentable" do |login_as_name, documentable_factory_na
|
||||
|
||||
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
|
||||
|
||||
Reference in New Issue
Block a user