[fix #445]: add title to pages

This commit is contained in:
Simon Lehericey 2017-11-17 23:40:51 +01:00
parent ee06b424bb
commit a71574b8dd
13 changed files with 53 additions and 1 deletions

View file

@ -355,6 +355,14 @@ class Dossier < ActiveRecord::Base
sanitize_sql_for_order(order)
end
def owner_name
if entreprise.present?
entreprise.raison_sociale
elsif individual.present?
"#{individual.nom} #{individual.prenom}"
end
end
private
def build_attestation

View file

@ -7,7 +7,7 @@
= csrf_meta_tags
%title
= t("dynamics.page_title")
= content_for?(:title) ? yield(:title) : "TPS - Téléprocédures simplifiées"
= favicon_link_tag(image_url("favicons/16x16.png"), type: "image/png", sizes: "16x16")
= favicon_link_tag(image_url("favicons/32x32.png"), type: "image/png", sizes: "32x32")

View file

@ -1,3 +1,6 @@
- avis_statut = (@statut == NewGestionnaire::AvisController::A_DONNER_STATUS) ? 'à donner' : 'rendus'
- content_for(:title, "Avis #{avis_statut}")
#avis-index
.backoffice-header
.container.flex

View file

@ -1,3 +1,5 @@
- content_for(:title, "Avis · Dossier nº #{@dossier.id} (#{@dossier.owner_name})")
#avis-show
= render partial: 'header', locals: { avis: @avis, dossier: @dossier }

View file

@ -1,3 +1,5 @@
- content_for(:title, "Messagerie · Dossier nº #{@dossier.id} (#{@dossier.owner_name})")
= render partial: 'header', locals: { avis: @avis, dossier: @dossier }
.messagerie.container

View file

@ -1,3 +1,5 @@
- content_for(:title, "Demande · Dossier nº #{@dossier.id} (#{@dossier.owner_name})")
#avis-show
= render partial: 'header', locals: { avis: @avis, dossier: @dossier }

View file

@ -1,3 +1,5 @@
- content_for(:title, "Annotations privées · Dossier nº #{@dossier.id} (#{@dossier.owner_name})")
= render partial: "header", locals: { dossier: @dossier }
#dossier-annotations-privees.container

View file

@ -1,3 +1,5 @@
- content_for(:title, "Avis · Dossier nº #{@dossier.id} (#{@dossier.owner_name})")
= render partial: "header", locals: { dossier: @dossier }
.container

View file

@ -1,3 +1,5 @@
- content_for(:title, "Messagerie · Dossier nº #{@dossier.id} (#{@dossier.owner_name})")
= render partial: "header", locals: { dossier: @dossier }
.messagerie.container

View file

@ -1,3 +1,5 @@
- content_for(:title, "Demande · Dossier nº #{@dossier.id} (#{@dossier.owner_name})")
= render partial: "header", locals: { dossier: @dossier }
.container

View file

@ -1,3 +1,5 @@
- content_for(:title, "Procédures")
.container
%h1.backoffice-title Procédures

View file

@ -1,3 +1,5 @@
- content_for(:title, "#{@procedure.libelle}")
#procedure-show
.backoffice-header
.container.flex

View file

@ -944,4 +944,27 @@ describe Dossier do
after { Timecop.return }
end
describe '#owner_name' do
let!(:procedure) { create(:procedure) }
subject { dossier.owner_name }
context 'when there is no entreprise or individual' do
let(:dossier) { create(:dossier, individual: nil, entreprise: nil, procedure: procedure) }
it { is_expected.to be_nil }
end
context 'when there is entreprise' do
let(:dossier) { create(:dossier, :with_entreprise, procedure: procedure) }
it { is_expected.to eq(dossier.entreprise.raison_sociale) }
end
context 'when there is an individual' do
let(:dossier) { create(:dossier, :for_individual, procedure: procedure) }
it { is_expected.to eq("#{dossier.individual.nom} #{dossier.individual.prenom}") }
end
end
end