commit
b02013d6af
20 changed files with 176 additions and 95 deletions
|
@ -7,3 +7,6 @@ $default-padding: 2 * $default-spacer;
|
||||||
// layouts
|
// layouts
|
||||||
$two-columns-padding: 60px;
|
$two-columns-padding: 60px;
|
||||||
$two-columns-breakpoint: $page-width + (2 * $two-columns-padding);
|
$two-columns-breakpoint: $page-width + (2 * $two-columns-padding);
|
||||||
|
|
||||||
|
// z-order
|
||||||
|
$alert-z-index: 100;
|
||||||
|
|
|
@ -311,8 +311,9 @@
|
||||||
margin-left: $default-spacer;
|
margin-left: $default-spacer;
|
||||||
}
|
}
|
||||||
|
|
||||||
.button.danger {
|
// If there are more than one button, align the "Send" button to the right
|
||||||
margin-right: auto;
|
.button:not(:first-of-type).send {
|
||||||
|
margin-left: auto;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -321,8 +322,7 @@
|
||||||
flex-direction: column-reverse;
|
flex-direction: column-reverse;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
|
|
||||||
.button,
|
.button {
|
||||||
.button.danger {
|
|
||||||
width: 100%;
|
width: 100%;
|
||||||
max-width: 350px;
|
max-width: 350px;
|
||||||
line-height: 30px;
|
line-height: 30px;
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
@import "colors";
|
@import "colors";
|
||||||
|
@import "constants";
|
||||||
|
|
||||||
.alert {
|
.alert {
|
||||||
padding: 15px;
|
padding: 15px;
|
||||||
|
@ -24,8 +25,10 @@
|
||||||
.alert-fixed {
|
.alert-fixed {
|
||||||
position: fixed;
|
position: fixed;
|
||||||
left: 50%;
|
left: 50%;
|
||||||
margin-left: -100px;
|
transform: translate(-50%);
|
||||||
width: 200px;
|
max-width: 700px;
|
||||||
top: 10px;
|
top: 10px;
|
||||||
border-radius: 10px;
|
border-radius: 10px;
|
||||||
|
// Ensure fixed flash messages are above `position: absolute` elements (like maps)
|
||||||
|
z-index: $alert-z-index;
|
||||||
}
|
}
|
||||||
|
|
|
@ -74,5 +74,9 @@ class Champs::CarteController < ApplicationController
|
||||||
if @champ.persisted?
|
if @champ.persisted?
|
||||||
@champ.save
|
@champ.save
|
||||||
end
|
end
|
||||||
|
|
||||||
|
rescue RestClient::ResourceNotFound
|
||||||
|
flash.alert = 'Les données cartographiques sont temporairement indisponibles. Réessayez dans un instant.'
|
||||||
|
response.status = 503
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -17,7 +17,7 @@ module Manager
|
||||||
flash.notice = "Administrateur créé"
|
flash.notice = "Administrateur créé"
|
||||||
redirect_to manager_demandes_path
|
redirect_to manager_demandes_path
|
||||||
else
|
else
|
||||||
flash.now.alert = administrateur.errors.full_messages
|
flash.now.alert = administrateur.errors.full_messages.to_sentence
|
||||||
@pending_demandes = pending_demandes
|
@pending_demandes = pending_demandes
|
||||||
render :index
|
render :index
|
||||||
end
|
end
|
||||||
|
|
|
@ -18,6 +18,7 @@ class ProcedureDashboard < Administrate::BaseDashboard
|
||||||
id: Field::Number.with_options(searchable: true),
|
id: Field::Number.with_options(searchable: true),
|
||||||
libelle: Field::String,
|
libelle: Field::String,
|
||||||
description: Field::String,
|
description: Field::String,
|
||||||
|
lien_site_web: Field::String, # TODO: use Field::Url when administrate-v0.12 will be released
|
||||||
organisation: Field::String,
|
organisation: Field::String,
|
||||||
direction: Field::String,
|
direction: Field::String,
|
||||||
created_at: Field::DateTime,
|
created_at: Field::DateTime,
|
||||||
|
@ -59,6 +60,7 @@ class ProcedureDashboard < Administrate::BaseDashboard
|
||||||
:administrateur,
|
:administrateur,
|
||||||
:libelle,
|
:libelle,
|
||||||
:description,
|
:description,
|
||||||
|
:lien_site_web,
|
||||||
:organisation,
|
:organisation,
|
||||||
:direction,
|
:direction,
|
||||||
:service,
|
:service,
|
||||||
|
|
|
@ -13,10 +13,10 @@ class ApiCarto::API
|
||||||
|
|
||||||
def self.call(url, geojson)
|
def self.call(url, geojson)
|
||||||
params = geojson.to_s
|
params = geojson.to_s
|
||||||
|
|
||||||
RestClient.post(url, params, content_type: 'application/json')
|
RestClient.post(url, params, content_type: 'application/json')
|
||||||
|
|
||||||
rescue RestClient::InternalServerError
|
rescue RestClient::InternalServerError, RestClient::BadGateway, RestClient::GatewayTimeout => e
|
||||||
|
Rails.logger.error "[ApiCarto] Error on #{url}: #{e}"
|
||||||
raise RestClient::ResourceNotFound
|
raise RestClient::ResourceNotFound
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -1,19 +1,9 @@
|
||||||
class Champs::CheckboxChamp < Champ
|
class Champs::CheckboxChamp < Champs::YesNoChamp
|
||||||
def search_terms
|
def true?
|
||||||
if value == 'on'
|
value == 'on'
|
||||||
[libelle]
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
def to_s
|
|
||||||
value == 'on' ? 'Oui' : 'Non'
|
|
||||||
end
|
end
|
||||||
|
|
||||||
def for_export
|
def for_export
|
||||||
value == 'on' ? 'on' : 'off'
|
true? ? 'on' : 'off'
|
||||||
end
|
|
||||||
|
|
||||||
def for_api
|
|
||||||
value == 'on' ? 'on' : 'off'
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
class Champs::YesNoChamp < Champs::CheckboxChamp
|
class Champs::YesNoChamp < Champ
|
||||||
def search_terms
|
def search_terms
|
||||||
if value == 'true'
|
if true?
|
||||||
[libelle]
|
[libelle]
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -13,13 +13,13 @@ class Champs::YesNoChamp < Champs::CheckboxChamp
|
||||||
processed_value
|
processed_value
|
||||||
end
|
end
|
||||||
|
|
||||||
def for_api
|
def true?
|
||||||
processed_value
|
value == 'true'
|
||||||
end
|
end
|
||||||
|
|
||||||
private
|
private
|
||||||
|
|
||||||
def processed_value
|
def processed_value
|
||||||
value == 'true' ? 'Oui' : 'Non'
|
true? ? 'Oui' : 'Non'
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -1,8 +1,7 @@
|
||||||
require 'prawn/measurement_extensions'
|
require 'prawn/measurement_extensions'
|
||||||
|
|
||||||
prawn_document(margin: [50, 100, 20, 100]) do |pdf|
|
prawn_document(margin: [50, 100, 20, 100]) do |pdf|
|
||||||
pdf.font_families.update( 'open sans' => { normal: './lib/prawn/fonts/OpenSans-Regular.ttf' })
|
pdf.font 'Times-Roman'
|
||||||
pdf.font 'open sans'
|
|
||||||
|
|
||||||
grey = '555555'
|
grey = '555555'
|
||||||
black = '333333'
|
black = '333333'
|
||||||
|
@ -21,7 +20,7 @@ prawn_document(margin: [50, 100, 20, 100]) do |pdf|
|
||||||
pdf.pad_top(40) { pdf.text @title, size: 18, character_spacing: -0.2 }
|
pdf.pad_top(40) { pdf.text @title, size: 18, character_spacing: -0.2 }
|
||||||
|
|
||||||
pdf.fill_color grey
|
pdf.fill_color grey
|
||||||
pdf.pad_top(30) { pdf.text @body, size: 10, character_spacing: -0.2 }
|
pdf.pad_top(30) { pdf.text @body, size: 10, character_spacing: -0.2, align: :justify }
|
||||||
|
|
||||||
if @signature.present?
|
if @signature.present?
|
||||||
pdf.pad_top(40) do
|
pdf.pad_top(40) do
|
||||||
|
|
|
@ -3,7 +3,4 @@
|
||||||
= form_for @procedure, url: url_for({ controller: 'admin/procedures', action: :update, id: @procedure.id }), multipart: true do |f|
|
= form_for @procedure, url: url_for({ controller: 'admin/procedures', action: :update, id: @procedure.id }), multipart: true do |f|
|
||||||
= render partial: 'informations', locals: { f: f }
|
= render partial: 'informations', locals: { f: f }
|
||||||
.text-right
|
.text-right
|
||||||
- if !Flipflop.publish_draft? || @availability.in?(Procedure::PATH_CAN_PUBLISH)
|
|
||||||
= f.button 'Enregistrer', class: 'btn btn-success'
|
= f.button 'Enregistrer', class: 'btn btn-success'
|
||||||
- else
|
|
||||||
= f.button 'Enregistrer', class: 'btn btn-success', disabled: true
|
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
|
<%= render_flash(timeout: 5000, fixed: true) %>
|
||||||
|
|
||||||
<%= render_to_element("#{@selector} + .geo-areas",
|
<%= render_to_element("#{@selector} + .geo-areas",
|
||||||
partial: 'shared/champs/carte/geo_areas',
|
partial: 'shared/champs/carte/geo_areas',
|
||||||
locals: { champ: @champ, error: @error }) %>
|
locals: { champ: @champ, error: @error }) %>
|
||||||
|
|
|
@ -52,7 +52,7 @@
|
||||||
= dossier.updated_at.strftime("%d/%m/%Y")
|
= dossier.updated_at.strftime("%d/%m/%Y")
|
||||||
%td.action-col.delete-col
|
%td.action-col.delete-col
|
||||||
- if dossier.brouillon?
|
- if dossier.brouillon?
|
||||||
= link_to(ask_deletion_dossier_path(dossier), method: :post, class: 'button danger', data: { disable: true, confirm: "En continuant, vous allez supprimer ce dossier ainsi que les informations qu’il contient. Toute suppression entraine l’annulation de la démarche en cours.\n\nConfirmer la suppression ?" }) do
|
= link_to(ask_deletion_dossier_path(dossier), method: :post, class: 'button danger', data: { disable: true, confirm: "En continuant, vous allez supprimer ce dossier ainsi que les informations qu’il contient. Toute suppression entraine l’annulation de la démarche en cours.\n\nConfirmer la suppression ?" }) do
|
||||||
%span.icon.delete
|
%span.icon.delete
|
||||||
Supprimer
|
Supprimer
|
||||||
= paginate(@dossiers)
|
= paginate(@dossiers)
|
||||||
|
|
|
@ -40,7 +40,7 @@
|
||||||
%input{ type: "password", value: "12345678" }
|
%input{ type: "password", value: "12345678" }
|
||||||
.send-wrapper
|
.send-wrapper
|
||||||
= f.submit 'Enregistrer un brouillon (formnovalidate)', formnovalidate: true, class: 'button send'
|
= f.submit 'Enregistrer un brouillon (formnovalidate)', formnovalidate: true, class: 'button send'
|
||||||
= f.submit 'Envoyer', class: 'button send'
|
= f.submit 'Envoyer', class: 'button send primary'
|
||||||
|
|
||||||
%hr
|
%hr
|
||||||
|
|
||||||
|
|
|
@ -70,13 +70,6 @@
|
||||||
- if !apercu
|
- if !apercu
|
||||||
.send-wrapper
|
.send-wrapper
|
||||||
- if dossier.brouillon?
|
- if dossier.brouillon?
|
||||||
- if current_user.owns?(dossier)
|
|
||||||
= link_to ask_deletion_dossier_path(dossier),
|
|
||||||
method: :post,
|
|
||||||
class: 'button danger',
|
|
||||||
data: { disable: true, confirm: "En continuant, vous allez supprimer ce dossier ainsi que les informations qu’il contient. Toute suppression entraine l’annulation de la démarche en cours.\n\nConfirmer la suppression ?" } do
|
|
||||||
Supprimer le brouillon
|
|
||||||
|
|
||||||
= f.button 'Enregistrer le brouillon',
|
= f.button 'Enregistrer le brouillon',
|
||||||
formnovalidate: true,
|
formnovalidate: true,
|
||||||
name: :save_draft,
|
name: :save_draft,
|
||||||
|
|
|
@ -1,3 +1,23 @@
|
||||||
|
-# Allowed formats:
|
||||||
|
-# 0123456789
|
||||||
|
-# 01 23 45 67 89
|
||||||
|
-# 01.23.45.67.89
|
||||||
|
-# 0123 45.67.89
|
||||||
|
-# 0033 123-456-789
|
||||||
|
-# 0035 123-456-789
|
||||||
|
-# 0033 123-456-789
|
||||||
|
-# 0033(0)123456789
|
||||||
|
-# +33-1.23.45.67.89
|
||||||
|
-# +33 - 123 456 789
|
||||||
|
-# +33(0) 123 456 789
|
||||||
|
-# +33 (0)123 45 67 89
|
||||||
|
-# +33 (0)1 2345-6789
|
||||||
|
-# +33(0) - 123456789
|
||||||
|
-# +1(0) - 123456789
|
||||||
|
-# +2 123456789
|
||||||
|
-# 012345678
|
||||||
|
-# 01234567890
|
||||||
= form.phone_field :value,
|
= form.phone_field :value,
|
||||||
placeholder: champ.libelle,
|
placeholder: champ.libelle,
|
||||||
required: champ.mandatory?
|
required: champ.mandatory?,
|
||||||
|
pattern: "([\\+\\d\\(][\\(\\)\\s\\.\\-\\d]{4,}\\d)"
|
||||||
|
|
|
@ -25,8 +25,12 @@ describe Champs::CarteController, type: :controller do
|
||||||
describe 'POST #show' do
|
describe 'POST #show' do
|
||||||
render_views
|
render_views
|
||||||
|
|
||||||
before { sign_in user }
|
context 'when the API is available' do
|
||||||
|
render_views
|
||||||
|
|
||||||
before do
|
before do
|
||||||
|
sign_in user
|
||||||
|
|
||||||
allow_any_instance_of(ApiCarto::QuartiersPrioritairesAdapter)
|
allow_any_instance_of(ApiCarto::QuartiersPrioritairesAdapter)
|
||||||
.to receive(:results)
|
.to receive(:results)
|
||||||
.and_return([{ code: "QPCODE1234", geometry: { type: "MultiPolygon", coordinates: [[[[2.38715792094576, 48.8723062632126], [2.38724851642619, 48.8721392348061]]]] } }])
|
.and_return([{ code: "QPCODE1234", geometry: { type: "MultiPolygon", coordinates: [[[[2.38715792094576, 48.8723062632126], [2.38724851642619, 48.8721392348061]]]] } }])
|
||||||
|
@ -64,4 +68,22 @@ describe Champs::CarteController, type: :controller do
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
context 'when the API is unavailable' do
|
||||||
|
before do
|
||||||
|
sign_in user
|
||||||
|
|
||||||
|
allow_any_instance_of(ApiCarto::QuartiersPrioritairesAdapter)
|
||||||
|
.to receive(:results)
|
||||||
|
.and_raise(RestClient::ResourceNotFound)
|
||||||
|
|
||||||
|
post :show, params: params, format: 'js'
|
||||||
|
end
|
||||||
|
|
||||||
|
let(:value) { [[{ "lat": 48.87442541960633, "lng": 2.3859214782714844 }, { "lat": 48.87273183590832, "lng": 2.3850631713867183 }, { "lat": 48.87081237174292, "lng": 2.3809432983398438 }, { "lat": 48.8712640169951, "lng": 2.377510070800781 }, { "lat": 48.87510283703279, "lng": 2.3778533935546875 }, { "lat": 48.87544154230615, "lng": 2.382831573486328 }, { "lat": 48.87442541960633, "lng": 2.3859214782714844 }]].to_json }
|
||||||
|
|
||||||
|
it { expect(response.status).to eq 503 }
|
||||||
|
it { expect(response.body).to include('Les données cartographiques sont temporairement indisponibles') }
|
||||||
|
end
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -112,20 +112,6 @@ feature 'The user' do
|
||||||
expect(page).to have_current_path(merci_dossier_path(user_dossier))
|
expect(page).to have_current_path(merci_dossier_path(user_dossier))
|
||||||
end
|
end
|
||||||
|
|
||||||
scenario 'delete a draft', js: true do
|
|
||||||
log_in(user.email, password, simple_procedure)
|
|
||||||
fill_individual
|
|
||||||
|
|
||||||
page.accept_alert('Confirmer la suppression ?') do
|
|
||||||
click_on 'Supprimer le brouillon'
|
|
||||||
end
|
|
||||||
|
|
||||||
expect(page).to have_current_path(dossiers_path)
|
|
||||||
expect(page).to have_text('Votre dossier a bien été supprimé')
|
|
||||||
expect(page).not_to have_text(user_dossier.procedure.libelle)
|
|
||||||
expect(user_dossier.reload.hidden_at).to be_present
|
|
||||||
end
|
|
||||||
|
|
||||||
private
|
private
|
||||||
|
|
||||||
def log_in(email, password, procedure)
|
def log_in(email, password, procedure)
|
||||||
|
|
|
@ -49,13 +49,13 @@ describe 'user access to the list of his dossier' do
|
||||||
expect(page).not_to have_link(nil, href: ask_deletion_dossier_path(dossier1))
|
expect(page).not_to have_link(nil, href: ask_deletion_dossier_path(dossier1))
|
||||||
end
|
end
|
||||||
|
|
||||||
context 'when user clicks on delete brouillon list', js: true do
|
context 'when user clicks on delete brouillon', js: true do
|
||||||
before do
|
|
||||||
find(:xpath, "//a[@href='#{ask_deletion_dossier_path(dossier_brouillon)}']").click
|
|
||||||
page.driver.browser.switch_to.alert.accept
|
|
||||||
end
|
|
||||||
scenario 'dossier is deleted' do
|
scenario 'dossier is deleted' do
|
||||||
expect(page).not_to have_link("Supprimer", href: dossier_brouillon.procedure.libelle)
|
page.accept_alert('Confirmer la suppression ?') do
|
||||||
|
find(:xpath, "//a[@href='#{ask_deletion_dossier_path(dossier_brouillon)}']").click
|
||||||
|
end
|
||||||
|
|
||||||
|
expect(page).to have_content('Votre dossier a bien été supprimé.')
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -196,5 +196,65 @@ describe ChampSerializer do
|
||||||
expect(subject[:entreprise]).to include(capital_social: etablissement.entreprise_capital_social)
|
expect(subject[:entreprise]).to include(capital_social: etablissement.entreprise_capital_social)
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
|
||||||
|
context 'when type champ yes_no' do
|
||||||
|
context 'true' do
|
||||||
|
let(:champ) { create(:champ_yes_no, value: 'true') }
|
||||||
|
|
||||||
|
it { is_expected.to include(value: 'true') }
|
||||||
|
end
|
||||||
|
|
||||||
|
context 'false' do
|
||||||
|
let(:champ) { create(:champ_yes_no, value: 'false') }
|
||||||
|
|
||||||
|
it { is_expected.to include(value: 'false') }
|
||||||
|
end
|
||||||
|
|
||||||
|
context 'nil' do
|
||||||
|
let(:champ) { create(:champ_yes_no, value: nil) }
|
||||||
|
|
||||||
|
it { is_expected.to include(value: nil) }
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
context 'when type champ checkbox' do
|
||||||
|
context 'on' do
|
||||||
|
let(:champ) { create(:champ_checkbox, value: 'on') }
|
||||||
|
|
||||||
|
it { is_expected.to include(value: 'on') }
|
||||||
|
end
|
||||||
|
|
||||||
|
context 'off' do
|
||||||
|
let(:champ) { create(:champ_checkbox, value: 'off') }
|
||||||
|
|
||||||
|
it { is_expected.to include(value: 'off') }
|
||||||
|
end
|
||||||
|
|
||||||
|
context 'nil' do
|
||||||
|
let(:champ) { create(:champ_checkbox, value: nil) }
|
||||||
|
|
||||||
|
it { is_expected.to include(value: nil) }
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
context 'when type champ engagement' do
|
||||||
|
context 'on' do
|
||||||
|
let(:champ) { create(:champ_engagement, value: 'on') }
|
||||||
|
|
||||||
|
it { is_expected.to include(value: 'on') }
|
||||||
|
end
|
||||||
|
|
||||||
|
context 'off' do
|
||||||
|
let(:champ) { create(:champ_engagement, value: 'off') }
|
||||||
|
|
||||||
|
it { is_expected.to include(value: 'off') }
|
||||||
|
end
|
||||||
|
|
||||||
|
context 'nil' do
|
||||||
|
let(:champ) { create(:champ_engagement, value: nil) }
|
||||||
|
|
||||||
|
it { is_expected.to include(value: nil) }
|
||||||
|
end
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Add table
Reference in a new issue