Merge pull request #481 from sgmap/add_inline_address_to_etablissement
Add inline address to etablissement
This commit is contained in:
commit
03b735800b
4 changed files with 13 additions and 2 deletions
|
@ -75,7 +75,7 @@ class AttestationTemplate < ApplicationRecord
|
||||||
end
|
end
|
||||||
|
|
||||||
def etablissement_tags
|
def etablissement_tags
|
||||||
[{ libelle: 'adresse', description: '', target: 'adresse' }]
|
[{ libelle: 'adresse', description: '', target: 'inline_adresse' }]
|
||||||
end
|
end
|
||||||
|
|
||||||
def build_pdf(dossier)
|
def build_pdf(dossier)
|
||||||
|
|
|
@ -9,4 +9,9 @@ class Etablissement < ActiveRecord::Base
|
||||||
def geo_adresse
|
def geo_adresse
|
||||||
[numero_voie, type_voie, nom_voie, complement_adresse, code_postal, localite].join(' ')
|
[numero_voie, type_voie, nom_voie, complement_adresse, code_postal, localite].join(' ')
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def inline_adresse
|
||||||
|
#squeeze needed because of space in excess in the data
|
||||||
|
"#{numero_voie} #{type_voie} #{nom_voie}, #{complement_adresse}, #{code_postal} #{localite}".squeeze(' ')
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -159,7 +159,7 @@ describe AttestationTemplate, type: :model do
|
||||||
let(:etablissement) { create(:etablissement, adresse: 'adresse') }
|
let(:etablissement) { create(:etablissement, adresse: 'adresse') }
|
||||||
let(:template_title) { '--adresse--' }
|
let(:template_title) { '--adresse--' }
|
||||||
|
|
||||||
it { expect(view_args[:title]).to eq('adresse') }
|
it { expect(view_args[:title]).to eq(etablissement.inline_adresse) }
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -29,4 +29,10 @@ describe Etablissement do
|
||||||
|
|
||||||
it { is_expected.to eq '6 RUE RAOUL NORDLING IMMEUBLE BORA 92270 BOIS COLOMBES' }
|
it { is_expected.to eq '6 RUE RAOUL NORDLING IMMEUBLE BORA 92270 BOIS COLOMBES' }
|
||||||
end
|
end
|
||||||
|
|
||||||
|
describe '#inline_adresse' do
|
||||||
|
let(:etablissement) { create(:etablissement, nom_voie: 'green moon') }
|
||||||
|
|
||||||
|
it { expect(etablissement.inline_adresse).to eq '6 RUE green moon, IMMEUBLE BORA, 92270 BOIS COLOMBES' }
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in a new issue