Remove old caro editor
This commit is contained in:
parent
37a7e26fc3
commit
5632929d3d
8 changed files with 0 additions and 234 deletions
|
@ -1,52 +0,0 @@
|
|||
import { CREATE } from 'leaflet-freedraw';
|
||||
import { on } from '@utils';
|
||||
import { getData } from '../shared/data';
|
||||
import {
|
||||
initMap,
|
||||
geocodeAddress,
|
||||
drawUserSelection,
|
||||
drawCadastre,
|
||||
drawQuartiersPrioritaires,
|
||||
addFreeDrawEvents
|
||||
} from '../shared/carte';
|
||||
|
||||
function initialize() {
|
||||
const element = document.getElementById('map');
|
||||
|
||||
if (element) {
|
||||
const data = getData('carto');
|
||||
const map = initMap(element, data.position, true);
|
||||
|
||||
addAddressSelectEvent(map);
|
||||
|
||||
on('#new', 'click', () => {
|
||||
map.freeDraw.mode(CREATE);
|
||||
});
|
||||
|
||||
const cartoDrawZones = data => {
|
||||
drawCadastre(map, data, true);
|
||||
drawQuartiersPrioritaires(map, data, true);
|
||||
};
|
||||
|
||||
window.DS = { cartoDrawZones };
|
||||
|
||||
// draw external polygons
|
||||
cartoDrawZones(data);
|
||||
|
||||
// draw user polygon
|
||||
drawUserSelection(map, data, true);
|
||||
addFreeDrawEvents(map, 'input[name=selection]');
|
||||
}
|
||||
}
|
||||
|
||||
addEventListener('turbolinks:load', initialize);
|
||||
|
||||
function addAddressSelectEvent(map) {
|
||||
on(
|
||||
'#search-by-address input[type=address]',
|
||||
'autocomplete:select',
|
||||
(_, { label }) => {
|
||||
geocodeAddress(map, label);
|
||||
}
|
||||
);
|
||||
}
|
|
@ -11,8 +11,6 @@ import '../shared/autocomplete';
|
|||
import '../shared/remote-input';
|
||||
import '../shared/franceconnect';
|
||||
|
||||
import '../old_design/carto';
|
||||
|
||||
// Start Rails helpers
|
||||
Rails.start();
|
||||
Turbolinks.start();
|
||||
|
|
|
@ -1,8 +0,0 @@
|
|||
#carte-page.row
|
||||
.col-md-12.col-lg-12
|
||||
#map.carte.edit
|
||||
|
||||
%span.zones
|
||||
= render partial: 'zones', locals: { dossier: dossier, error: @error }
|
||||
|
||||
= render partial: 'shared/champs/carte/init', locals: { dossier: dossier }
|
|
@ -1,25 +0,0 @@
|
|||
- if dossier.procedure.module_api_carto.quartiers_prioritaires?
|
||||
.col-md-9.col-lg-9#qp.col-md-3.col-lg-3.list
|
||||
%h3.text-info Quartiers prioritaires
|
||||
- if dossier.quartier_prioritaires.blank?
|
||||
Aucun quartier prioritaire sur les zones séléctionnées
|
||||
- else
|
||||
%ul
|
||||
- dossier.quartier_prioritaires.each do |qp|
|
||||
%li #{qp.commune} : #{qp.nom}
|
||||
|
||||
- if error.present?
|
||||
%b Merci de dessiner une surface plus petite afin de récupérer les quartiers prioritaires.
|
||||
|
||||
- if dossier.procedure.module_api_carto.cadastre?
|
||||
.col-md-9.col-lg-9#cadastre.col-md-3.col-lg-3.list
|
||||
%h3.text-warning Parcelles cadastrales
|
||||
- if dossier.cadastres.blank?
|
||||
Aucune parcelle cadastrale sur les zones séléctionnées
|
||||
- else
|
||||
%ul
|
||||
- dossier.cadastres.each do |cadastre|
|
||||
%li Parcelle nº #{cadastre.numero} - Feuille #{cadastre.code_arr} #{cadastre.section} #{cadastre.feuille}
|
||||
|
||||
- if error.present?
|
||||
%b Merci de dessiner une surface plus petite afin de récupérer les parcelles cadastrales.
|
|
@ -1,28 +0,0 @@
|
|||
.row#carto-page
|
||||
.col-lg-12.col-md-12.col-sm-12.col-xs-12
|
||||
%h2
|
||||
Localisation
|
||||
%h4.text-primary
|
||||
Positionnez-vous et dessinez sur la carte la zone d'action de votre demande.
|
||||
%br
|
||||
|
||||
.content{ style: 'margin-bottom: 60px;' }
|
||||
%button#new.btn.btn-md.btn-success{ type: 'button' }
|
||||
%i.fa.fa-pencil
|
||||
Ajouter une zone
|
||||
|
||||
%span#search-by-address{ style: 'margin-left: 20px;' }
|
||||
%input.form-control{ type: :address, data: { autocomplete: 'address' }, placeholder: 'Rechercher une adresse' }
|
||||
%br
|
||||
%br
|
||||
|
||||
= render partial: 'users/carte/map', locals: { dossier: @dossier }
|
||||
|
||||
= form_tag(url_for({ controller: :carte, action: :save, dossier_id: @dossier.id }), class: 'form-inline', method: 'POST') do
|
||||
%br
|
||||
%input{ type: 'hidden', value: "#{@dossier.json_latlngs}", name: 'selection', data: { remote: true, url: users_dossier_carte_zones_path(@dossier), method: 'POST' } }
|
||||
|
||||
- if @dossier.brouillon?
|
||||
= render partial: '/layouts/etape_suivante'
|
||||
- else
|
||||
= render partial: '/layouts/modifications_terminees'
|
|
@ -1,2 +0,0 @@
|
|||
DS.cartoDrawZones(<%= raw(@data.to_json) %>);
|
||||
<%= render_to_element('.zones', partial: 'zones', locals: { dossier: @dossier, error: @error }) %>
|
|
@ -1,57 +0,0 @@
|
|||
require 'spec_helper'
|
||||
|
||||
feature 'drawing a zone with freedraw' do
|
||||
let(:user) { create(:user) }
|
||||
let(:module_api_carto) { create(:module_api_carto, :with_api_carto) }
|
||||
let(:procedure) { create(:procedure, module_api_carto: module_api_carto) }
|
||||
let(:dossier) { create(:dossier, :with_entreprise, procedure: procedure, user: user) }
|
||||
|
||||
context 'when user is not logged in' do
|
||||
before do
|
||||
visit users_dossier_carte_path dossier_id: dossier.id
|
||||
end
|
||||
|
||||
scenario 'he is redirected to login page' do
|
||||
expect(page).to have_css('#new_user')
|
||||
end
|
||||
|
||||
scenario 'he logs in and he is redirected to carte page', vcr: { cassette_name: 'drawing_a_zone_with_freedraw_redirected_to_carte_page' } do
|
||||
within('#new_user') do
|
||||
page.find_by_id('user_email').set user.email
|
||||
page.find_by_id('user_password').set user.password
|
||||
page.click_on 'Se connecter'
|
||||
end
|
||||
expect(page).to have_css('.content #map')
|
||||
end
|
||||
end
|
||||
|
||||
context 'when user is logged in' do
|
||||
before do
|
||||
login_as user, scope: :user
|
||||
end
|
||||
|
||||
context 'when he is visiting the map page' do
|
||||
before do
|
||||
visit users_dossier_carte_path dossier_id: dossier.id
|
||||
end
|
||||
|
||||
context 'when procedure have api carto activated' do
|
||||
scenario 'he is redirected to carte page', vcr: { cassette_name: 'drawing_a_zone_with_freedraw_redirected_to_carte_page' } do
|
||||
expect(page).to have_css('.content #map')
|
||||
end
|
||||
end
|
||||
|
||||
context 'when procedure does not have api carto activated' do
|
||||
let(:module_api_carto) { create(:module_api_carto) }
|
||||
|
||||
scenario 'he is redirect to user dossiers index' do
|
||||
expect(page).to have_css('.dossiers-table')
|
||||
end
|
||||
|
||||
scenario 'alert message is present' do
|
||||
expect(page).to have_content('Le statut de votre dossier n\'autorise pas cette URL')
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
|
@ -1,60 +0,0 @@
|
|||
require 'spec_helper'
|
||||
|
||||
describe 'users/carte/show.html.haml', type: :view do
|
||||
let(:state) { Dossier.states.fetch(:brouillon) }
|
||||
let(:dossier) { create(:dossier, state: state) }
|
||||
let(:dossier_id) { dossier.id }
|
||||
|
||||
before do
|
||||
assign(:dossier, dossier)
|
||||
end
|
||||
|
||||
context 'sur la page de la carte d\'une demande' do
|
||||
before do
|
||||
render
|
||||
end
|
||||
it 'le formulaire envoie vers /users/dossiers/:dossier_id/carte en #POST' do
|
||||
expect(rendered).to have_selector("form[action='/users/dossiers/#{dossier_id}/carte'][method=post]")
|
||||
end
|
||||
|
||||
it 'la carte est bien présente' do
|
||||
expect(rendered).to have_selector('#map')
|
||||
end
|
||||
|
||||
context 'présence des inputs hidden' do
|
||||
it 'stockage du json des polygons dessinés' do
|
||||
expect(rendered).to have_selector('input[type=hidden][name=selection]', visible: false)
|
||||
end
|
||||
end
|
||||
|
||||
context 'si la page précédente n\'est pas la page du dossier' do
|
||||
it 'le bouton "Etape suivante" est présent' do
|
||||
expect(rendered).to have_selector('#etape_suivante')
|
||||
end
|
||||
|
||||
# it 'le bouton Etape suivante possède un onclick correct' do
|
||||
# expect(rendered).to have_selector('input[type=submit][id=etape_suivante][onclick=\'submit_check_draw(event)\']')
|
||||
# end
|
||||
end
|
||||
|
||||
context 'si la page précédente est la page du dossier' do
|
||||
let(:state) { Dossier.states.fetch(:en_construction) }
|
||||
|
||||
it 'le bouton "Etape suivante" n\'est pas présent' do
|
||||
expect(rendered).to_not have_selector('#etape_suivante')
|
||||
end
|
||||
|
||||
it 'le bouton "Modification terminé" est présent' do
|
||||
expect(rendered).to have_selector('#modification_terminee')
|
||||
end
|
||||
|
||||
# it 'le bouton "Modification terminé" possède un onclick correct' do
|
||||
# expect(rendered).to have_selector('input[type=submit][id=modification_terminee][onclick=\'submit_check_draw(event)\']')
|
||||
# end
|
||||
|
||||
it 'le lien de retour à la page du dossier est présent' do
|
||||
expect(rendered).to have_selector("a[href='/dossiers/#{dossier_id}']")
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
Loading…
Reference in a new issue