Merge pull request #5165 from betagouv/dev

2020-05-15-01
This commit is contained in:
Kara Diaby 2020-05-15 17:41:49 +02:00 committed by GitHub
commit ee6ec9a4f5
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
14 changed files with 90 additions and 110 deletions

View file

@ -253,7 +253,7 @@ GEM
i18n (>= 0.7) i18n (>= 0.7)
multi_json multi_json
request_store (>= 1.0) request_store (>= 1.0)
graphql (1.10.6) graphql (1.10.9)
graphql-batch (0.4.2) graphql-batch (0.4.2)
graphql (>= 1.3, < 2) graphql (>= 1.3, < 2)
promise.rb (~> 0.7.2) promise.rb (~> 0.7.2)

File diff suppressed because one or more lines are too long

Before

Width:  |  Height:  |  Size: 28 KiB

After

Width:  |  Height:  |  Size: 5.6 KiB

File diff suppressed because one or more lines are too long

After

Width:  |  Height:  |  Size: 14 KiB

View file

@ -81,6 +81,10 @@
margin: 5px auto 0 20px; margin: 5px auto 0 20px;
width: 150px; width: 150px;
} }
img {
background-color: #FFFFFF;
}
} }
#action-block { #action-block {

View file

@ -84,6 +84,13 @@ footer {
height: 25px; height: 25px;
} }
.footer-logo-france {
@include ie-compatible-background-image("republique-francaise-logo.svg");
width: 105px;
height: 90px;
}
.footer-link a, .footer-link a,
.footer-text a { .footer-text a {
color: $black; color: $black;

View file

@ -33,7 +33,7 @@ module ChampHelper
end end
def auto_attach_url(form, object) def auto_attach_url(form, object)
if feature_enabled?(:autoupload_dossier_attachments) && object.is_a?(Champ) && object.persisted? && object.public? if object.is_a?(Champ) && object.persisted? && object.public?
champs_piece_justificative_url(object.id) champs_piece_justificative_url(object.id)
end end
end end

View file

@ -23,7 +23,9 @@ function filterFeatureCollection(featureCollection, source) {
}; };
} }
const MapEditor = ({ featureCollection, url }) => { function noop() {}
function MapEditor({ featureCollection, url, preview }) {
const drawControl = useRef(null); const drawControl = useRef(null);
const [style, setStyle] = useState('ortho'); const [style, setStyle] = useState('ortho');
const [coords, setCoords] = useState([1.7, 46.9]); const [coords, setCoords] = useState([1.7, 46.9]);
@ -174,9 +176,9 @@ const MapEditor = ({ featureCollection, url }) => {
/> />
<DrawControl <DrawControl
ref={drawControl} ref={drawControl}
onDrawCreate={onDrawCreate} onDrawCreate={preview ? noop : onDrawCreate}
onDrawUpdate={onDrawUpdate} onDrawUpdate={preview ? noop : onDrawUpdate}
onDrawDelete={onDrawDelete} onDrawDelete={preview ? noop : onDrawDelete}
displayControlsDefault={false} displayControlsDefault={false}
controls={{ controls={{
point: true, point: true,
@ -202,7 +204,7 @@ const MapEditor = ({ featureCollection, url }) => {
</Map> </Map>
</> </>
); );
}; }
MapEditor.propTypes = { MapEditor.propTypes = {
featureCollection: PropTypes.shape({ featureCollection: PropTypes.shape({
@ -210,7 +212,8 @@ MapEditor.propTypes = {
features: PropTypes.array, features: PropTypes.array,
id: PropTypes.number id: PropTypes.number
}), }),
url: PropTypes.string url: PropTypes.string,
preview: PropTypes.bool
}; };
export default MapEditor; export default MapEditor;

View file

@ -44,7 +44,7 @@ class Champ < ApplicationRecord
def blank? def blank?
case type_de_champ.type_champ case type_de_champ.type_champ
when TypeDeChamp.type_champs.fetch(:carte) when TypeDeChamp.type_champs.fetch(:carte)
value.blank? || value == '[]' geo_areas.blank? || value == '[]'
else else
value.blank? value.blank?
end end

View file

@ -506,7 +506,7 @@ class Procedure < ApplicationRecord
if logo.attached? if logo.attached?
Rails.application.routes.url_helpers.url_for(logo) Rails.application.routes.url_helpers.url_for(logo)
else else
ActionController::Base.helpers.image_url("marianne.svg") ActionController::Base.helpers.image_url("republique-francaise-logo.svg")
end end
end end

View file

@ -14,12 +14,13 @@
%header.new-header{ class: current_page?(root_path) ? nil : "new-header-with-border", role: 'banner' } %header.new-header{ class: current_page?(root_path) ? nil : "new-header-with-border", role: 'banner' }
.header-inner-content .header-inner-content
.flex.align-center .flex.align-center.justify-center
- if params[:controller] == 'users/commencer' - if params[:controller] == 'users/commencer'
= link_to 'Revenir en arrière', url_for(:back), class: "button", title: "Revenir sur le site de mon administration" = link_to 'Revenir en arrière', url_for(:back), class: "button", title: "Revenir sur le site de mon administration"
- else - else
= link_to root_path_for_profile(nav_bar_profile), class: 'header-logo', title: "Aller à la page d'accueil de demarches-simplifiees.fr" do = link_to root_path_for_profile(nav_bar_profile), class: 'header-logo justify-center', title: "Aller à la page d'accueil de demarches-simplifiees.fr" do
= image_tag 'marianne.svg', alt: '', width: 65 = image_tag 'marianne.svg', alt: 'Liberté, égalité, fraternité', width: '65px'
= link_to root_path_for_profile(nav_bar_profile), class: 'header-logo justify-center', title: "Aller à la page d'accueil de demarches-simplifiees.fr" do
%span.big.site-title> demarches-simplifiees.fr %span.big.site-title> demarches-simplifiees.fr
%span.small.site-title> d-s.fr %span.small.site-title> d-s.fr

View file

@ -15,6 +15,7 @@
%span.footer-logo.footer-logo-dinum{ role: 'img', 'aria-label': 'DINUM' } %span.footer-logo.footer-logo-dinum{ role: 'img', 'aria-label': 'DINUM' }
= link_to "https://beta.gouv.fr", title: "le site de Beta.gouv.fr" do = link_to "https://beta.gouv.fr", title: "le site de Beta.gouv.fr" do
%span.footer-logo.footer-logo-beta-gouv-fr{ role: 'img', 'aria-label': 'beta.gouv.fr' } %span.footer-logo.footer-logo-beta-gouv-fr{ role: 'img', 'aria-label': 'beta.gouv.fr' }
%span.footer-logo.footer-logo-france{ role: 'img', 'aria-label': 'République Française' }
%li.footer-column %li.footer-column
%ul.footer-links %ul.footer-links

View file

@ -1,5 +1,6 @@
- if feature_enabled?(:new_map_editor) - if feature_enabled?(:new_map_editor)
= react_component("MapEditor", { featureCollection: champ.to_feature_collection, url: champs_carte_features_path(champ) }, class: "carte-#{champ.id}") - preview = !champ.persisted?
= react_component("MapEditor", { featureCollection: champ.to_feature_collection, url: champs_carte_features_path(preview ? 'preview' : champ), preview: preview }, class: "carte-#{champ.id}")
- else - else
.toolbar .toolbar
%button.button.primary.new-area Ajouter une zone %button.button.primary.new-area Ajouter une zone

View file

@ -31,7 +31,6 @@ features = [
:insee_api_v3, :insee_api_v3,
:instructeur_bypass_email_login_token, :instructeur_bypass_email_login_token,
:autosave_dossier_draft, :autosave_dossier_draft,
:autoupload_dossier_attachments,
:new_map_editor, :new_map_editor,
:maintenance_mode, :maintenance_mode,
:mini_profiler, :mini_profiler,

View file

@ -165,42 +165,6 @@ feature 'The user' do
create(:procedure, :published, :for_individual, types_de_champ: tdcs) create(:procedure, :published, :for_individual, types_de_champ: tdcs)
end end
scenario 'adding, replacing and removing attachments', js: true do
log_in(user, procedure_with_pj)
fill_individual
# Add an attachment
find_field('Pièce justificative').attach_file(Rails.root + 'spec/fixtures/files/file.pdf')
click_on 'Enregistrer le brouillon'
expect(page).to have_content('Votre brouillon a bien été sauvegardé')
expect(page).to have_text('file.pdf')
expect(page).to have_text('analyse antivirus en cours')
# Mark file as scanned and clean
attachment = ActiveStorage::Attachment.last
attachment.blob.update(metadata: attachment.blob.metadata.merge(scanned_at: Time.zone.now, virus_scan_result: ActiveStorage::VirusScanner::SAFE))
within('.attachment') { click_on 'rafraichir' }
expect(page).to have_link('file.pdf')
expect(page).to have_no_content('analyse antivirus en cours')
# Replace the attachment
within('.attachment') { click_on 'Remplacer' }
find_field('Pièce justificative').attach_file(Rails.root + 'spec/fixtures/files/RIB.pdf')
click_on 'Enregistrer le brouillon'
expect(page).to have_no_text('file.pdf')
expect(page).to have_text('RIB.pdf')
# Remove the attachment
within('.attachment') { click_on 'Supprimer' }
expect(page).to have_content('La pièce jointe a bien été supprimée')
expect(page).to have_no_text('RIB.pdf')
end
context 'when the auto-uploads of attachments is enabled' do
before do
Flipper.enable_actor(:autoupload_dossier_attachments, user)
end
scenario 'add an attachment', js: true do scenario 'add an attachment', js: true do
log_in(user, procedure_with_pjs) log_in(user, procedure_with_pjs)
fill_individual fill_individual
@ -273,7 +237,6 @@ feature 'The user' do
# Expect the file to have been saved on the dossier # Expect the file to have been saved on the dossier
expect(page).to have_text('file.pdf') expect(page).to have_text('file.pdf')
end end
end
context 'when the draft autosave is enabled' do context 'when the draft autosave is enabled' do
before do before do