Reactive cartographie
This commit is contained in:
parent
db10c4023e
commit
e258118825
10 changed files with 45 additions and 150 deletions
|
@ -106,6 +106,14 @@
|
|||
color: #000000;
|
||||
}
|
||||
}
|
||||
|
||||
#carto {
|
||||
#map {
|
||||
margin-bottom: 20px;
|
||||
height: 350px;
|
||||
}
|
||||
}
|
||||
|
||||
#dossier, #pieces-jointes, .infos, #carto, #private-fields {
|
||||
.body {
|
||||
padding: 20px 20px 0 20px;
|
||||
|
|
|
@ -83,17 +83,22 @@
|
|||
= render partial: '/dossiers/infos_dossier'
|
||||
|
||||
- if @facade.dossier.procedure.module_api_carto.use_api_carto
|
||||
- if false
|
||||
.default_data_block
|
||||
%div.row.show-block#carto
|
||||
%div.header
|
||||
%div.col-lg-10.col-md-10.title
|
||||
%div.carret-right
|
||||
%div.carret-down
|
||||
CARTOGRAPHIE
|
||||
= render partial: '/dossiers/edit_carto'
|
||||
%div.body
|
||||
= render partial: '/dossiers/infos_carto'
|
||||
.default_data_block.default_visible
|
||||
%div.row.show-block#carto
|
||||
%div.header
|
||||
%div.col-lg-10.col-md-10.title
|
||||
%div.carret-right
|
||||
%div.carret-down
|
||||
CARTOGRAPHIE
|
||||
= render partial: '/dossiers/edit_carto'
|
||||
%div.body
|
||||
%input{id: 'json_latlngs', type: 'hidden', value: "#{@facade.dossier.json_latlngs}", name: 'json_latlngs'}
|
||||
%input{id: 'quartier_prioritaires', type: 'hidden', value: "#{@facade.dossier.quartier_prioritaires.to_json}"}
|
||||
%input{id: 'cadastres', type: 'hidden', value: "#{@facade.dossier.cadastres.to_json}"}
|
||||
|
||||
= render partial: '/users/carte/map', locals: {dossier: @facade.dossier}
|
||||
= render partial: 'users/carte/init_carto', locals: {dossier: @facade.dossier}
|
||||
|
||||
|
||||
- if @current_gestionnaire && gestionnaire_signed_in? && @champs.count > 0
|
||||
.default_data_block
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
- unless @facade.dossier.read_only?
|
||||
- if user_signed_in? && (@facade.dossier.owner?(current_user.email) || @facade.dossier.invite_by_user?(current_user.email))
|
||||
%div.col-lg-2.col-md-2.action
|
||||
%a#maj_carte.action{href: "/users/dossiers/#{@facade.dossier.id}/carte"}
|
||||
%a#maj_carte.action{href: "/users/dossiers/#{@facade.dossier.id}/carte"}
|
||||
%div.col-lg-2.col-md-2.action
|
||||
= 'éditer'.upcase
|
||||
|
|
4
app/views/users/carte/_init_carto.html.haml
Normal file
4
app/views/users/carte/_init_carto.html.haml
Normal file
|
@ -0,0 +1,4 @@
|
|||
%script{type: 'text/javascript'}
|
||||
="var dossier_id =#{dossier.id}"
|
||||
$(document).on('page:load', initCarto);
|
||||
$(document).ready(initCarto);
|
13
app/views/users/carte/_map.html.haml
Normal file
13
app/views/users/carte/_map.html.haml
Normal file
|
@ -0,0 +1,13 @@
|
|||
#carte_page.row
|
||||
#map{class: dossier.procedure.module_api_carto.classes }
|
||||
|
||||
- if dossier.procedure.module_api_carto.quartiers_prioritaires
|
||||
#qp.list
|
||||
%h3.text-info Quartiers prioritaites
|
||||
%ul
|
||||
|
||||
- if dossier.procedure.module_api_carto.cadastre
|
||||
#cadastre.list
|
||||
%h3.text-warning Cadastres
|
||||
%ul
|
||||
|
|
@ -10,27 +10,13 @@
|
|||
%button#new.btn.btn-md.btn-success{type:'button'}
|
||||
%i.fa.fa-pencil
|
||||
Ajouter une zone
|
||||
-#\-
|
||||
-#%button#edit.btn.btn-sm.btn-info{type:'button'} Editer
|
||||
-#\-
|
||||
-#%button#delete.btn.btn-sm.btn-danger{type:'button'} Supprimer
|
||||
|
||||
%span#search_by_address{style: 'margin-left: 20px'}
|
||||
%input.form-control{type: :address, placeholder: 'Rechercher une adresse'}
|
||||
%br
|
||||
%br
|
||||
#carte_page.row
|
||||
#map{class: @dossier.procedure.module_api_carto.classes }
|
||||
|
||||
- if @dossier.procedure.module_api_carto.quartiers_prioritaires
|
||||
#qp.list
|
||||
%h3.text-info Quartiers prioritaites
|
||||
%ul
|
||||
|
||||
- if @dossier.procedure.module_api_carto.cadastre
|
||||
#cadastre.list
|
||||
%h3.text-warning Cadastres
|
||||
%ul
|
||||
=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
|
||||
|
@ -43,6 +29,4 @@
|
|||
-else
|
||||
=render partial: '/layouts/modifications_terminees'
|
||||
|
||||
%script{type: 'text/javascript'}
|
||||
="var dossier_id =#{@dossier.id}"
|
||||
initCarto();
|
||||
= render partial: 'users/carte/init_carto', locals: {dossier: @dossier}
|
||||
|
|
|
@ -1,19 +0,0 @@
|
|||
.content{id: ('commentaires_flux' + (@facade.champ_id.nil? ? '' : "_#{@facade.champ_id}")),style:'width:100%;'}
|
||||
-@facade.commentaires.each do |com|
|
||||
%span.text-info#email_contact{style: 'font-weight:bold'}
|
||||
=com.email
|
||||
%span#created_at
|
||||
\-
|
||||
=com.created_at_fr
|
||||
- unless com.piece_justificative.nil?
|
||||
\-
|
||||
%span#piece_justificative
|
||||
%b
|
||||
= link_to com.piece_justificative.original_filename, com.piece_justificative.content_url, style:'color: green', target: '_blank'
|
||||
|
||||
%br
|
||||
.description#body
|
||||
=com.body.html_safe
|
||||
|
||||
|
||||
%br
|
|
@ -16,45 +16,4 @@ feature 'procedure locked' do
|
|||
expect(page).not_to have_content('La procédure ne peut plus être modifiée car elle a été publiée')
|
||||
end
|
||||
end
|
||||
context 'when procedure is published' do
|
||||
pending 'à voir si on enlève complètement les référence dans le left panel ou pas'
|
||||
# let(:published) { true }
|
||||
# before do
|
||||
# visit admin_procedure_path(procedure)
|
||||
# end
|
||||
#
|
||||
# scenario 'info label is present' do
|
||||
# expect(page).to have_content('La procédure ne peut plus être modifiée car elle a été publiée')
|
||||
# end
|
||||
#
|
||||
# context 'when user click on Description tab' do
|
||||
# before do
|
||||
# page.click_on 'Description'
|
||||
# end
|
||||
#
|
||||
# scenario 'page doest not change' do
|
||||
# expect(page).to have_css('#procedure_show')
|
||||
# end
|
||||
# end
|
||||
#
|
||||
# context 'when user click on Champs tab' do
|
||||
# before do
|
||||
# page.click_on 'Champs'
|
||||
# end
|
||||
#
|
||||
# scenario 'page doest not change' do
|
||||
# expect(page).to have_css('#procedure_show')
|
||||
# end
|
||||
# end
|
||||
#
|
||||
# context 'when user click on Pieces Justificatives tab' do
|
||||
# before do
|
||||
# page.click_on 'Pièces justificatives'
|
||||
# end
|
||||
#
|
||||
# scenario 'page doest not change' do
|
||||
# expect(page).to have_css('#procedure_show')
|
||||
# end
|
||||
# end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -1,56 +0,0 @@
|
|||
require 'spec_helper'
|
||||
|
||||
describe 'users/recapitulatif/_commentaires_flux.html.haml', type: :view, vcr: { cassette_name: 'views_users_recapitulatif_commentaires_flux' } do
|
||||
let(:dossier) { create(:dossier) }
|
||||
let(:dossier_id) { dossier.id }
|
||||
let(:email_commentaire) { 'mon_mail_de_commentaire@test.com' }
|
||||
|
||||
let(:document_upload) { Rack::Test::UploadedFile.new("./spec/support/files/piece_justificative_0.pdf", 'application/pdf') }
|
||||
let(:pj) { create :piece_justificative, content: document_upload }
|
||||
|
||||
let!(:commentaire) { create(:commentaire, dossier: dossier, email: email_commentaire, body: 'ma super description', piece_justificative: pj) }
|
||||
let(:body) { 'Commentaire de test' }
|
||||
|
||||
before do
|
||||
assign(:facade, DossierFacades.new(dossier.id, dossier.user.email))
|
||||
render
|
||||
end
|
||||
|
||||
pending 'à supprimer quand les tests seront vert'
|
||||
|
||||
# context 'Affichage du flux de commentaire' do
|
||||
# it 'l\'email du contact est présent' do
|
||||
# expect(rendered).to have_selector('span[id=email_contact]')
|
||||
# end
|
||||
#
|
||||
# it 'la date du commentaire est présent' do
|
||||
# expect(rendered).to have_selector('span[id=created_at]')
|
||||
# end
|
||||
#
|
||||
# it 'le corps du commentaire est présent' do
|
||||
# expect(rendered).to have_selector('div[class=description][id=body]')
|
||||
# end
|
||||
#
|
||||
# context 'when commentaire as PJ' do
|
||||
# it 'commentaire present the link' do
|
||||
# expect(rendered).to have_css('#piece_justificative')
|
||||
# end
|
||||
# end
|
||||
# end
|
||||
#
|
||||
# context 'Affichage du formulaire de commentaire' do
|
||||
# it 'Le formulaire envoie vers /dossiers/:dossier_id/commentaire en #POST' do
|
||||
# expect(rendered).to have_selector("form[action='/users/dossiers/#{dossier_id}/commentaire'][method=post]")
|
||||
# end
|
||||
#
|
||||
# it 'Champs de texte' do
|
||||
# expect(rendered).to have_selector('textarea[id=texte_commentaire][name=texte_commentaire]')
|
||||
# end
|
||||
#
|
||||
# describe 'File input' do
|
||||
# it 'have file_input tag' do
|
||||
# expect(rendered).to have_css('#piece_justificative_content')
|
||||
# end
|
||||
# end
|
||||
# end
|
||||
end
|
|
@ -55,12 +55,10 @@ describe 'users/recapitulatif/show.html.haml', type: :view do
|
|||
|
||||
context 'lien carte' do
|
||||
it 'le lien vers carte est présent' do
|
||||
pending 'map: later'
|
||||
expect(rendered).to have_css('#maj_carte')
|
||||
end
|
||||
|
||||
it 'le lien vers description est correct' do
|
||||
pending 'map: later'
|
||||
expect(rendered).to have_selector("a[id=maj_carte][href='/users/dossiers/#{dossier_id}/carte']")
|
||||
end
|
||||
end
|
||||
|
@ -139,7 +137,6 @@ describe 'users/recapitulatif/show.html.haml', type: :view do
|
|||
end
|
||||
|
||||
it 'map link is present' do
|
||||
pending 'map: later'
|
||||
expect(rendered).to have_css('#maj_carte')
|
||||
end
|
||||
|
||||
|
|
Loading…
Reference in a new issue