Merge branch 'dev'

This commit is contained in:
Simon Lehericey 2017-10-25 11:21:28 +02:00
commit af7a9b59a6
11 changed files with 78 additions and 10 deletions

View file

@ -18,3 +18,9 @@
margin-bottom: -1px;
}
}
.mixed-buttons-bar .button {
// Needed so that buttons without text
// are ligned with those that have text
vertical-align: top;
}

View file

@ -93,10 +93,14 @@
}
}
&.icon-only .icon {
&.icon-only {
padding: 9px 16px;
.icon {
margin-right: 0;
}
}
}
.dropdown-content {
border: 1px solid $border-grey;

View file

@ -1,5 +1,5 @@
class Avis < ApplicationRecord
belongs_to :dossier
belongs_to :dossier, touch: true
belongs_to :gestionnaire
belongs_to :claimant, class_name: 'Gestionnaire'

View file

@ -1,5 +1,5 @@
class Cadastre < ActiveRecord::Base
belongs_to :dossier
belongs_to :dossier, touch: true
def geometry
JSON.parse(read_attribute(:geometry))

View file

@ -1,5 +1,5 @@
class Cerfa < ActiveRecord::Base
belongs_to :dossier
belongs_to :dossier, touch: true
belongs_to :user
mount_uploader :content, CerfaUploader

View file

@ -1,5 +1,5 @@
class Champ < ActiveRecord::Base
belongs_to :dossier
belongs_to :dossier, touch: true
belongs_to :type_de_champ
has_many :commentaires

View file

@ -1,5 +1,5 @@
class Commentaire < ActiveRecord::Base
belongs_to :dossier
belongs_to :dossier, touch: true
belongs_to :champ
belongs_to :piece_justificative

View file

@ -1,5 +1,5 @@
class PieceJustificative < ActiveRecord::Base
belongs_to :dossier
belongs_to :dossier, touch: true
belongs_to :type_de_piece_justificative
has_one :commentaire

View file

@ -1,5 +1,5 @@
class QuartierPrioritaire < ActiveRecord::Base
belongs_to :dossier
belongs_to :dossier, touch: true
def geometry
JSON.parse(read_attribute(:geometry))

View file

@ -6,7 +6,7 @@
= link_to dossier.procedure.libelle.truncate_words(10), procedure_path(dossier.procedure), title: dossier.procedure.libelle
%li
= "Dossier nº #{dossier.id}"
%div
.mixed-buttons-bar
= link_to print_dossier_path(dossier.procedure, dossier), target: "_blank", class: "button icon-only" do
.icon.printer>
= render partial: "new_gestionnaire/procedures/dossier_actions", locals: { procedure: dossier.procedure, dossier: dossier, dossier_is_followed: current_gestionnaire&.follow?(dossier) }

View file

@ -886,4 +886,62 @@ describe Dossier do
it { expect(dossier.get_value('type_de_champ', @champ_public.type_de_champ.id.to_s)).to eq(dossier.champs.first.value) }
it { expect(dossier.get_value('type_de_champ_private', @champ_private.type_de_champ.id.to_s)).to eq(dossier.champs_private.first.value) }
end
describe 'updated_at', focus: true do
let!(:dossier) { create(:dossier) }
let(:modif_date) { DateTime.parse('01/01/2100') }
before { Timecop.freeze(modif_date) }
subject do
dossier.reload
dossier.updated_at
end
it { is_expected.not_to eq(modif_date) }
context 'when a cerfa is modified' do
before { dossier.cerfa << create(:cerfa) }
it { is_expected.to eq(modif_date) }
end
context 'when a piece justificative is modified' do
before { dossier.pieces_justificatives << create(:piece_justificative, :contrat) }
it { is_expected.to eq(modif_date) }
end
context 'when a champ is modified' do
before { dossier.champs.first.update_attribute('value', 'yop') }
it { is_expected.to eq(modif_date) }
end
context 'when a quartier_prioritaire is modified' do
before { dossier.quartier_prioritaires << create(:quartier_prioritaire) }
it { is_expected.to eq(modif_date) }
end
context 'when a cadastre is modified' do
before { dossier.cadastres << create(:cadastre) }
it { is_expected.to eq(modif_date) }
end
context 'when a commentaire is modified' do
before { dossier.commentaires << create(:commentaire) }
it { is_expected.to eq(modif_date) }
end
context 'when an avis is modified' do
before { dossier.avis << create(:avis) }
it { is_expected.to eq(modif_date) }
end
after { Timecop.return }
end
end